Esempio n. 1
0
 public void CheckThirst()
 {
     if (PetCurrentWater > 0)
     {
         //instead of checking if PetThirst > 0
         //it doesn't have to go down to zero
         //that would take too long
         if (PetThirst > PetParchedFrame)
         //if (PetThirst > 0)
         {
             if (PetDrinking)
             {
                 //do nada
             }
             else
             {
                 State       = new Drinking(this);
                 PetDrinking = true;
             }
         }
         else //pet has drank enough
         {
             EndDrink();
             //petDrinking = false;
             //State = new Neutral(this);
         }
     }
     else // there is no more water to drink
     {
         EndDrink();
         //petDrinking = false;
         //State = new Neutral(this);
     }
 }//end CheckThirst
Esempio n. 2
0
        }// 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