當前位置: 首頁>>代碼示例>>C#>>正文


C# Ball.Respawn方法代碼示例

本文整理匯總了C#中Ball.Respawn方法的典型用法代碼示例。如果您正苦於以下問題:C# Ball.Respawn方法的具體用法?C# Ball.Respawn怎麽用?C# Ball.Respawn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Ball的用法示例。


在下文中一共展示了Ball.Respawn方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: initLevel

    /*
       INITLEVEL: restarts the current level, resets ball status and position; respawns any destructibles.
       */
    public void initLevel()
    {
        print("Level initialized");
        GameMenuLose = GameObject.Find("LoseMenu");
        GameMenuWin = GameObject.Find("WinMenu");
        RespawnableObjects = GameObject.FindGameObjectsWithTag("BuildOnEnd");
        RespawnableObjectsWithParticles = GameObject.FindGameObjectsWithTag("BuildOnEndParticleChild");

        // Initlevel may have an external call
        objectBall = GameObject.Find("RollerBall");
        theBall = (Ball)objectBall.GetComponent(typeof(Ball));

        //Default parameters
        Resume();
        GameMenuWin.SetActive(false);
        GameMenuLose.SetActive(false);
        theBall.Respawn();
        CountText.text = (lvl_timer).ToString();
        theBall.setStatus(0);
        CurrentTime = 0;

        for (int i = 0; i< RespawnableObjects.Length; i++)
        {
            print(RespawnableObjects[i].name);
            RespawnableObjects[i].GetComponent<Collider>().enabled = true;
            RespawnableObjects[i].GetComponent<Renderer>().enabled = true;

        }

        /*
        VERY IMPORTANT THE STRUCTURE OF A PARTICLE POWERUP MUST BE OF THE STRUCTURE
            POWERUP_
                .CHILD PARTICLE 1  ->SPACE(0)
                .CHILD PARTICLE 2  ->SPACE(1)

        */

        for (int i = 0; i <RespawnableObjectsWithParticles.Length; i++)
        {
            print("Respanwed: "+RespawnableObjectsWithParticles[i].name);
            RespawnableObjectsWithParticles[i].GetComponent<Collider>().enabled = true;
            RespawnableObjectsWithParticles[i].transform.GetChild(0).GetComponent<ParticleSystem>().enableEmission = true;
            RespawnableObjectsWithParticles[i].transform.GetChild(1).GetComponent<ParticleSystem>().enableEmission = true;

        }
    }
開發者ID:keny91,項目名稱:BallsMazes-Unity,代碼行數:49,代碼來源:LVL_controler.cs

示例2: Start

    // Use this for initialization
    void Start()
    {
        audioS = gameObject.AddComponent<AudioSource>();

        objectBall = GameObject.Find("RollerBall");
        theBall = (Ball)objectBall.GetComponent(typeof(Ball));
        theBall.Respawn();
        print("BALL AT START during the beggining");
        initLevel();
    }
開發者ID:keny91,項目名稱:BallsMazes-Unity,代碼行數:11,代碼來源:LVL_controler.cs


注:本文中的Ball.Respawn方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。