Exemplo n.º 1
0
 void OnCollisionEnter(Collision other)
 {
     if (other.gameObject.name == "BallOfFire(Clone)")   // checks if the tree gets hit be lars's ball
     {
         BossHP -= BallOfFire.GetBallDmg();              // if the tree gets hit it will lose HP arcording to how close lars is to the tree
     }
 }
    void OnCollisionEnter(Collision other)
    {
        if (other.gameObject.name == "BallOfFire(Clone)")
        {
            GetHit(BallOfFire.GetBallDmg());                    // When the Ball of Fire hits an apple it will get hit with the ball's damage
            print(AppleGREEN.GetHP() + " " + AppleRed.GetHP() + " " + AppleYELLOW.GetHP() + " " + Lars.GetHeroHP());
        }

        if (other.gameObject.name == "Lars")
        {
            for (float i = 0f; i < 5f; i += 0.1f)               //making the Apple jump y=5 up sort of slowly when touched by lars, giving him time to get away
            {
                transform.position += new Vector3(0, i, 0) * Time.deltaTime;
            }
        }
    }