Exemplo n.º 1
0
 /// <summary>
 /// Checks if we hit herbivore during charge
 /// </summary>
 /// <param name="herb"></param>
 private void HitCheck(Character herb)
 {
     if (herb.GetType() == typeof(Herbivore) && charging)
     {
         Herbivore vor = herb as Herbivore;
         Debug.Log("charge");
         if ((momentumTimer / chargeTime) >= 0.4f)
         {
             Debug.Log("Kill herbivore");
             //Kill target
             vor.GetEaten(damage * 2);
             EatHerbivore(0.5f, vor.Health);
         }
         else
         {
             Debug.Log("Hurt herbivore");
             //1 damage
             vor.GetEaten(damage);
         }
         hitTarget = true;
     }
     else if (collided && charging)
     {
         Debug.Log("osu");
         hitTarget = true;
         //Stun for 1.5s
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Damages the herbivore if player presses the eat button
 /// </summary>
 /// <param name="col"></param>
 private void Eat(Character col)
 {
     if (InputManager.Instance.GetButton("Eat"))
     {
         Herbivore vor = col as Herbivore;
         Debug.Log("mums, mums....");
         EatHerbivore(slowDown, vor.Health);
         vor.GetEaten(damage);
     }
 }
Exemplo n.º 3
0
    public float EatAnimal()
    {
        if (grazers.Count == 0)
        {
            return(0.0f);
        }

        int       index = Random.Range(0, grazers.Count);
        Herbivore meal  = grazers[index];
        float     meat  = meal.GetEaten();

        grazers.RemoveAt(index);
        return(meat);
    }