コード例 #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;
     }
 }