Esempio n. 1
0
 private void GameLoop_TimeChanged(object sender, StardewModdingAPI.Events.TimeChangedEventArgs e)
 {
     if (Config.EnableMod && Config.EnableAnimalTalk && speakingAnimals is null && (Game1.currentLocation is Farm || Game1.currentLocation is AnimalHouse || Game1.currentLocation is Forest))
     {
         FarmAnimal[] animals;
         if (Game1.currentLocation is AnimalHouse)
         {
             animals = (Game1.currentLocation as AnimalHouse).animals.Values.ToArray();
         }
         else if (Game1.currentLocation is Farm)
         {
             animals = (Game1.currentLocation as Farm).animals.Values.ToArray();
         }
         else if (Game1.currentLocation is Forest)
         {
             animals = (Game1.currentLocation as Forest).marniesLivestock.ToArray();
         }
         else
         {
             return;
         }
         foreach (var a in animals)
         {
             foreach (var b in animals)
             {
                 if (a.myID.Value == b.myID.Value)
                 {
                     continue;
                 }
                 if (Vector2.Distance(a.getTileLocation(), b.getTileLocation()) <= 10 && Game1.random.NextDouble() < 0.3)
                 {
                     speakingAnimals = new SpeakingAnimalData(a, b);
                     return;
                 }
             }
         }
     }
 }
Esempio n. 2
0
 private void Player_Warped(object sender, StardewModdingAPI.Events.WarpedEventArgs e)
 {
     speakingAnimals = null;
 }