コード例 #1
0
        public override bool placementAction(GameLocation location, int x, int y, Farmer who)
        {
            Vector2 placementTile = new Vector2(x / 64, y / 64);
            Torch   toPlace       = bigCraftable ? new Torch(placementTile, parentSheetIndex, bigCraftable: true) : new Torch(placementTile, 1, parentSheetIndex);

            if ((bool)bigCraftable)
            {
                toPlace.isOn.Value = false;
            }
            toPlace.tileLocation.Value = placementTile;
            toPlace.initializeLightSource(placementTile);
            location.objects.Add(placementTile, toPlace);
            if (who != null)
            {
                Game1.playSound("woodyStep");
            }
            return(true);
        }
コード例 #2
0
ファイル: Torch.cs プロジェクト: avere001/sprinklers
        public override bool placementAction(GameLocation location, int x, int y, Farmer who)
        {
            Vector2 vector = new Vector2((float)(x / Game1.tileSize), (float)(y / Game1.tileSize));
            Torch   torch  = this.bigCraftable ? new Torch(vector, this.parentSheetIndex, true) : new Torch(vector, 1, this.parentSheetIndex);

            if (this.bigCraftable)
            {
                torch.isOn = false;
            }
            torch.tileLocation = vector;
            torch.initializeLightSource(vector);
            location.objects.Add(vector, torch);
            if (who != null)
            {
                Game1.playSound("woodyStep");
            }
            return(true);
        }