/// <summary> /// Call this to initialize a Behaviour with data supplied in a file. /// </summary> /// <param name="fileName">The file to load from.</param> public override void LoadContent(String fileName) { base.LoadContent(fileName); ButtonMultiStageDefinition def = GameObjectManager.pInstance.pContentManager.Load<ButtonMultiStageDefinition>(fileName); mCurClickCount = 0; mMaxClickCount = def.mNumStages; mSetActiveAnimationMsg = new SpriteRender.SetActiveAnimationMessage(); }
/// <summary> /// Call this to initialize a Behaviour with data supplied in a file. /// </summary> /// <param name="fileName">The file to load from.</param> public override void LoadContent(String fileName) { PointDisplayDefinition def = GameObjectManager.pInstance.pContentManager.Load<PointDisplayDefinition>(fileName); base.LoadContent(fileName); mScoreNums = new List<GameObject>(16); mSetActiveAnimationMsg = new SpriteRender.SetActiveAnimationMessage(); mSetColorMsg = new SpriteRender.SetColorMessage(); }
/// <summary> /// Call this to initialize a Behaviour with data supplied in a file. /// </summary> /// <param name="fileName">The file to load from.</param> public override void LoadContent(String fileName) { base.LoadContent(fileName); //ExampleDefinition def = GameObjectManager.pInstance.pContentManager.Load<ExampleDefinition>(fileName); // By default we have no target. mTarget = null; mSetActiveAnimationMsg = new SpriteRender.SetActiveAnimationMessage();; mSetDestinationMsg = new PathFind.SetDestinationMessage(); mSetSourceMsg = new PathFind.SetSourceMessage(); mGetCurrentBestNodeMsg = new PathFind.GetCurrentBestNodeMessage(); mClearDestinationMsg = new PathFind.ClearDestinationMessage(); mOnReachedPathEndMsg = new OnReachedPathEndMessage(); }
/// <summary> /// Call this to initialize a Behaviour with data supplied in a file. /// </summary> /// <param name="fileName">The file to load from.</param> public override void LoadContent(String fileName) { base.LoadContent(fileName); PlayerDefinition def = GameObjectManager.pInstance.pContentManager.Load<PlayerDefinition>(fileName); mCurrentState = State.WaitForMenu; mCollisionWall = new LineSegment(); mMovementLine = new LineSegment(); mBallClassifications = new List<MBHEngineContentDefs.GameObjectDefinition.Classifications>(1); mBallClassifications.Add(MBHEngineContentDefs.GameObjectDefinition.Classifications.VOLLEY_BALL); mCollisionResults = new List<GameObject>(16); mStateTimer = StopWatchManager.pInstance.GetNewStopWatch(); mTopLeft = new Vector2(-90.0f, -80.0f); mBottomRight = new Vector2(90.0f, 0.0f); mFramesInAir = 0; mFxJump = GameObjectManager.pInstance.pContentManager.Load<SoundEffect>("Audio\\FX\\Jump"); mFxSpikeHit = GameObjectManager.pInstance.pContentManager.Load<SoundEffect>("Audio\\FX\\SpikeHit"); mFxSpikeMiss = GameObjectManager.pInstance.pContentManager.Load<SoundEffect>("Audio\\FX\\SpikeMiss"); mFxBump = GameObjectManager.pInstance.pContentManager.Load<SoundEffect>("Audio\\FX\\Bump"); mStartingRenderPriority = mParentGOH.pRenderPriority; mWalkSpeed = 3.0f; mHasMultipleHitsBeforePartner = false; mSetActiveAnimationMsg = new SpriteRender.SetActiveAnimationMessage(); mGetAttachmentPointMsg = new SpriteRender.GetAttachmentPointMessage(); mMatchRestartMsg = new OnMatchRestartMessage(); mGameRestartMsg = new OnGameRestartMessage(); mGetCurrentHitCountMsg = new HitCountDisplay.GetCurrentHitCountMessage(); mGetPartnerHitCountMsg = new Partner.GetCurrentHitCountMessage(); }
/// <summary> /// Call this to initialize a Behaviour with data supplied in a file. /// </summary> /// <param name="fileName">The file to load from.</param> public override void LoadContent(String fileName) { PartnerDefinition def = GameObjectManager.pInstance.pContentManager.Load<PartnerDefinition>(fileName); base.LoadContent(fileName); //DamageFlashDefinition def = GameObjectManager.pInstance.pContentManager.Load<DamageFlashDefinition>(fileName); mBallClassifications = new List<MBHEngineContentDefs.GameObjectDefinition.Classifications>(1); mBallClassifications.Add(MBHEngineContentDefs.GameObjectDefinition.Classifications.VOLLEY_BALL); mCollisionResults = new List<GameObject>(16); mStateTimer = StopWatchManager.pInstance.GetNewStopWatch(); mHitCount = 0; mFxBump = GameObjectManager.pInstance.pContentManager.Load<SoundEffect>("Audio\\FX\\Bump"); mStartingRenderPriority = mParentGOH.pRenderPriority; mSetActiveAnimationMsg = new SpriteRender.SetActiveAnimationMessage(); mSetSpriteEffectsMsg = new SpriteRender.SetSpriteEffectsMessage(); mGetCurrentStateMsg = new Player.GetCurrentStateMessage(); mGetCurrentHitCountMsg = new HitCountDisplay.GetCurrentHitCountMessage(); }
/// <summary> /// Call this to initialize a Behaviour with data supplied in a file. /// </summary> /// <param name="fileName">The file to load from.</param> public override void LoadContent(String fileName) { base.LoadContent(fileName); mCurrentState = State.Idle; mBallClassifications = new List<MBHEngineContentDefs.GameObjectDefinition.Classifications>(1); mBallClassifications.Add(MBHEngineContentDefs.GameObjectDefinition.Classifications.VOLLEY_BALL); mCollisionResults = new List<GameObject>(16); mStateTimer = StopWatchManager.pInstance.GetNewStopWatch(); mKabooomAvail = true; mFxHit = GameObjectManager.pInstance.pContentManager.Load<SoundEffect>("Audio\\FX\\HitOpponent"); mFxHitGround = GameObjectManager.pInstance.pContentManager.Load<SoundEffect>("Audio\\FX\\HitOpponentLand"); mSetActiveAnimationMsg = new SpriteRender.SetActiveAnimationMessage(); mSetSpriteEffectsMsg = new SpriteRender.SetSpriteEffectsMessage(); mGetAttachmentPointMsg = new SpriteRender.GetAttachmentPointMessage(); mGetCurrentStateMsg = new Player.GetCurrentStateMessage(); mGetCurrentHitCountMsg = new HitCountDisplay.GetCurrentHitCountMessage(); }
/// <summary> /// Call this to initialize a Behaviour with data supplied in a file. /// </summary> /// <param name="fileName">The file to load from.</param> public override void LoadContent(String fileName) { base.LoadContent(fileName); mCollisionWall = new LineSegment(); mBallMovementLine = new LineSegment(); mTimeOnGroundToEndPlay = StopWatchManager.pInstance.GetNewStopWatch(); mTimeOnGroundToEndPlay.pLifeTime = 10.0f; mTimeOnGroundToEndPlay.pIsPaused = true; mFxSand = GameObjectManager.pInstance.pContentManager.Load<SoundEffect>("Audio\\FX\\HitSand"); mOnGround = false; mPlayOver = false; mHasHitNet = false; mStartingRenderPriority = mParentGOH.pRenderPriority; mSetActiveAnimationMsg = new SpriteRender.SetActiveAnimationMessage(); mGetAttachmentPointMsg = new SpriteRender.GetAttachmentPointMessage(); mOnPlayOverMsg = new OnPlayOverMessage(); mOnMatchRestartMsg = new Player.OnMatchRestartMessage(); mIncrementHitCountMsg = new HitCountDisplay.IncrementHitCountMessage(); mSetServeDestinationMsg = new GetServeDestinationMessage(); mGetCurrentStateMsg = new Player.GetCurrentStateMessage(); mGetHasMultipleHitsBeforePartnerMsg = new Player.GetHasMultipleHitsBeforePartnerMessage(); }
/// <summary> /// Call this to initialize a Behaviour with data supplied in a file. /// </summary> /// <param name="fileName">The file to load from.</param> public override void LoadContent(String fileName) { HitCountDisplayDefinition def = GameObjectManager.pInstance.pContentManager.Load<HitCountDisplayDefinition>(fileName); base.LoadContent(fileName); mNumCharDisplay = 4; mDisplayRecord = def.mDisplayRecord; mHitCounterNums = new List<GameObject>(mNumCharDisplay); mHitCount = 0; mMaxScore = (Int32)(System.Math.Pow(10.0, (Double)mNumCharDisplay)) - 1; mSetActiveAnimationMsg = new SpriteRender.SetActiveAnimationMessage(); mTrialScoreLimitReachedMsg = new TrialScoreLimitReachedMessage(); }
/// <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; } }
/// <summary> /// Call this to initialize a Behaviour with data supplied in a file. /// </summary> /// <param name="fileName">The file to load from.</param> public override void LoadContent(String fileName) { base.LoadContent(fileName); //ExampleDefinition def = GameObjectManager.pInstance.pContentManager.Load<ExampleDefinition>(fileName); // By default we have no target. mTarget = null; mSetActiveAnimationMsg = new SpriteRender.SetActiveAnimationMessage(); mSetDestinationMsg = new PathFind.SetDestinationMessage(); mSetSourceMsg = new PathFind.SetSourceMessage(); mGetCurrentBestNodeMsg = new PathFind.GetCurrentBestNodeMessage(); mClearDestinationMsg = new PathFind.ClearDestinationMessage(); mOnReachedPathEndMsg = new OnReachedPathEndMessage(); }