示例#1
0
文件: Player.cs 项目: Xyag/ugar.io
 public bool CanEat(IEatable toEat)
 {
     if (Mass >= toEat.GetMass() * 1.5f)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
示例#2
0
文件: Player.cs 项目: Xyag/ugar.io
 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;
     }
 }