Пример #1
0
 void SpeedCollision(string player)
 {
     Debug.Log("FUEL AVAILABLE !!!");
     if (player == "Player1")
     {
         Tank01.setFuel(FuelUp);
         Destroy(this.gameObject);
     }
     else if (player == "Player2")
     {
         Tank02.setFuel(FuelUp);
         Destroy(this.gameObject);
     }
 }
Пример #2
0
 void RepairCollision(string player)
 {
     Debug.Log("MECHANICS WORKING !!!");
     if (player == "Player1")
     {
         Tank01.SetDamage(Repair * (-1));
         Destroy(this.gameObject);
         this.UpdateScoreboard(player);
     }
     else if (player == "Player2")
     {
         Tank02.SetDamage(Repair * (-1));
         Destroy(this.gameObject);
         this.UpdateScoreboard(player);
     }
 }
Пример #3
0
 void LandMineCollision(string player)
 {
     Debug.Log("Land Mine explodes !!!");
     if (player == "Player1")
     {
         Tank02.ScorePoints(LandMineOpponentPoints);
         Tank01.SetDamage(LandMineDamage);
         Destroy(this.gameObject);
         this.UpdateScoreboard(player);
     }
     else if (player == "Player2")
     {
         Tank01.ScorePoints(LandMineOpponentPoints);
         Tank02.SetDamage(LandMineDamage);
         Destroy(this.gameObject);
         this.UpdateScoreboard(player);
     }
 }
Пример #4
0
    void OnTriggerEnter2D(Collider2D other)
    {
        // Check if 'other' is a tagged an item
        Debug.Log("Other tag: " + other.tag);
        Debug.Log("Bullet trigger: " + this.trigger);
        if (other.tag == this.trigger)
        {
            return;
        }
        switch (other.tag.ToUpper())
        {
        case "BARRIER":

            if (GameLevel == 1)
            {
                Instantiate(brick2, other.transform.position, other.transform.rotation);
            }
            else if (GameLevel == 2)
            {
                Instantiate(rock2, other.transform.position, other.transform.rotation);
            }
            else
            {
                Instantiate(metal2, other.transform.position, other.transform.rotation);
            }


            Destroy(other.gameObject);
            Destroy(this.gameObject);
            break;

        case "BARRIER2":

            if (GameLevel == 1)
            {
                Instantiate(brick3, other.transform.position, other.transform.rotation);
            }
            else if (GameLevel == 2)
            {
                Instantiate(rock3, other.transform.position, other.transform.rotation);
            }
            else
            {
                Instantiate(metal3, other.transform.position, other.transform.rotation);
            }


            Destroy(other.gameObject);
            Destroy(this.gameObject);
            break;

        case "BARRIER3":
            Destroy(other.gameObject);
            Destroy(this.gameObject);
            break;

        case "PLAYER1":
            Tank02.ScorePoints();
            Tank01.SetDamage();
            gCont.setScoreboard(Tank02.Flag);
            Destroy(this.gameObject);
            break;

        case "PLAYER2":
            Tank01.ScorePoints();
            Tank02.SetDamage();
            gCont.setScoreboard(Tank01.Flag);
            Destroy(this.gameObject);
            break;
        }
    }