Example #1
0
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            // Which type of message was sent to us?
            if (msg is SetDestinationMessage)
            {
                SetDestinationMessage tmp = (SetDestinationMessage)msg;

                SetDestination(tmp.mDestination_In);
            }
            else if (msg is ClearDestinationMessage)
            {
                ClearDestination();
            }
            else if (msg is SetSourceMessage)
            {
                SetSourceMessage tmp = (SetSourceMessage)msg;

                SetSource(tmp.mSource_In);
            }
            else if (msg is GetCurrentBestNodeMessage)
            {
                GetCurrentBestNodeMessage tmp = (GetCurrentBestNodeMessage)msg;

                // If the low level search hasn't started yet, return the high level one, so that
                // movement can start as soon as possible.
                tmp.mBest_Out = mLowLevelBest; // mLowLevelBest != null ? mLowLevelBest : mPlannerNavMesh.pCurrentBest;
            }
            else if (msg is Level.OnNavMeshInvalidatedMessage)
            {
                mPlannerNavMesh.InvalidateCurrentPath();
                mPlannerTileMap.InvalidateCurrentPath();

                SetSource(mParentGOH.pPosition);
            }
        }
Example #2
0
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            if (msg is SetTargetObjectMessage)
            {
                SetTargetObjectMessage temp = (SetTargetObjectMessage)msg;

                mTarget = temp.mTarget_In;

                if (null != mTarget)
                {
                    mSetDestinationMsg.mDestination_In = mTarget.pPosition + mParentGOH.pCollisionRoot;
                    mParentGOH.OnMessage(mSetDestinationMsg);
                }
            }
            else if (msg is PathFind.OnPathFindFailedMessage)
            {
                PathFind.OnPathFindFailedMessage temp = (PathFind.OnPathFindFailedMessage)msg;

                // Handle the case were the user places a tile right on top of the destination.
                if (null != mTarget && temp.mReason == PathFind.OnPathFindFailedMessage.Reason.InvalidLocation)
                {
                    mSetDestinationMsg.mDestination_In = mTarget.pPosition + mParentGOH.pCollisionRoot;
                    mParentGOH.OnMessage(mSetDestinationMsg);
                }
            }
        }
 /// <summary>
 /// See parent.
 /// </summary>
 /// <param name="msg"></param>
 public override void OnMessage(ref BehaviourMessage msg)
 {
     if (msg is TrialModeManager.OnTrialModeChangedMessage)
     {
         UpdateStatus();
     }
 }
 /// <summary>
 /// The main interface for communicating between behaviours.  Using polymorphism, we
 /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
 /// can then check for particular upcasted messahe types, and either grab some data 
 /// from it (set message) or store some data in it (get message).
 /// </summary>
 /// <param name="msg">The message being communicated to the behaviour.</param>
 public override void OnMessage(ref BehaviourMessage msg)
 {
     if (msg is Health.OnZeroHealthMessage)
     {
         mSetTileTypeAtPositionMsg.mType_In = Level.Tile.TileTypes.Empty;
         mSetTileTypeAtPositionMsg.mPosition_In = mParentGOH.pPosition;
         MBHEngine.World.WorldManager.pInstance.pCurrentLevel.OnMessage(mSetTileTypeAtPositionMsg, mParentGOH);
     }
 }
Example #5
0
 /// <summary>
 /// The main interface for communicating between behaviours.  Using polymorphism, we
 /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
 /// can then check for particular upcasted messahe types, and either grab some data
 /// from it (set message) or store some data in it (get message).
 /// </summary>
 /// <param name="msg">The message being communicated to the behaviour.</param>
 public override void OnMessage(ref BehaviourMessage msg)
 {
     if (msg is Health.OnZeroHealthMessage)
     {
         mSetTileTypeAtPositionMsg.mType_In     = Level.Tile.TileTypes.Empty;
         mSetTileTypeAtPositionMsg.mPosition_In = mParentGOH.pPosition;
         MBHEngine.World.WorldManager.pInstance.pCurrentLevel.OnMessage(mSetTileTypeAtPositionMsg, mParentGOH);
     }
 }
 /// <summary>
 /// The main interface for communicating between behaviours.  Using polymorphism, we
 /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
 /// can then check for particular upcasted messahe types, and either grab some data
 /// from it (set message) or store some data in it (get message).
 /// </summary>
 /// <param name="msg">The message being communicated to the behaviour.</param>
 public override void OnMessage(ref BehaviourMessage msg)
 {
     // Which type of message was sent to us?
     if (msg is SimulatedPhysics.GetBodyMessage)
     {
         SimulatedPhysics.GetBodyMessage temp = (SimulatedPhysics.GetBodyMessage)msg;
         temp.mBody_Out = mBody;
         msg            = temp;
     }
 }
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data 
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            base.OnMessage(ref msg);

            if (msg is Player.OnGameRestartMessage || msg is Player.OnMatchRestartMessage || msg is TrialModeManager.OnTrialModeChangedMessage)
            {
                mSetStateMsg.Reset();
                mSetStateMsg.mNextState_In = "StateEmpty";
                pParentGOH.OnMessage(mSetStateMsg);
            }
        }
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            if (msg is SetStateMessage)
            {
                SetStateMessage temp = (SetStateMessage)msg;

                AdvanceToState(temp.mNextState_In);
            }

            // Pass the message down to the currently running state.
            mCurrentState.OnMessage(ref msg);
        }
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            if (msg is SetLookTargetMessage)
            {
                SetLookTargetMessage temp = (SetLookTargetMessage)msg;

                mTarget = temp.mTarget_In;
            }
            else if (msg is Health.OnZeroHealthMessage)
            {
                mParentGOH.SetBehaviourEnabled <FaceForward>(false);
            }
        }
Example #10
0
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            // Which type of message was sent to us?
            if (msg is ApplyDamageMessage)
            {
                ApplyDamageMessage temp = (ApplyDamageMessage)msg;

                ApplyDamage(temp.mDamageAmount_In);
            }
            else if (msg is IncrementHealthMessage)
            {
                IncrementHealthMessage temp = (IncrementHealthMessage)msg;

                mCurrentHealth = System.Math.Min(mMaxHealth, mCurrentHealth + temp.mIncrementAmount_In);
            }
            else if (msg is GetHealthMessage)
            {
                GetHealthMessage temp = (GetHealthMessage)msg;

                temp.mCurrentHealth_Out = mCurrentHealth;
                temp.mMaxHealth_Out     = mMaxHealth;
            }
            else if (msg is SetMaxHealthMessage)
            {
                SetMaxHealthMessage temp = (SetMaxHealthMessage)msg;

                Single percent = mCurrentHealth / mMaxHealth;

                mMaxHealth = temp.mMaxHealth_In;

                mCurrentHealth = percent * mMaxHealth;
            }
            else if (msg is IncrementMaxHealthMessage)
            {
                IncrementMaxHealthMessage temp = (IncrementMaxHealthMessage)msg;

                Single percent = mCurrentHealth / mMaxHealth;

                mMaxHealth += temp.mIncrementAmount_In;

                mCurrentHealth = percent * mMaxHealth;
            }
        }
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            if (msg is Health.OnZeroHealthMessage)
            {
                // By default just spawn the object where this object is.
                GameObject.GameObject go = GameObjectFactory.pInstance.GetTemplate(mTemplateFileName);
                Vector2 spawnPos         = mParentGOH.pPosition;

                // Optionally, there could be an attachment point specified.
                if (null != mAttachmentPoint)
                {
                    // Grab that attachment point and position the new object there.
                    mGetAttachmentPointMsg.mName_In = mAttachmentPoint;
                    mParentGOH.OnMessage(mGetAttachmentPointMsg);
                    spawnPos = mGetAttachmentPointMsg.mPoisitionInWorld_Out;
                }

                go.pPosition = spawnPos;

                GameObjectManager.pInstance.Add(go);
            }
        }
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data 
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            if (msg is Health.OnZeroHealthMessage)
            {
                // By default just spawn the object where this object is.
                GameObject.GameObject go = GameObjectFactory.pInstance.GetTemplate(mTemplateFileName);
                Vector2 spawnPos = mParentGOH.pPosition;

                // Optionally, there could be an attachment point specified.
                if (null != mAttachmentPoint)
                {
                    // Grab that attachment point and position the new object there.
                    mGetAttachmentPointMsg.mName_In = mAttachmentPoint;
                    mParentGOH.OnMessage(mGetAttachmentPointMsg);
                    spawnPos = mGetAttachmentPointMsg.mPoisitionInWorld_Out;
                }

                go.pPosition = spawnPos;

                GameObjectManager.pInstance.Add(go);
            }
        }
Example #13
0
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data 
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            if (msg is SetTargetObjectMessage)
            {
                SetTargetObjectMessage temp = (SetTargetObjectMessage)msg;

                mTarget = temp.mTarget_In;

                if (null != mTarget)
                {
                    mSetDestinationMsg.mDestination_In = mTarget.pPosition + mParentGOH.pCollisionRoot;
                    mParentGOH.OnMessage(mSetDestinationMsg);
                }
            }
            else if (msg is PathFind.OnPathFindFailedMessage)
            {
                PathFind.OnPathFindFailedMessage temp = (PathFind.OnPathFindFailedMessage)msg;

                // Handle the case were the user places a tile right on top of the destination.
                if (null != mTarget && temp.mReason == PathFind.OnPathFindFailedMessage.Reason.InvalidLocation)
                {
                    mSetDestinationMsg.mDestination_In = mTarget.pPosition + mParentGOH.pCollisionRoot;
                    mParentGOH.OnMessage(mSetDestinationMsg);
                }
            }
        }
Example #14
0
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data 
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            if (msg is Player.OnMatchRestartMessage || msg is Player.OnGameRestartMessage)
            {
                mHitCount = 0;
            }
            else if (msg is TutorialManager.HighlightPartnerMessage)
            {
                TutorialManager.HighlightPartnerMessage temp = (TutorialManager.HighlightPartnerMessage)msg;

                if (temp.mEnable)
                {
                    mParentGOH.pRenderPriority = 100;
                }
                else
                {
                    mParentGOH.pRenderPriority = mStartingRenderPriority;
                }
            }
            else if (msg is GetCurrentHitCountMessage)
            {
                GetCurrentHitCountMessage temp = (GetCurrentHitCountMessage)msg;

                temp.mHitCount_Out = mHitCount;
            }
        }
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data 
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            base.OnMessage(ref msg);

            if (msg is Button.OnButtonPressedMessage)
            {
                mFxMenuSelect.Play();

                if (msg.pSender == mLeaveCreditsButton)
                {
                    mSetStateMsg.Reset();
                    mSetStateMsg.mNextState_In = "StateMainMenuRoot";
                    pParentGOH.OnMessage(mSetStateMsg, pParentGOH);
                }
            }
        }
        /// <summary>
        /// See parent.
        /// </summary>
        /// <param name="msg"></param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            base.OnMessage(ref msg);

            if (msg is Button.OnButtonPressedMessage)
            {
                Button.OnButtonPressedMessage temp = (Button.OnButtonPressedMessage)msg;

                if (temp.pSender == mContinueButton)
                {
                    temp.mHandled_Out = true;

                    mSetStateMsg.Reset();
                    mSetStateMsg.mNextState_In = "StateTrialModeLimitGameplay";
                    pParentGOH.OnMessage(mSetStateMsg);
                }
            }
            else if (msg is TrialModeManager.OnTrialModeChangedMessage)
            {
                System.Diagnostics.Debug.Assert(!TrialModeManager.pInstance.pIsTrialMode, "Not expecting to reach this point and still be in Trial Mode.");

                mSetStateMsg.Reset();
                mSetStateMsg.mNextState_In = "StateEmpty";
                pParentGOH.OnMessage(mSetStateMsg);
            }
        }
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data 
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            base.OnMessage(ref msg);

            if (msg is Button.OnButtonPressedMessage)
            {
                if (msg.pSender == mResumeButton)
                {
                    GameObjectManager.pInstance.pCurUpdatePass = MBHEngineContentDefs.BehaviourDefinition.Passes.GAME_PLAY;

                    GameObjectManager.pInstance.Remove(pParentGOH);
                }
                else if (msg.pSender == mQuitButton)
                {
                    GameObjectManager.pInstance.pCurUpdatePass = MBHEngineContentDefs.BehaviourDefinition.Passes.QUIT;

                    GameObjectManager.pInstance.Remove(pParentGOH);
                }
                else if (msg.pSender == mMainMenuButton)
                {
                    // Save the score when going back to the main menu. This will be filtered out
                    // of modes that could be exploited (eg. trick attack).
                    GameObjectManager.pInstance.BroadcastMessage(mForceUpdateSaveGameDataMsg, pParentGOH);

                    GameObjectManager.pInstance.pCurUpdatePass = MBHEngineContentDefs.BehaviourDefinition.Passes.MAIN_MENU;

                    TutorialManager.pInstance.StopTutorial();

                    GameObject mainMenu = GameObjectFactory.pInstance.GetTemplate("GameObjects\\UI\\MainMenu\\FSMMainMenu\\FSMMainMenu");
                    GameObjectManager.pInstance.Add(mainMenu);

                    GameObjectManager.pInstance.Remove(pParentGOH);
                }
                else if (msg.pSender == mAchievementsButton)
                {
#if __ANDROID__
                    BumpSetSpike_Android.Activity1 activity = Game1.Activity as BumpSetSpike_Android.Activity1;
                    if (activity.pGooglePlayClient.IsConnected)
                    {
                        activity.StartActivityForResult(activity.pGooglePlayClient.AchievementsIntent, BumpSetSpike_Android.Activity1.REQUEST_ACHIEVEMENTS);
                    }
                    else
                    {
                        activity.pGooglePlayClient.Connect();
                    }
#endif // __ANDROID__
                }
            }
            else if (msg is TrialModeManager.OnTrialModeChangedMessage)
            {
                if (mPurchaseButton != null)
                {
                    GameObjectManager.pInstance.Remove(mPurchaseButton);
                    mPurchaseButton = null;
                }
            }
        }
Example #18
0
 /// <summary>
 /// The main interface for communicating between behaviours.  Using polymorphism, we
 /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
 /// can then check for particular upcasted messahe types, and either grab some data
 /// from it (set message) or store some data in it (get message).
 /// </summary>
 /// <param name="msg">The message being communicated to the behaviour.</param>
 public virtual void OnMessage(ref BehaviourMessage msg)
 {
 }
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data 
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            // Which type of message was sent to us?
            if (msg is SpriteRender.GetSpriteEffectsMessage)
            {
                SpriteRender.GetSpriteEffectsMessage temp = (SpriteRender.GetSpriteEffectsMessage)msg;
                temp.mSpriteEffects_Out = mSpriteEffects;
                msg = temp;
            }
            else if (msg is SpriteRender.SetSpriteEffectsMessage)
            {
                SpriteRender.SetSpriteEffectsMessage temp = (SpriteRender.SetSpriteEffectsMessage)msg;
                mSpriteEffects = temp.mSpriteEffects_In;
            }
            else if (msg is GetActiveAnimationMessage)
            {
                SpriteRender.GetActiveAnimationMessage temp = (SpriteRender.GetActiveAnimationMessage)msg;
                temp.mAnimationSetName_Out = mAnimations[mActiveAnimation].mName;
                msg = temp;
            }
            else if (msg is SetActiveAnimationMessage)
            {
                SpriteRender.SetActiveAnimationMessage temp = (SpriteRender.SetActiveAnimationMessage)msg;

                // If the animation is not currently playing we need to find it.
                if (mAnimations[mActiveAnimation].mName != temp.mAnimationSetName_In)
                {
                    Boolean animationFound = false;

                    for (int i = 0; i < mAnimations.Count; i++)
                    {
                        if (mAnimations[i].mName == temp.mAnimationSetName_In)
                        {
                            mActiveAnimation = i;
                            mCurrentAnimationFrame = 0;
                            mAnimations[mActiveAnimation].mAnimationComplete = false;
                            animationFound = true;
                            break;
                        }
                    }

                    System.Diagnostics.Debug.Assert(animationFound, "Attempting to set unknown Animation: " + temp.mAnimationSetName_In);
                }
                // In the case where it is a non-looping animation which has completed, we need to reset the 
                // animation to the beginning.
                // If it is a looping animation we don't do anything and assume that they just wanted to continue
                // the animation.
                else if (mAnimations[mActiveAnimation].mAnimationComplete && !temp.mDoNotRestartIfCompleted_In)
                {
                    mCurrentAnimationFrame = 0;
                    mAnimations[mActiveAnimation].mAnimationComplete = false;

                }
            }
            else if (msg is GetAttachmentPointMessage)
            {
                GetAttachmentPointMessage temp = (GetAttachmentPointMessage)msg;

                FindAttachmentPointInWorldSpace(temp.mName_In, ref temp.mPoisitionInWorld_Out);
            }
            else if (msg is SetColorMessage)
            {
                SetColorMessage temp = (SetColorMessage)msg;
                mColor = temp.mColor_In;
            }
            else if (msg is SetTintMessage)
            {
                SetTintMessage temp = (SetTintMessage)msg;
                mTint = temp.mColor_In;
            }
            else if (msg is GetTexture2DMessage)
            {
                GetTexture2DMessage temp = (GetTexture2DMessage)msg;
                temp.mTexture_Out = mTexture;
            }
        }
Example #20
0
        /// <summary>
        /// See parent.
        /// </summary>
        /// <param name="msg"></param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            base.OnMessage(ref msg);

            if (msg is Button.OnButtonPressedMessage)
            {
                Button.OnButtonPressedMessage temp = msg as Button.OnButtonPressedMessage;

                if (temp.pSender == mLeaderboardButton)
                {
#if __ANDROID__
                    BumpSetSpike_Android.Activity1 activity = (Game1.Activity as BumpSetSpike_Android.Activity1);
                    if (!activity.pGooglePlayClient.IsConnected)
                    {
                        activity.pGooglePlayClient.Connect();
                    }
                    else
                    {
                        mGetCurrentHitCountMsg.Reset();
                        GameObjectManager.pInstance.BroadcastMessage(mGetCurrentHitCountMsg, mParentGOH);

                        // Show a different leaderboard based on the current
                        int board = (GameModeManager.pInstance.pMode == GameModeManager.GameMode.Endurance) ? Resource.String.leaderboard_endurance : Resource.String.leaderboard_trick_attack;
                        int hiScore = (GameModeManager.pInstance.pMode == GameModeManager.GameMode.Endurance) ? LeaderBoardManager.pInstance.pTopHits : LeaderBoardManager.pInstance.pTopScore;

                        // The high score will not have been saved yet, so we need to manually update it here.
                        string boardString = activity.Resources.GetString(board);
                        activity.pGooglePlayClient.SubmitScoreImmediate(activity, boardString, mGetCurrentHitCountMsg.mCount_Out);

                        activity.StartActivityForResult(activity.pGooglePlayClient.GetLeaderboardIntent(boardString), BumpSetSpike_Android.Activity1.REQUEST_LEADERBOARD);
                    }
#endif // __ANDROID__

                    temp.mHandled_Out = true;
                }
            }
        }
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data 
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            if (!mDisplayRecord && msg is IncrementHitCountMessage)
            {
                SetScore(mHitCount + 1);
            }
            else if (!mDisplayRecord && (msg is ClearHitCountMessage || msg is Player.OnGameRestartMessage))
            {
                if (GameObjectManager.pInstance.pCurUpdatePass != MBHEngineContentDefs.BehaviourDefinition.Passes.GAME_OVER_LOSS)
                {
                    LeaderBoardManager.pInstance.SetCurrentModeTopScore(mHitCount);
                }

                ScoreManager.pInstance.OnMatchOver();

                SetScore(0);
            }
            else if (!mDisplayRecord && msg is GetCurrentHitCountMessage)
            {
                GetCurrentHitCountMessage temp = (GetCurrentHitCountMessage)msg;
                temp.mCount_Out = mHitCount;
            }
            else if (msg is SaveGameManager.ForceUpdateSaveDataMessage)
            {
                // We don't save trick attack because they might not have finished this move.
                if (GameModeManager.pInstance.pMode == GameModeManager.GameMode.Endurance)
                {
                    LeaderBoardManager.pInstance.pTopHits = mHitCount;
                }
            }
            else if (!mDisplayRecord && msg is SetScoreMessage)
            {
                SetScoreMessage temp = (SetScoreMessage)msg;

                SetScore(temp.mCount_In);
            }
            else if (msg is ResetGameMessage)
            {
                if (mHitCounterNums.Count > 0)
                {
                    if (mDisplayRecord)
                    {
                        SetScore(LeaderBoardManager.pInstance.GetCurrentModeTopScore());
                    }
                    else
                    {
                        SetScore(0);
                    }
                }
            }
        }
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data 
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            base.OnMessage(ref msg);

            if (msg is Button.OnButtonPressedMessage)
            {
                mFxMenuSelect.Play();

                if (msg.pSender == mEnduranceModeButton)
                {
                    GameModeManager.pInstance.pMode = GameModeManager.GameMode.Endurance;
                }
                else if (msg.pSender == mScoreAttackModeButton)
                {
                    GameModeManager.pInstance.pMode = GameModeManager.GameMode.TrickAttack;
                }

                mSetStateMsg.Reset();
                mSetStateMsg.mNextState_In = "StateMainMenuModeSelectDesc";
                pParentGOH.OnMessage(mSetStateMsg, pParentGOH);
            }
        }
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data 
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            if (msg is SetStateMessage)
            {
                SetStateMessage temp = (SetStateMessage)msg;

                AdvanceToState(temp.mNextState_In);
            }

            // Pass the message down to the currently running state.
            mCurrentState.OnMessage(ref msg);
        }
Example #24
0
 /// <summary>
 /// The main interface for communicating between behaviours.  Using polymorphism, we
 /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
 /// can then check for particular upcasted messahe types, and either grab some data
 /// from it (set message) or store some data in it (get message).
 /// </summary>
 /// <param name="msg">The message being communicated to the behaviour.</param>
 public override void OnMessage(ref BehaviourMessage msg)
 {
 }
Example #25
0
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data 
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            if (msg is Player.OnMatchRestartMessage || msg is Player.OnGameRestartMessage)
            {
                mPlayOver = false;
                mHasHitNet = false;

                mParentGOH.pPosX = 110.0f;
                mParentGOH.pPosY = -16.0f;

                // -30 -> -90

                Single speed = ((Single)RandomManager.pInstance.RandomPercent() * 2.0f) + 5.0f;

                Vector2 dest = new Vector2((Single)RandomManager.pInstance.RandomPercent() * -60.0f - 30.0f, 16.0f);

                if (!TutorialManager.pInstance.pTutorialCompleted)
                {
                    dest.X = -90;
                }

                mSetServeDestinationMsg.mDestination_Out = dest;
                GameObjectManager.pInstance.BroadcastMessage(mSetServeDestinationMsg, mParentGOH);

                Vector2 vel = MBHEngine.Math.Util.GetArcVelocity(mParentGOH.pPosition, dest, speed, 0.2f);

                mParentGOH.pDirection.mForward = vel;

                mTimeOnGroundToEndPlay.Restart();
                mTimeOnGroundToEndPlay.pIsPaused = true;
            }
            else if (msg is TutorialManager.HighlightBallMessage)
            {
                TutorialManager.HighlightBallMessage temp = (TutorialManager.HighlightBallMessage)msg;

                if (temp.mEnable)
                {
                    mParentGOH.pRenderPriority = 100;
                }
                else
                {
                    mParentGOH.pRenderPriority = mStartingRenderPriority;
                }
            }
        }
 /// <summary>
 /// The main interface for communicating between behaviours.  Using polymorphism, we
 /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
 /// can then check for particular upcasted messahe types, and either grab some data 
 /// from it (set message) or store some data in it (get message).
 /// </summary>
 /// <param name="msg">The message being communicated to the behaviour.</param>
 public override void OnMessage(ref BehaviourMessage msg)
 {
     base.OnMessage(ref msg);
 }
Example #27
0
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data 
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            // Which type of message was sent to us?
            if (msg is Level.GetCollisionInfoMessage)
            {
                Level.GetCollisionInfoMessage temp = (Level.GetCollisionInfoMessage)msg;
                temp.mCollisionDetected_Out = CheckForCollision(temp.mOriginalRect_In,
                                                            temp.mDesiredRect_In,
                                                            out temp.mCollisionDetectedX_Out,
                                                            out temp.mCollisionDetectedY_Out,
                                                            out temp.mCollisionPointX_Out,
                                                            out temp.mCollisionPointY_Out);
                msg = temp;
            }
            else if (msg is GetTileAtPositionMessage)
            {
                GetTileAtPositionMessage temp = (GetTileAtPositionMessage)msg;

                temp.mTile_Out = GetTileAtPosition(temp.mPosition_In.X, temp.mPosition_In.Y);

                msg = temp;
            }
            else if (msg is GetTileAtObjectMessage)
            {
                GetTileAtObjectMessage temp = (GetTileAtObjectMessage)msg;

                temp.mTile_Out = GetTileAtObject(temp.mObject_In);

                msg = temp;
            }
            else if (msg is SetTileTypeAtPositionMessage)
            {
                SetTileTypeAtPositionMessage temp = (SetTileTypeAtPositionMessage)msg;

                Tile t = GetTileAtPosition(temp.mPosition_In.X, temp.mPosition_In.Y);

                temp.mPreviousType_Out = t.mType;

                if (t.mType != temp.mType_In)
                {
                    t.mType = temp.mType_In;

                    DetermineAndSetImage(t);

                    UpdateEdgeCollisionData(t, true);

                    mNavMesh.RegenerateCluster(temp.mPosition_In);

                    GameObjectManager.pInstance.BroadcastMessage(mOnNavMeshInvalidatedMsg);
                }
            }
            else if (msg is GetMapInfoMessage)
            {
                GetMapInfoMessage temp = (GetMapInfoMessage)msg;

                temp.mInfo_Out = mMapInfo;

                msg = temp;
            }
            else if (msg is GetNavMeshMessage)
            {
                GetNavMeshMessage temp = (GetNavMeshMessage)msg;
                temp.mNavMesh_Out = mNavMesh;
            }
        }
Example #28
0
 /// <summary>
 /// See parent.
 /// </summary>
 /// <param name="msg"></param>
 public override void OnMessage(ref BehaviourMessage msg)
 {
     // Some things need to reset when the game is restarted.
     if (msg is HitCountDisplay.ResetGameMessage)
     {
         Reset();
     }
 }
Example #29
0
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data 
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            if (msg is Ball.GetServeDestinationMessage)
            {
                Ball.GetServeDestinationMessage temp = (Ball.GetServeDestinationMessage)msg;

                mWalkToDestination.X = temp.mDestination_Out.X - 4.0f;
                // The player may have been in mid air when the round ended.
                mWalkToDestination.Y = 0.0f;

                // Ensure that we aren't asked to walk to a position which we can't reach. In those cases,
                // just get as close as possible.
                mWalkToDestination = Vector2.Clamp(mWalkToDestination, mTopLeft, mBottomRight);

                mCurrentState = State.Receiving;
            }
            else if (msg is GetCurrentStateMessage)
            {
                GetCurrentStateMessage temp = (GetCurrentStateMessage)msg;
                temp.mState_Out = mCurrentState;
            }
            else if (msg is TutorialManager.HighlightPlayerMessage)
            {
                TutorialManager.HighlightPlayerMessage temp = (TutorialManager.HighlightPlayerMessage)msg;

                if (temp.mEnable)
                {
                    mParentGOH.pRenderPriority = 100;
                }
                else
                {
                    mParentGOH.pRenderPriority = mStartingRenderPriority;
                }
            }
            else if (msg is Player.OnGameRestartMessage || msg is Player.OnMatchRestartMessage) // During tutorials if the player misses the ball we only do a match restart.
            {
                mHasMultipleHitsBeforePartner = false;

                if (msg is Player.OnGameRestartMessage)
                {
                    mTrialLimitReached = false;
                }

                // If the player is on the other side of the net, teleport them to the proper side.
                if (mParentGOH.pPosX > 0.0f)
                {
                    mParentGOH.pPosX = mTopLeft.X;
                    mParentGOH.pPosY = mBottomRight.Y;

                    // There were issues where after jumping over the net in the turorial, the player was
                    // still walking on the next match.
                    mParentGOH.pDirection.mForward = Vector2.Zero;
                }

                EndJumpZoom();
            }
            else if (msg is Ball.OnPlayOverMessage)
            {
                EndJumpZoom();
            }
            else if (msg is HitCountDisplay.TrialScoreLimitReachedMessage)
            {
                mTrialLimitReached = true;
            }
            else if (msg is TrialModeManager.OnTrialModeChangedMessage)
            {
                mTrialLimitReached = false;
            }
            else if (msg is GetHasMultipleHitsBeforePartnerMessage)
            {
                GetHasMultipleHitsBeforePartnerMessage temp = (GetHasMultipleHitsBeforePartnerMessage)msg;

                temp.mHasMultipleHits_Out = mHasMultipleHitsBeforePartner;
            }
        }
Example #30
0
 /// <summary>
 /// The main interface for communicating between behaviours.  Using polymorphism, we
 /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
 /// can then check for particular upcasted messahe types, and either grab some data 
 /// from it (set message) or store some data in it (get message).
 /// </summary>
 /// <param name="msg">The message being communicated to the behaviour.</param>
 public override void OnMessage(ref BehaviourMessage msg)
 {
     if (msg is Player.OnMatchRestartMessage)
     {
         mKabooomAvail = true;
         mKaboomCount = 0;
     }
     else if (msg is Player.OnGameRestartMessage)
     {
         mKabooomAvail = true;
         mCurrentState = State.Idle;
         mParentGOH.pPosition = mStartPos;
         mKaboomCount = 0;
     }
     else if (msg is Ball.OnPlayOverMessage)
     {
         // The ball has hit the ground. We don't want bouncing balls to KABOOOM the opponent.
         mKabooomAvail = false;
     }
 }
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data 
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            base.OnMessage(ref msg);

            if (msg is Button.OnButtonPressedMessage)
            {
                mFxMenuSelect.Play();

                if (msg.pSender == mTapStart)
                {
                    // The did it! They actually played the game!!
                    AchievementManager.pInstance.UnlockAchievement(AchievementManager.Achievements.TheUbi);

                    mSetStateMsg.Reset();
                    mSetStateMsg.mNextState_In = "StateMainMenuModeSelect";
                    pParentGOH.OnMessage(mSetStateMsg, pParentGOH);
                }
                if (msg.pSender == mCreditsButton)
                {
                    mSetStateMsg.Reset();
                    mSetStateMsg.mNextState_In = "StateMainMenuCredits";
                    pParentGOH.OnMessage(mSetStateMsg, pParentGOH);
                }
            }
        }
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data 
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            base.OnMessage(ref msg);

            if (msg is Button.OnButtonPressedMessage)
            {
                if (msg.pSender == mGoButton)
                {
                    mFxMenuSelect.Play();

                    mSetStateMsg.Reset();
                    mSetStateMsg.mNextState_In = "StateMainMenuCameraPan";
                    pParentGOH.OnMessage(mSetStateMsg, pParentGOH);
                }
                else if (msg.pSender == mEnduranceModeButton && GameModeManager.pInstance.pMode != GameModeManager.GameMode.Endurance)
                {
                    mFxMenuSelect.Play();

                    GameModeManager.pInstance.pMode = GameModeManager.GameMode.Endurance;

                    // If they click a different game mode, just restart this state.
                    mSetStateMsg.Reset();
                    mSetStateMsg.mNextState_In = "StateMainMenuModeSelectDesc";
                    pParentGOH.OnMessage(mSetStateMsg, pParentGOH);
                }
                else if (msg.pSender == mScoreAttackModeButton && GameModeManager.pInstance.pMode != GameModeManager.GameMode.TrickAttack)
                {
                    mFxMenuSelect.Play();

                    GameModeManager.pInstance.pMode = GameModeManager.GameMode.TrickAttack;

                    // If they click a different game mode, just restart this state.
                    mSetStateMsg.Reset();
                    mSetStateMsg.mNextState_In = "StateMainMenuModeSelectDesc";
                    pParentGOH.OnMessage(mSetStateMsg, pParentGOH);
                }
            }
        }
 /// <summary>
 /// See parent.
 /// </summary>
 /// <param name="msg"></param>
 public override void OnMessage(ref BehaviourMessage msg)
 {
     if (msg is Player.OnGameRestartMessage || msg is Player.OnMatchRestartMessage)
     {
         mHighScoreSoundPlayed = false;
     }
 }
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            // Which type of message was sent to us?
            if (msg is SpriteRender.GetSpriteEffectsMessage)
            {
                SpriteRender.GetSpriteEffectsMessage temp = (SpriteRender.GetSpriteEffectsMessage)msg;
                temp.mSpriteEffects_Out = mSpriteEffects;
                msg = temp;
            }
            else if (msg is SpriteRender.SetSpriteEffectsMessage)
            {
                SpriteRender.SetSpriteEffectsMessage temp = (SpriteRender.SetSpriteEffectsMessage)msg;
                mSpriteEffects = temp.mSpriteEffects_In;
            }
            else if (msg is GetActiveAnimationMessage)
            {
                SpriteRender.GetActiveAnimationMessage temp = (SpriteRender.GetActiveAnimationMessage)msg;
                temp.mAnimationSetName_Out = mAnimations[mActiveAnimation].mName;
                msg = temp;
            }
            else if (msg is SetActiveAnimationMessage)
            {
                SpriteRender.SetActiveAnimationMessage temp = (SpriteRender.SetActiveAnimationMessage)msg;

                // If the animation is not currently playing we need to find it.
                if (mAnimations[mActiveAnimation].mName != temp.mAnimationSetName_In)
                {
                    Boolean animationFound = false;

                    for (int i = 0; i < mAnimations.Count; i++)
                    {
                        if (mAnimations[i].mName == temp.mAnimationSetName_In)
                        {
                            mActiveAnimation       = i;
                            mCurrentAnimationFrame = 0;
                            mAnimations[mActiveAnimation].mAnimationComplete = false;
                            animationFound = true;
                            break;
                        }
                    }

                    System.Diagnostics.Debug.Assert(animationFound, "Attempting to set unknown Animation: " + temp.mAnimationSetName_In);
                }
                // In the case where it is a non-looping animation which has completed, we need to reset the
                // animation to the beginning.
                // If it is a looping animation we don't do anything and assume that they just wanted to continue
                // the animation.
                else if (mAnimations[mActiveAnimation].mAnimationComplete)
                {
                    mCurrentAnimationFrame = 0;
                    mAnimations[mActiveAnimation].mAnimationComplete = false;
                }
            }
            else if (msg is GetAttachmentPointMessage)
            {
                GetAttachmentPointMessage temp = (GetAttachmentPointMessage)msg;

                FindAttachmentPointInWorldSpace(temp.mName_In, ref temp.mPoisitionInWorld_Out);
            }
            else if (msg is SetColorMessage)
            {
                SetColorMessage temp = (SetColorMessage)msg;
                mColor = temp.mColor_In;
            }
            else if (msg is SetTintMessage)
            {
                SetTintMessage temp = (SetTintMessage)msg;
                mTint = temp.mColor_In;
            }
            else if (msg is GetTexture2DMessage)
            {
                GetTexture2DMessage temp = (GetTexture2DMessage)msg;
                temp.mTexture_Out = mTexture;
            }
        }
Example #35
0
 /// <summary>
 /// The main interface for communicating between behaviours.  Using polymorphism, we
 /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
 /// can then check for particular upcasted messahe types, and either grab some data 
 /// from it (set message) or store some data in it (get message).
 /// </summary>
 /// <param name="msg">The message being communicated to the behaviour.</param>
 public override void OnMessage(ref BehaviourMessage msg)
 {
 }
 /// <summary>
 /// The main interface for communicating between behaviours.  Using polymorphism, we
 /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
 /// can then check for particular upcasted messahe types, and either grab some data 
 /// from it (set message) or store some data in it (get message).
 /// </summary>
 /// <param name="msg">The message being communicated to the behaviour.</param>
 public override void OnMessage(ref BehaviourMessage msg)
 {
     // Which type of message was sent to us?
     if (msg is SimulatedPhysics.GetBodyMessage)
     {
         SimulatedPhysics.GetBodyMessage temp = (SimulatedPhysics.GetBodyMessage)msg;
         temp.mBody_Out = mBody;
         msg = temp;
     }
 }
Example #37
0
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data 
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            // Which type of message was sent to us?
            if (msg is SetDestinationMessage)
            {
                SetDestinationMessage tmp = (SetDestinationMessage)msg;

                SetDestination(tmp.mDestination_In);
            }
            else if (msg is ClearDestinationMessage)
            {
                ClearDestination();
            }
            else if (msg is SetSourceMessage)
            {
                SetSourceMessage tmp = (SetSourceMessage)msg;

                SetSource(tmp.mSource_In);
            }
            else if (msg is GetCurrentBestNodeMessage)
            {
                GetCurrentBestNodeMessage tmp = (GetCurrentBestNodeMessage)msg;

                // If the low level search hasn't started yet, return the high level one, so that
                // movement can start as soon as possible.
                tmp.mBest_Out = mLowLevelBest; // mLowLevelBest != null ? mLowLevelBest : mPlannerNavMesh.pCurrentBest;
            }
            else if (msg is Level.OnNavMeshInvalidatedMessage)
            {
                mPlannerNavMesh.InvalidateCurrentPath();
                mPlannerTileMap.InvalidateCurrentPath();

                SetSource(mParentGOH.pPosition);
            }
        }
Example #38
0
 /// <summary>
 /// The main interface for communicating between behaviours.  Using polymorphism, we
 /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
 /// can then check for particular upcasted messahe types, and either grab some data 
 /// from it (set message) or store some data in it (get message).
 /// </summary>
 /// <param name="msg">The message being communicated to the behaviour.</param>
 public virtual void OnMessage(ref BehaviourMessage msg) { }
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data 
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            if (msg is SetTargetMessage)
            {
                SetTargetMessage temp = (SetTargetMessage)msg;

                mTarget = temp.mTarget_In;
            }
        }
Example #40
0
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data 
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            if (msg is SetLookTargetMessage)
            {
                SetLookTargetMessage temp = (SetLookTargetMessage)msg;

                mTarget = temp.mTarget_In;
            }
            else if (msg is Health.OnZeroHealthMessage)
            {
                mParentGOH.SetBehaviourEnabled<FaceForward>(false);
            }
        }
        /// <summary>
        /// The main interface for communicating between behaviours.  Using polymorphism, we
        /// define a bunch of different messages deriving from BehaviourMessage.  Each behaviour
        /// can then check for particular upcasted messahe types, and either grab some data 
        /// from it (set message) or store some data in it (get message).
        /// </summary>
        /// <param name="msg">The message being communicated to the behaviour.</param>
        public override void OnMessage(ref BehaviourMessage msg)
        {
            if (msg is SetScoreMessage)
            {
                SetScoreMessage temp = (SetScoreMessage)msg;

                SetScore(temp.mScore_In);
            }
        }