Example #1
0
        public async Task <Pair <FoodType, int> > Collect()
        {
            readyState = false;
            await BeginTimer();

            FoodType returnFood = AnimalTypeMethods.GetReturnFood(type);

            return(new Pair <FoodType, int>(returnFood, (int)FoodTypeMethods.GetQuantity(returnFood)));
        }
Example #2
0
 public AnimalImpl(Pair <int, int> position, AnimalType animalType) : base(position)
 {
     type       = animalType;
     SPEED      = AnimalTypeMethods.GetSpeed(type);
     readyTime  = AnimalTypeMethods.ReadyTime(type);
     rnd        = new Random();
     readyState = false;
     ReSchedule();
     SetDirectionFalse();
 }
Example #3
0
        public async Task BeginTimer()
        {
            int seconds = (int)AnimalTypeMethods.ReadyTime(type);

            while (readyState == false)
            {
                await Task.Delay(seconds * 1000);

                Ready();
            }
        }