Example #1
0
        private void updateMouseInput()
        {
            var ms = Game1.getMousePosition();

            if (ms.LeftButton == ButtonState.Pressed)
            {
                if (oldStateMouse.LeftButton != ButtonState.Pressed)
                {
                    if (mCurrentSelectableCharacter != null)
                    {
                        if (mCurrentSelectableCharacter == mSelectableCharacterRed)
                        {
                            ObjectSerialization.Save <ProgressObject>(Game1.sPROGRESS_FILE_NAME, Game1.progressObject.setColor(ProgressObject.PlayerColor.RED));
                        }
                        else
                        if (mCurrentSelectableCharacter == mSelectableCharacterGreen)
                        {
                            ObjectSerialization.Save <ProgressObject>(Game1.sPROGRESS_FILE_NAME, Game1.progressObject.setColor(ProgressObject.PlayerColor.GREEN));
                        }
                        else
                        if (mCurrentSelectableCharacter == mSelectableCharacterBlue)
                        {
                            ObjectSerialization.Save <ProgressObject>(Game1.sPROGRESS_FILE_NAME, Game1.progressObject.setColor(ProgressObject.PlayerColor.BLUE));
                        }

                        mCurrentSelectableCharacter.changeState(SelectableCharacter.sSTATE_SELECTED);
                        mReduceAlpha = true;

                        mTimerAfterSelection = new MTimer(true);
                    }
                }
            }

            oldStateMouse = ms;
        }
Example #2
0
        private void checkCollisions()
        {
            if (mSelectableCharacterRed.getState() != SelectableCharacter.sSTATE_SELECTED && mSelectableCharacterRed.getState() != SelectableCharacter.sSTATE_EXPLOSION &&
                mSelectableCharacterGreen.getState() != SelectableCharacter.sSTATE_SELECTED && mSelectableCharacterGreen.getState() != SelectableCharacter.sSTATE_EXPLOSION &&
                mSelectableCharacterBlue.getState() != SelectableCharacter.sSTATE_SELECTED && mSelectableCharacterBlue.getState() != SelectableCharacter.sSTATE_EXPLOSION)
            {
                mCurrentSelectableCharacter = null;
                if (mCursor.collidesWith(mRect1))
                {
                    //SoundManager.PlaySound(cSOUND_SELECT);

                    mCurrentSelectableCharacter = mSelectableCharacterRed;

                    mSelectableCharacterGreen.changeState(SelectableCharacter.sSTATE_UNSELECTED);
                    mSelectableCharacterBlue.changeState(SelectableCharacter.sSTATE_UNSELECTED);
                }
                else
                {
                    mSelectableCharacterRed.changeState(SelectableCharacter.sSTATE_UNSELECTED);

                    if (mCursor.collidesWith(mRect2))
                    {
                        //SoundManager.PlaySound(cSOUND_SELECT);

                        mCurrentSelectableCharacter = mSelectableCharacterGreen;

                        mSelectableCharacterRed.changeState(SelectableCharacter.sSTATE_UNSELECTED);
                        mSelectableCharacterBlue.changeState(SelectableCharacter.sSTATE_UNSELECTED);
                    }
                    else
                    {
                        mSelectableCharacterGreen.changeState(SelectableCharacter.sSTATE_UNSELECTED);

                        if (mCursor.collidesWith(mRect3))
                        {
                            //SoundManager.PlaySound(cSOUND_SELECT);
                            mCurrentSelectableCharacter = mSelectableCharacterBlue;

                            mSelectableCharacterRed.changeState(SelectableCharacter.sSTATE_UNSELECTED);
                            mSelectableCharacterGreen.changeState(SelectableCharacter.sSTATE_UNSELECTED);
                        }
                        else
                        {
                            mSelectableCharacterBlue.changeState(SelectableCharacter.sSTATE_UNSELECTED);
                        }
                    }
                }

                if (mCurrentSelectableCharacter != null && mCurrentSelectableCharacter.getState() == SelectableCharacter.sSTATE_UNSELECTED)
                {
                    mCurrentSelectableCharacter.changeState(SelectableCharacter.sSTATE_HIGHLIGHTED);
                }
                else
                {
                }
            }
        }