コード例 #1
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            iBox.Update(gameTime);

            //TODO: move to a piece of code that actually gets called client-side.
            if (iWindow != null && iWindow.Visible)
            {
                //TODO: fix, doen't work at the moment
                Player player      = GameWorld.Find(Player.LocalPlayerName) as Player;
                int    dx          = (int)Math.Abs(player.Tile.Position.X - Tile.Position.X);
                int    dy          = (int)Math.Abs(player.Tile.Position.Y - Tile.Position.Y);
                bool   withinReach = dx <= Tile.TileWidth && dy <= Tile.TileHeight;

                if (!withinReach)
                {
                    iWindow.Visible = false;
                }
            }
        }