示例#1
0
        public override void Update(GameTime gameTime, int x, int y, int variation, int orientation)
        {
            // try move upwards
            Tile above = Framing.GetTileSafely(x, y - 1);

            if (above != null && above.liquid > 0)
            {
                CoverData data = CoveringsManager.GetData(x, y);
                CoveringsManager.RemoveAt(x, y);
                CoveringsManager.SetData(x, y - 1, data);

                // update that tile
                Update(gameTime, x, y - 1, variation, orientation);
                return; // return quick
            }

            // try move downwards if our current tile is empty
            Tile tile = Framing.GetTileSafely(x, y);

            if (tile.liquid == 0)
            {
                CoverData data = CoveringsManager.GetData(x, y);
                // because IsValidAt(x,y) returned true, we know the tile below has liquid in it
                // so just move this covering to that tile
                CoveringsManager.RemoveAt(x, y);
                CoveringsManager.SetData(x, y + 1, data);

                // update that tile
                Update(gameTime, x, y + 1, variation, orientation);
                return; // return quick
            }

            base.Update(gameTime, x, y, variation, orientation);
        }
示例#2
0
        public override void Update(GameTime gameTime, int x, int y, int variation, int orientation)
        {
            Tile tile       = Framing.GetTileSafely(x, y);
            bool isSnowTile = TileID.Sets.IcesSnow[tile.type];

            // if we're not in the tundra and this block isn't a snow tile of any kind, randomly remove
            if (!isSnowTile && !Main.LocalPlayer.ZoneSnow && Main.rand.Next(300) == 0)
            {
                int alpha = GetAlphaFromVariation(variation);

                // if our new alpha is going to be -1, remove this covering
                if (alpha == 0)
                {
                    CoveringsManager.RemoveAt(x, y);
                    return;
                }

                int newVariation = ChangeAlphaOnVariation(variation, -1);
                CoveringsManager.SetVariation(x, y, newVariation);
            }
        }