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))); }
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(); }
public async Task BeginTimer() { int seconds = (int)AnimalTypeMethods.ReadyTime(type); while (readyState == false) { await Task.Delay(seconds * 1000); Ready(); } }