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


            if (Helpers.InputHelper.IsKeyPressed(Microsoft.Xna.Framework.Input.Keys.Space))
            {
                _SM.ActivateScene("Mega");
                return;
            }
            Tile hoveredTile = _MapManager.findTile(InputHelper.MouseScreenPos);

            if (InputHelper.IsKeyPressed(Keys.D1))
            {
                TileOne = hoveredTile;
                if (TileOne != null && TileTwo != null)
                {
                    _MapManager.ResetTileColors();
                    path = _MapManager.AStarTwo(TileOne, TileTwo, diagonalPaths);
                }
            }

            if (InputHelper.IsKeyPressed(Keys.D2))
            {
                TileTwo = hoveredTile;
                if (TileOne != null && TileTwo != null)
                {
                    _MapManager.ResetTileColors();
                    path = _MapManager.AStarTwo(TileOne, TileTwo, diagonalPaths);
                }
            }

            if (InputHelper.IsKeyPressed(Keys.T))
            {
                diagonalPaths = !diagonalPaths;

                if (TileOne != null && TileTwo != null)
                {
                    _MapManager.ResetTileColors();
                    path = _MapManager.AStarTwo(TileOne, TileTwo, diagonalPaths);
                }
            }

            if (InputHelper.IsKeyPressed(Keys.O))
            {
                TileOne = null;
                TileTwo = null;
                path    = null;
            }
        }