SpawnStartUnits() 공개 메소드

Spawns the starting units of this player.
public SpawnStartUnits ( ) : void
리턴 void
예제 #1
0
        /// <summary>
        /// Should be called when the map is finished with loading.
        /// </summary>
        public void FinishedLoadingMap()
        {
            Game1 game = Game1.GetInstance();
            if (game.IsMultiplayerGame())
            {
                // Do nothing, used to be something here
            }
            else
            {
                Alliance redAlliance = new Alliance();
                Player humanPlayer = new Player(redAlliance, Color.Blue, this.tempPlayerLocations[0]);
                Game1.CURRENT_PLAYER = humanPlayer;
                humanPlayer.SpawnStartUnits();

                Alliance greenAlliance = new Alliance();
                Player aiPlayer = new Player(greenAlliance, Color.Purple,
                    new Point((int)Game1.GetInstance().graphics.PreferredBackBufferWidth / 2, 200));
                aiPlayer.SpawnStartUnits();

                StateManager.GetInstance().gameState = StateManager.State.GameRunning;
                //SaveManager.GetInstance().SaveNodes("C:\\Users\\Wouter\\Desktop\\test.xml");
            }

            game.map.miniMap = new MiniMap(game.map);
            game.map.miniMap.CreateMiniMap(true);

            game.drawOffset = new Vector2(Game1.CURRENT_PLAYER.startLocation.X - ( game.graphics.PreferredBackBufferWidth / 2 ),
                Game1.CURRENT_PLAYER.startLocation.Y - ( game.graphics.PreferredBackBufferHeight / 2 ));

            MouseManager.GetInstance().mouseClickedListeners += ((MouseClickListener)game).OnMouseClick;
            MouseManager.GetInstance().mouseReleasedListeners += ((MouseClickListener)game).OnMouseRelease;
            MouseManager.GetInstance().mouseMotionListeners += ((MouseMotionListener)game).OnMouseMotion;
            MouseManager.GetInstance().mouseDragListeners += ((MouseMotionListener)game).OnMouseDrag;
        }
예제 #2
0
파일: Game1.cs 프로젝트: Cur10s1ty/RTS_XNA
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            drawLineTexture = this.Content.Load<Texture2D>("Misc/solid");
            font = Content.Load<SpriteFont>("Fonts/Arial");
            (collision = new RTSCollisionMap(this, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight)).PlaceNodesAroundEdges();
            graphics.PreferMultiSampling = true;

            (quadTree = new QuadRoot(new Rectangle(0, 0,
                graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight)
                )).CreateTree(5);

            players = new LinkedList<Player>();

            Alliance redAlliance = new Alliance();
            Player humanPlayer = new Player(redAlliance, Color.Red);
            players.AddLast((CURRENT_PLAYER = humanPlayer));
            humanPlayer.SpawnStartUnits(new Point((int)Game1.GetInstance().graphics.PreferredBackBufferWidth / 2,
                (int)Game1.GetInstance().graphics.PreferredBackBufferWidth / 2));

            Alliance greenAlliance = new Alliance();
            Player aiPlayer = new Player(greenAlliance, Color.Green);
            players.AddLast(aiPlayer);
            aiPlayer.SpawnStartUnits(new Point((int)Game1.GetInstance().graphics.PreferredBackBufferWidth / 2, 200));

            //SaveManager.GetInstance().SaveNodes("C:\\Users\\Wouter\\Desktop\\test.xml");
            MouseManager.GetInstance().mouseClickedListeners += ((MouseClickListener)this).OnMouseClick;
            MouseManager.GetInstance().mouseReleasedListeners += ((MouseClickListener)this).OnMouseRelease;
            MouseManager.GetInstance().mouseMotionListeners += ((MouseMotionListener)this).OnMouseMotion;
            MouseManager.GetInstance().mouseDragListeners += ((MouseMotionListener)this).OnMouseDrag;

            /*XNAPanel panel = new XNAPanel(null, new Rectangle(
                this.graphics.PreferredBackBufferWidth / 2 - 200,
                this.graphics.PreferredBackBufferHeight / 2 - 200,
                400, 400));
            XNAButton button = new XNAButton(panel, new Rectangle(10, 10, 100, 40), "");*/

            base.Initialize();
        }