示例#1
0
    IEnumerator startPlayer()
    {
        cubeBouclier.transform.parent.transform.position = new Vector3(thePlayer.transform.position.x, 0f, thePlayer.transform.position.z);
        cubeIncoming.gameObject.SetActive(true);
        cubeBouclier.gameObject.SetActive(true);
        speedRotation = 180f;
        var theTime = 0f;

        yield return(0);

        while (theTime < 2f)
        {
            cubeBouclier.transform.Rotate(new Vector3(0f, 0f, speedRotation * Time.deltaTime));
            speedRotation += 360f * Time.deltaTime;
            theTime       += Time.deltaTime;
            yield return(0);
        }
        cubeIncoming.gameObject.SetActive(false);
        cubeExplode.gameObject.SetActive(true);
        thePlayer.SetActive(true);
        dl.startTheLevel();
        levelStarted = true;

        cubeBouclier.transform.Rotate(new Vector3(0f, 0f, speedRotation * Time.deltaTime));
        cubeExplode.transform.Rotate(new Vector3(0f, 0f, speedRotation * Time.deltaTime));
        yield return(0);

        theTime = 0f;
        while (theTime < 1f)
        {
            cubeBouclier.transform.Rotate(new Vector3(0f, 0f, speedRotation * Time.deltaTime));
            cubeExplode.transform.Rotate(new Vector3(0f, 0f, speedRotation * Time.deltaTime));
            speedRotation -= 360f * Time.deltaTime;
            theTime       += Time.deltaTime;
            yield return(0);
        }

        cubeBouclier.gameObject.SetActive(false);
        cubeExplode.gameObject.SetActive(false);
    }