Exemple #1
0
    // Use this for initialization
    void Start()
    {
        // if (shapeInstance != null)
        // {
        //  DestroyImmediate (shapeInstance);
        // }
        // shapeInstance = (GameObject) Instantiate (shape);
        shape = GetComponentInChildren <Shape> ();
        // shapeInstance = shape.transform.parent.gameObject;

        // shapeInstance.transform.SetParent (gameObject.transform);
        // shapeInstance.transform.localPosition = Vector3.zero;
        shape.transform.parent.localScale = new Vector3(0.25f, 0.25f, 0.25f);
        shape.FreezeRotation = true;
        shape.gridSource     = shapeData.ShapeString;
        shape.Regenerate();
        gameObject.SetLayerRecursively(LayerMask.NameToLayer("Default"));
        gameObject.layer = LayerMask.NameToLayer("Terminals");
        SineWaveMovement swm = gameObject.AddComponent <SineWaveMovement> ();

        swm.Magnitude         = 0.09f;
        swm.VerticalSpeed     = 2;
        swm.RotationVelocityX = Random.Range(-35, 35);
        swm.RotationVelocityY = Random.Range(-35, 35);
        swm.RotationVelocityZ = Random.Range(-35, 35);
    }
Exemple #2
0
    IEnumerator EndLevel()
    {
        swm = GetComponent <SineWaveMovement> ();
        while (swm.RotationVelocityY < 1500)
        {
            swm.RotationVelocityY += 5;
            yield return(null);
        }
        yield return(new WaitForSeconds(3));

        SceneManager.LoadScene("MainMenu");
        yield return(null);
    }