public void CheckTiredness() { if (PetTired > PetMinimalSleepFrame) { if (PetSleeping) { //do nada } else { State = new Sleeping(this); PetSleeping = true; } } else//pet has slept enough { EndSleep(); } }//end CheckTiredness
}// end method CallStateOLD public void CallStateALSOOLD() { if (PetHunger > 0) //pet has reached petNeedToEatFrame // at least once { if (PetEating) { State.Eat(); } else { State = new Eating(this); State.Eat(); } } if (PetThirst > 0) //pet has reached petNeedToDrinkFrame // at least once { if (PetDrinking) { State.Drink(); } else { State = new Drinking(this); State.Drink(); } } if (PetTired > 0) //pet has reached petNeedToDrinkFrame // at least once { if (PetSleeping) { State.Sleep(); } else { State = new Sleeping(this); State.Sleep(); } } if (PetBoredom > 0) //pet has reached petNeedToDrinkFrame // at least once { if (PetPlaying) { State.Play(); } else { State = new Playing(this); State.Play(); } } if (PetLonely > 0) //pet has reached petNeedToDrinkFrame // at least once { if (PetHugging) { State.ReceiveAffection(); } else { State = new Affectioning(this); State.ReceiveAffection(); } } }//end of callstatealsoold