Пример #1
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
                {
                }
            }
        }
Пример #2
0
        public SelectionScreen()
        {
            if (!SoundManager.isPlaying())
            {
                SoundManager.PlayMusic("sound\\music\\theme");
            }
            else
            {
                SoundManager.StopMusic();
                SoundManager.PlayMusic("sound\\music\\theme");
            }

            mSpriteBatch = Game1.getInstance().getScreenManager().getSpriteBatch();

            mBackgroundImage = new Background("gameplay\\selection\\Nuvens_pos");
            mBackgroundImage.loadContent(Game1.getInstance().getScreenManager().getContent());

            mList.Add(mBackgroundImage);

            mCurrentBackground = mList.ElementAt(0);

            mCursor = new Cursor();
            mCursor.loadContent(Game1.getInstance().getScreenManager().getContent());

            //mTextureChooseTitle = Game1.getInstance().getScreenManager().getContent().Load<Texture2D>("gameplay\\selection\\hero_screen");
            mTextureChooseTitle = Game1.getInstance().getScreenManager().getContent().Load <Texture2D>("gameplay\\selection\\chooseheropt");

            mTextureRedNameUnselected   = Game1.getInstance().getScreenManager().getContent().Load <Texture2D>("gameplay\\selection\\RedName_unselected");
            mTextureRedNameSelected     = Game1.getInstance().getScreenManager().getContent().Load <Texture2D>("gameplay\\selection\\Redname");
            mTextureGreenNameUnselected = Game1.getInstance().getScreenManager().getContent().Load <Texture2D>("gameplay\\selection\\GreenName_unselected");
            mTextureGreenNameSelected   = Game1.getInstance().getScreenManager().getContent().Load <Texture2D>("gameplay\\selection\\GreenName");
            mTextureBlueNameUnselected  = Game1.getInstance().getScreenManager().getContent().Load <Texture2D>("gameplay\\selection\\BlueName_unselected");
            mTextureBlueNameSelected    = Game1.getInstance().getScreenManager().getContent().Load <Texture2D>("gameplay\\selection\\Bluename");


            mRect1 = new Rectangle(102, 223, 150, 155);
            mRect2 = new Rectangle(327, 223, 150, 155);
            mRect3 = new Rectangle(565, 223, 150, 155);

            //Game1.print("LOC: "  + mGroupButtons.getGameObject(2).getLocation());

            mSelectableCharacterRed = new SelectableCharacter(new Vector2(160, 310), Color.Red);
            mSelectableCharacterRed.loadContent(Game1.getInstance().getScreenManager().getContent());

            mSelectableCharacterGreen = new SelectableCharacter(new Vector2(382 + 15, 310 + 6), Color.Green);
            mSelectableCharacterGreen.loadContent(Game1.getInstance().getScreenManager().getContent());

            mSelectableCharacterBlue = new SelectableCharacter(new Vector2(625 - 5, 308 + 6), Color.Blue);
            mSelectableCharacterBlue.loadContent(Game1.getInstance().getScreenManager().getContent());

            mFade = new Fade(this, "fades\\blackfade", Fade.SPEED.FAST);
            executeFade(mFade, Fade.sFADE_IN_EFFECT_GRADATIVE);
        }