Exemplo n.º 1
0
    // Update is called once per frame
    void Win()
    {
        hasWon = true;

        musichandler.ChangeMusic(winMusic, false);
        int i = 0;

        foreach (GameObject egg in eggs)
        {
            if (egg != null)
            {
                //snaps egg to player position
                //egg.transform.position = new Vector3(eggDelta.x * Mathf.Pow(i,2f) + transform.position.x, transform.position.y + 1f + (i*eggDistance), transform.position.z);
                Destroy(egg.gameObject);

                i++;
            }
        }

        canMove = false;



        animator.SetTrigger("win");
    }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        audio    = GetComponent <AudioSource> ();
        eggs     = new List <GameObject> ();
        rb       = GetComponent <Rigidbody2D> ();
        animator = GetComponent <Animator> ();

        musichandler = music.GetComponent <musicHandler> ();



        totalDistanceFromGoal = Mathf.Abs(transform.position.x - goal.transform.position.x);

        for (int i = 0; i < startEggs; i++)
        {
            eggs.Add((GameObject)Instantiate(headEgg, transform.position + Vector3.up, Quaternion.identity));
        }

        musichandler.ChangeMusic(levelMusic, true);
    }