Ejemplo n.º 1
0
 void OnCollisionEnter2D(Collision2D coll) //this portion of the code is what happens when Steve collides with the item
                                           // you will have to customize it to act according to the power-up or power-down
 {
     if (coll.gameObject.tag == "Player")
     {
         StarSound sound = GameObject.FindObjectOfType(typeof(StarSound)) as StarSound;
         sound.TriggerSound();
         SteveScript steve = GameObject.FindObjectOfType <SteveScript>();
         steve.tiny();
         Destroy(gameObject);
     }
 }
Ejemplo n.º 2
0
 void OnCollisionEnter2D(Collision2D coll)   //this portion of the code is what happens when Steve collides with the item
                                             // you will have to customize it to act according to the power-up or power-down
 {
     if (coll.gameObject.tag == "Player")
     {
         StarSound sound = GameObject.FindObjectOfType(typeof(StarSound)) as StarSound;
         sound.TriggerSound();
         GameObject bouncer = GameObject.Find("Bouncer_1");
         MoveScript b       = bouncer.GetComponent <MoveScript>();
         b.initiateRemove();
         Destroy(gameObject);
     }
 }
Ejemplo n.º 3
0
    void OnCollisionEnter2D(Collision2D coll)
    {
        if (canMove && coll.gameObject.tag == "bouncer")
        {
            StartCoroutine(moveTimer());
        }

        if (coll.gameObject.tag == "star")
        {
            StartCoroutine(Flasher());
            StarSound sound = GameObject.FindObjectOfType(typeof(StarSound)) as StarSound;
            sound.TriggerSound();
        }

        if (coll.gameObject.tag == "powerup")
        {
            StartCoroutine(UpFlash());
        }

        if (coll.gameObject.tag == "powerdown")
        {
            StartCoroutine(DownFlash());
        }
    }