コード例 #1
0
        public static void InterceptIncubatorEggs()
        {
            if (!Game1.IsMasterGame)
            {
                return;
            }

            foreach (GameLocation location in Game1.locations)
            {
                if (location is BuildableGameLocation buildableGameLocation)
                {
                    foreach (Building building in buildableGameLocation.buildings)
                    {
                        if (building is Coop coop)
                        {
                            AnimalHouse animalHouse = coop.indoors.Value as AnimalHouse;

                            // Seems that this is dead legacy code, we still keep it to support either way of hatching, in case future game code changes back to this.
                            if (animalHouse.incubatingEgg.Y == EasterEggItem.PARENT_SHEET_INDEX && animalHouse.incubatingEgg.X == 1)
                            {
                                animalHouse.incubatingEgg.X = 0;
                                animalHouse.incubatingEgg.Y = -1;
                                animalHouse.map.GetLayer("Front").Tiles[1, 2].TileIndex = 45;
                                long newId = Game1MultiplayerAccessProvider.GetMultiplayer().getNewID();
                                animalHouse.animals.Add(newId, new FarmAnimal("Rabbit", newId, coop.owner));
                            }
                        }
                    }
                }
            }
        }
コード例 #2
0
        private static void AddNewHatchedRabbit(Farmer who, AnimalHouse animalHouse, string animalName)
        {
            long animalId = Game1MultiplayerAccessProvider.GetMultiplayer().getNewID();

            FarmAnimal farmAnimal = new FarmAnimal("Rabbit", animalId, who.uniqueMultiplayerID);

            farmAnimal.Name        = animalName;
            farmAnimal.displayName = animalName;

            Building building = animalHouse.getBuilding();

            farmAnimal.home = building;
            farmAnimal.homeLocation.Value = new Vector2(building.tileX, building.tileY);
            farmAnimal.setRandomPosition(animalHouse);

            animalHouse.animals.Add(animalId, farmAnimal);
            animalHouse.animalsThatLiveHere.Add(animalId);

            Game1.exitActiveMenu();
        }
コード例 #3
0
        private void DoDeath(GameLocation location, Vector2 tileLocation)
        {
            DelayedAction.playSoundAfterDelay("leafrustle", 100, (GameLocation)null);
            Color  color         = Color.Green;
            string currentSeason = Game1.currentSeason;

            if (!(currentSeason == "spring"))
            {
                if (!(currentSeason == "summer"))
                {
                    if (!(currentSeason == "fall"))
                    {
                        if (currentSeason == "winter")
                        {
                            color = Color.Cyan;
                        }
                    }
                    else
                    {
                        color = Color.IndianRed;
                    }
                }
                else
                {
                    color = Color.ForestGreen;
                }
            }
            else
            {
                color = Color.Green;
            }
            for (int index1 = 0; index1 <= this.size; ++index1)
            {
                for (int index2 = 0; index2 < 12; ++index2)
                {
                    Game1MultiplayerAccessProvider.GetMultiplayer().broadcastSprites(location, new TemporaryAnimatedSprite[1]
                    {
                        new TemporaryAnimatedSprite("LooseSprites\\Cursors", new Rectangle(355, 1200 + (Game1.IsFall ? 16 : (Game1.IsWinter ? -16 : 0)), 16, 16), Utility.getRandomPositionInThisRectangle(this.getBoundingBox(), Game1.random) - new Vector2(0.0f, (float)Game1.random.Next(64)), false, 0.01f, Game1.IsWinter ? Color.Cyan : Color.White)
                        {
                            motion             = new Vector2((float)Game1.random.Next(-10, 11) / 10f, (float)-Game1.random.Next(5, 7)),
                            acceleration       = new Vector2(0.0f, (float)Game1.random.Next(13, 17) / 100f),
                            accelerationChange = new Vector2(0.0f, -1f / 1000f),
                            scale                     = 4f,
                            layerDepth                = (float)((double)tileLocation.Y * 64.0 / 10000.0),
                            animationLength           = 11,
                            totalNumberOfLoops        = 99,
                            interval                  = (float)Game1.random.Next(20, 90),
                            delayBeforeAnimationStart = (index1 + 1) * index2 * 20
                        }
                    });
                    if (index2 % 6 == 0)
                    {
                        Game1MultiplayerAccessProvider.GetMultiplayer().broadcastSprites(location, new TemporaryAnimatedSprite[1]
                        {
                            new TemporaryAnimatedSprite(50, Utility.getRandomPositionInThisRectangle(this.getBoundingBox(), Game1.random) - new Vector2(32f, (float)Game1.random.Next(32, 64)), color, 8, false, 100f, 0, -1, -1f, -1, 0)
                        });
                        Game1MultiplayerAccessProvider.GetMultiplayer().broadcastSprites(location, new TemporaryAnimatedSprite[1]
                        {
                            new TemporaryAnimatedSprite(12, Utility.getRandomPositionInThisRectangle(this.getBoundingBox(), Game1.random) - new Vector2(32f, (float)Game1.random.Next(32, 64)), Color.White, 8, false, 100f, 0, -1, -1f, -1, 0)
                        });
                    }
                }
            }
        }