コード例 #1
0
 public Stage GetPetStage(int stageId)
 {
     using (var db = new SQLite.SQLiteConnection(Constants.DbPath))
        {
        Stage stage = new Stage();
        try
        {
            stage = (db.Table<Stage>().Where(
                        s => s.StageId == stageId)).SingleOrDefault();
        }
        catch
        {
            stage = null;
        }
        return stage;
        }
 }
コード例 #2
0
 internal Stage GetPetNewStage(int age)
 {
     using (var db = new SQLite.SQLiteConnection(Constants.DbPath))
      {
      Stage stage = new Stage();
      try
      {
          stage = (db.Table<Stage>().Where(
                      s => s.AgeFrom >= age && s.AgeTo <= age)).SingleOrDefault();
      }
      catch
      {
          stage = null;
      }
      return stage;
      }
 }
コード例 #3
0
 private static int CalculateMood(Pet pet, Stage petStage)
 {
     return pet.Mood > 0 ? (GetMinutesFromLastUpdated(pet.LastUpdated) - petStage.MoodInterval) * petStage.MoodCoeff : 0;
 }
コード例 #4
0
 private static int CalculateHygene(Pet pet, Stage petStage)
 {
     return pet.Hygene > 0 ? (GetMinutesFromLastUpdated(pet.LastUpdated) - petStage.HygeneInterval) * petStage.HygeneCoeff : 0;
 }
コード例 #5
0
 private static int CalculateHunger(Pet pet, Stage petStage)
 {
     return pet.Hunger > 0 ? (GetMinutesFromLastUpdated(pet.LastUpdated) - petStage.HungerInterval) * petStage.HungerCoeff : 0;
 }
コード例 #6
0
 private static int CalculateHealth(Pet pet, Stage petStage)
 {
     return pet.Health > 0 ? (GetMinutesFromLastUpdated(pet.LastUpdated) - petStage.HealthInterval) * petStage.HealthCoeff : 0;
 }
コード例 #7
0
 private static int CalculateEnergy(Pet pet, Stage petStage)
 {
     return pet.Energy > 0 ? (GetMinutesFromLastUpdated(pet.LastUpdated) - petStage.EnergyInterval) * petStage.EnergyCoeff : 0;
 }