示例#1
0
        private void checkCollisions()
        {
            if (mGroupButtons.checkCollisionWith(mCursor))
            {
                mCurrentHighlightButton = (Button)mGroupButtons.getCollidedObject();

                if (mMousePressing)
                {
                    if (mCurrentHighlightButton.getState() != Button.sSTATE_PRESSED)
                    {
                        mCurrentHighlightButton.changeState(Button.sSTATE_PRESSED);
                    }
                }
                else
                {
                    if (mCurrentHighlightButton.getState() != Button.sSTATE_HIGHLIGH)
                    {
                        mCurrentHighlightButton.changeState(Button.sSTATE_HIGHLIGH);
                    }
                }
            }
            else
            {
                if (mCurrentHighlightButton != null)// && mCurrentHighlightButton.getState() != Button.sSTATE_PRESSED)
                {
                    mCurrentHighlightButton.changeState(Button.sSTATE_NORMAL);
                }
                mCurrentHighlightButton = null;
            }
        }
示例#2
0
        private void checkCollisions()
        {
            if (mCursor.collidesWith(mSoundIcon) && !mCollidingWithSomeButton)
            {
                if (mSoundIcon.getState() == SoundIcon.sSTATE_NORMAL)
                {
                    mSoundIcon.changeState(SoundIcon.sSTATE_SHAKING);
                }

                mCollidingMouseWithSoundIcon = true;
            }
            else
            {
                if (mSoundIcon.getState() == SoundIcon.sSTATE_SHAKING)
                {
                    mSoundIcon.changeState(SoundIcon.sSTATE_NORMAL);
                }
                mCollidingMouseWithSoundIcon = false;
            }

            if (mGroupButtons.checkCollisionWith(mCursor))
            {
                mCurrentHighlightButton = (Button)mGroupButtons.getCollidedObject();

                solveHighlightBug();

                if (mMousePressing)
                {
                    if (mCurrentHighlightButton.getState() != Button.sSTATE_PRESSED)
                    {
                        mCurrentHighlightButton.changeState(Button.sSTATE_PRESSED);
                    }
                }
                else
                {
                    if (mCurrentHighlightButton.getState() != Button.sSTATE_HIGHLIGH)
                    {
                        mCurrentHighlightButton.changeState(Button.sSTATE_HIGHLIGH);
                    }
                }

                mCollidingWithSomeButton = true;
            }
            else
            {
                mCollidingWithSomeButton = false;

                if (mCurrentHighlightButton != null)// && mCurrentHighlightButton.getState() != Button.sSTATE_PRESSED)
                {
                    mCurrentHighlightButton.changeState(Button.sSTATE_NORMAL);
                }
                mCurrentHighlightButton = null;
            }
        }
示例#3
0
        //the hud is an exception. THe checkcollision method must be called by GamePlayScreen class.
        public void checkCollisions(Cursor cursor, bool mousePressing)
        {
            if (mGroupButtons.checkCollisionWith(cursor))
            {
                mCurrentHighlightButton = (Button)mGroupButtons.getCollidedObject();

                //Game1.print(" XOE");

                /* if (mCurrentHighlightButton == mButtonRed)
                 * {
                 *   if (cursor.getColor() != Color.Red)
                 *   {
                 *       cursor.changeColor(Color.Red);
                 *       //play sound
                 *   }
                 * }
                 * else
                 *   if (mCurrentHighlightButton == mButtonGreen)
                 *   {
                 *       if (cursor.getColor() != Color.Green)
                 *       {
                 *           cursor.changeColor(Color.Green);
                 *       }
                 *   }
                 *   else
                 *       if (mCurrentHighlightButton == mButtonBlue)
                 *       {
                 *           if (cursor.getColor() != Color.Blue)
                 *           {
                 *               cursor.changeColor(Color.Blue);
                 *           }
                 *       }*/

                if (mousePressing)
                {
                    if (mCurrentHighlightButton == mButtonRed)
                    {
                        if (cursor.getColor() != Color.Red)
                        {
                            cursor.changeColor(Color.Red);
                            SoundManager.PlaySound(cSOUND_COLOR);
                        }
                    }
                    else
                    if (mCurrentHighlightButton == mButtonGreen)
                    {
                        if (cursor.getColor() != Color.Green)
                        {
                            cursor.changeColor(Color.Green);
                            SoundManager.PlaySound(cSOUND_COLOR);
                        }
                    }
                    else
                    if (mCurrentHighlightButton == mButtonBlue)
                    {
                        if (cursor.getColor() != Color.Blue)
                        {
                            cursor.changeColor(Color.Blue);
                            SoundManager.PlaySound(cSOUND_COLOR);
                        }
                    }
                    else
                    if (mCurrentHighlightButton == mButtonPause)
                    {
                    }
                }
            }


            //if (mGroupButtons.checkCollisionWith(mCursor))
            //{
            //    mCurrentHighlightButton = (Button)mGroupButtons.getCollidedObject();

            //    if (mMousePressing)
            //    {
            //        if (mCurrentHighlightButton.getState() != Button.sSTATE_PRESSED)
            //        {
            //            mCurrentHighlightButton.changeState(Button.sSTATE_PRESSED);
            //        }
            //    }
            //    else
            //    {

            //        if (mCurrentHighlightButton.getState() != Button.sSTATE_HIGHLIGH)
            //        {
            //            mCurrentHighlightButton.changeState(Button.sSTATE_HIGHLIGH);
            //        }

            //    }

            //}
            //else
            //{
            //    if (mCurrentHighlightButton != null)// && mCurrentHighlightButton.getState() != Button.sSTATE_PRESSED)
            //    {
            //        mCurrentHighlightButton.changeState(Button.sSTATE_NORMAL);
            //    }
            //    mCurrentHighlightButton = null;
            //}
        }
示例#4
0
 public bool checkCollision(GameObject gameObject)
 {
     return(mGroup.checkCollisionWith(gameObject));
 }