示例#1
0
 public void HasEaten(string plant)
 {
     IsEaten = true;
     Console.ForegroundColor = ConsoleColor.Green;
     EatPlant?.Invoke($"{plant} has been eaten by {KindOfHerbivore}");
     Console.ResetColor();
 }
示例#2
0
        public void Eating(string plant)
        {
            int n = Program.random.Next(1, 6);

            for (int i = 0; i < n; i++)
            {
                EatPlant?.Invoke($"{KindOfHerbivore} is eating {plant}");
                Thread.Sleep(1000);
            }
        }