CellsAutomate.Food.FoodMatrix.TakeFood C# (CSharp) Method

TakeFood() public method

public TakeFood ( Point currentPoint ) : bool
currentPoint System.Drawing.Point
return bool
        public bool TakeFood(Point currentPoint)
        {
            if (!HasOneBite(currentPoint))
                return false;
            _matrix[currentPoint.X, currentPoint.Y] -= CreatureConstants.OneBite;
            return true;
        }

Usage Example

Exemplo n.º 1
0
 public void Eat(FoodMatrix eatMatrix)
 {
     if (eatMatrix.TakeFood(Position))
     {
         _energyPoints += CreatureConstants.OneBite;
     }
 }