Beispiel #1
0
 /// <summary>
 /// Allows the game component to update itself.
 /// </summary>
 /// <param name="gameTime">Provides a snapshot of timing values.</param>
 public override void Update(GameTime gameTime)
 {
     currentMouseState = Mouse.GetState();
     if (currentMouseState.LeftButton == ButtonState.Released && pastMouseState.LeftButton == ButtonState.Pressed && quitRectanglePosition.Contains(currentMouseState.X, currentMouseState.Y))
     {
         Quit();
     }
     if (currentMouseState.LeftButton == ButtonState.Released && pastMouseState.LeftButton == ButtonState.Pressed && nextTurnRectanglePosition.Contains(currentMouseState.X, currentMouseState.Y))
     {
         int currentTurn = Turn.getCurrentTurn();
         if (currentTurn == Turn.getLastTurn())
         {
             //End Game Component
             this.Visible = false;
             //Score saved
         }
         else
         {
             Turn.setCurrentTurn(currentTurn + 1);
             Souls.endOfTurn();
             NextTurn();
         }
     }
     pastMouseState = currentMouseState;
     base.Update(gameTime);
 }
Beispiel #2
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            turnString  = Turn.getCurrentTurn().ToString();

            //setting position of string
            turnStringPosition = new Vector2(760, 26);

            //Loading textures
            turnTexture = Game.Content.Load <Texture2D>(@"sprites\turn");

            //loading Fonts
            spriteFont = Game.Content.Load <SpriteFont>(@"fonts\CourierNew");

            turnDrawableRectangle = new Rectangle(0, 0, turnTexture.Bounds.Width, turnTexture.Bounds.Height);

            //+200 is sending the whole component to the right
            turnPositionRectangle = new Rectangle(725, 0, turnTexture.Bounds.Width, turnTexture.Bounds.Height);


            base.LoadContent();
        }
Beispiel #3
0
        void endOfTurnGui_VisibleChanged(object sender, EventArgs e)
        {
            if (endOfTurnGui.Visible == false && splashScreen.Visible == false)
            {
                if (endOfTurnGui.quitSession == false && Turn.getCurrentTurn() < Turn.getLastTurn())
                {
                    //Add end turn button component
                    endTurnButton.Visible = true;
                    endTurnButton.Enabled = true;

                    //Map is made visible
                    mapComponent.Visible = true;
                    mapComponent.Enabled = true;

                    //PointSystem is visible
                    pointSystemComponent.Visible = true;
                    pointSystemComponent.Enabled = true;

                    //Selection - green square made visible
                    selectionComponent.Visible = true;
                    selectionComponent.Enabled = true;

                    //Turn Component made visible
                    turnComponent.Visible = true;
                    turnComponent.Enabled = true;


                    //Allows the zoneGui thread to run
                    zoneGui.Visible = true;
                    zoneGui.Enabled = true;

                    currencyController.Visible = true;
                    currencyController.Enabled = true;
                }

                if (endOfTurnGui.quitSession == true)
                {
                    //Add end turn button component
                    endTurnButton.Visible = false;
                    endTurnButton.Enabled = false;

                    //Map is made visible
                    mapComponent.Visible = false;
                    mapComponent.Enabled = false;

                    //PointSystem is visible
                    pointSystemComponent.Visible = false;
                    pointSystemComponent.Enabled = false;

                    //Selection - green square made visible
                    selectionComponent.Visible = false;
                    selectionComponent.Enabled = false;

                    //CurrencyController made visible
                    currencyController.Visible = false;
                    currencyController.Enabled = false;

                    //Turn Component made visible
                    turnComponent.Visible = false;
                    turnComponent.Enabled = false;

                    //Allows the zoneGui thread to run
                    zoneGui.Visible = false;
                    zoneGui.Enabled = false;

                    mapComponent.Visible = false;
                    mapComponent.Enabled = false;

                    newgame.Visible = true;
                    newgame.Enabled = true;
                }

                if (Turn.getCurrentTurn() == Turn.getLastTurn())
                {
                    Souls.endOfGame();
                    endOfTurnGui.Enabled         = false;
                    endOfTurnGui.Visible         = false;
                    mapComponent.Visible         = false;
                    resultscreen.Visible         = true;
                    pointSystemComponent.Visible = false;
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            turnString = Turn.getCurrentTurn().ToString();

            base.Update(gameTime);
        }