Example #1
0
        public void Update(GameTime gameTime)
        {
            MouseState curMouseState = Mouse.GetState();

            for (int i = 0; i < mControls.Count; i++)
            {
                mControls[i].Update(gameTime);
            }

            if (!mBuildMode)
            {
                for (int i = 0; i < mControls.Count; i++)
                {
                    if (mControls[i] == mCursor)
                    {
                        mCursor.Visible  = true;
                        mCursor.Position = new Vector2(curMouseState.X, curMouseState.Y);
                    }
                }
            }
            else
            {
                for (int i = 0; i < mControls.Count; i++)
                {
                    if (mControls[i].IsActive == true)
                    {
                        for (int j = 0; j < mControls.Count; j++)
                        {
                            if (mControls[j] == mCursor)
                            {
                                mCursor.Visible  = true;
                                mCursor.Position = new Vector2(curMouseState.X, curMouseState.Y);
                            }
                        }
                        mBuilder.Deactivate();
                        break;
                    }
                    else
                    {
                        for (int j = 0; j < mControls.Count; j++)
                        {
                            if (mControls[j] == mCursor)
                            {
                                mCursor.Visible = false;
                            }
                        }
                        if (mBuildMode == true)
                        {
                            mBuilder.Activate();
                        }
                    }
                }
            }
        }