void OnTriggerEnter(Collider obj)
 {
     if (obj.gameObject.tag == "boulder")
     {
         Debug.Log("collided with boulder.");
         Player_ship.Sub(2, 1);
         Destroy(obj.gameObject);
     }
     if (obj.gameObject.tag == "addammo")
     {
         Player_ship.Add(3, 1);
         Destroy(obj.gameObject);
     }
     if (obj.gameObject.tag == "addshield")
     {
         Player_ship.Add(2, 1);
         Destroy(obj.gameObject);
     }
     if (obj.gameObject.tag == "addspecial1")
     {
         Player_ship.Add(4, 1);
         Destroy(obj.gameObject);
     }
     if (obj.gameObject.tag == "addspecial2")
     {
         Player_ship.Add(5, 1);
         Destroy(obj.gameObject);
     }
     if (obj.gameObject.tag == "coin")
     {
         Player_ship.Add(6, 1);
         Destroy(obj.gameObject);
     }
 }
Exemplo n.º 2
0
 void Death(int x)
 {
     if (x == 1)
     {
         Player_ship.Add(1, 1);
         Destroy(gameObject);
     }
     else if (x == 2)
     {
         Player_ship.Sub(2, 1);
         Destroy(gameObject);
     }
     else if (x == 0)
     {
         Player_ship.Add(1, 1);
         Destroy(gameObject);
     }
 }
Exemplo n.º 3
0
    void OnCollisionEnter(Collision obj)
    {
        if (obj.gameObject.tag == "Player" || obj.gameObject.tag == "bullet" || obj.gameObject.tag == "missile")
        {
            Debug.Log("Collided with player.");
            switch (id)
            {            //ammo,shields,s1,s2
            case 1:
                Player_ship.Add(3, 20);
                Destroy(gameObject);
                break;

            case 2:
                Player_ship.Add(2, 1);
                Destroy(gameObject);
                break;

            case 3:
                Player_ship.Add(4, 1);
                Destroy(gameObject);
                break;

            case 4:
                Player_ship.Add(5, 1);
                Destroy(gameObject);
                break;

            case 5:
                Player_ship.Add(6, 1);
                Destroy(gameObject);
                break;
            }
        }
        else
        {
            Debug.Log("Collided");
        }
    }