Exemple #1
0
 public bool CanEat(IEatable toEat)
 {
     if (Mass >= toEat.GetMass() * 1.5f)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Exemple #2
0
 public bool TryToEat(IEatable toEat)
 {
     if (CanEat(toEat) && Vector2.Distance(transform.position, toEat.GetTransform().position) <= ActualDisplayMass * EatRadiusMult)
     {
         toEat.OnEaten();
         Mass += toEat.GetMass();
         return true;
     }
     else
     {
         return false;
     }
 }