예제 #1
0
파일: TankGame.cs 프로젝트: Stran6/TankGame
        protected override void Initialize()
        {
            this.Window.Title = "Tank Diggity";

            uiManager = new UIManager(this);
            Components.Add(uiManager);

            screenManager = new ScreenManager(this);
            Components.Add(screenManager);

            soundManager = new SoundManager(this);
            Components.Add(soundManager);
            
            tankPos = new Vector2(60, 785);
            turretPos = new Vector2(tankPos.X + 45, tankPos.Y + 25);
            player1Tank = new Tank(this, tankPos,(float)Math.PI / 2);
            Components.Add(player1Tank);

            tankPos2 = new Vector2(2048 - 140, 785);
            turretPos2 = new Vector2(tankPos2.X + 45, tankPos.Y + 10);
            player2Tank = new Tank(this, tankPos2,-(float)Math.PI / 2);
            Components.Add(player2Tank);

            currentTank = player1Tank;

            camera = new Camera2d(graphics.GraphicsDevice);

            background = new Background(this);
            Components.Add(background);          

            powerUpManager = new PowerUpManager(this);
            Components.Add(powerUpManager);

            power = 0;

            chargingShot = false;
            chargingShot2 = false;
            shotFired = false;
            shotCollided = false;
            turnOver = false;
            gameRunning = false;
            rightSwap = false;
            leftSwap = false;
            debugGame = false;

            controller = GamePad.GetState(PlayerIndex.One);

            base.Initialize();
        }
예제 #2
0
        public void SetData(ScreenManager.GameState GameState)
        {

            switch (GameState)
            {
                case ScreenManager.GameState.MOVEHINT:
                    textToDraw = "";
                    onStartScreen = false;     
                    break;

                case ScreenManager.GameState.POWERUPHINT:
                    textToDraw = "";
                    break;

                case ScreenManager.GameState.START:
                    textToDraw = "Press ENTER or (A) to begin\nPress Z to enter Debug";
                    onStartScreen = true;
                    break;

                case ScreenManager.GameState.PLAYER1:
                    textToDraw = "Player 1 press ENTER or (A) to begin";
                    onStartScreen = false;
                    break;

                case ScreenManager.GameState.PLAYER2:
                    textToDraw = "Player 2 press ENTER or (A) to begin";
                    onStartScreen = false;

                    break;

                case ScreenManager.GameState.END:
                    textToDraw = "";

                    break;
            }
        }