/// <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); mCurrentFollowType = FollowType.None; mExplodeDistanceSqr = 8 * 8; mBLineDistanceSqr = 40 * 40; mCloseRangeDistanceSqr = 88 * 88; mFrozenDistanceSqr = 160 * 160; mMoveSpeedPathFinding = 0.8f; mMoveSpeedDirectApproach = 0.5f; mMoveSpeedBLine = mMoveSpeedDirectApproach * 1.5f; mForceBLine = false; mBLineTimer = StopWatchManager.pInstance.GetNewStopWatch(); mBLineTimer.pLifeTime = 120.0f; mBLineTimer.pIsPaused = true; mBLineTimer.SetUpdatePass(MBHEngineContentDefs.BehaviourDefinition.Passes.DEFAULT); // Allocate these ahead of time to avoid triggering GC. mSetDestinationMsg = new PathFind.SetDestinationMessage(); mSetSourceMsg = new PathFind.SetSourceMessage(); mGetCurrentBestNodeMsg = new PathFind.GetCurrentBestNodeMessage(); mClearDestinationMsg = new PathFind.ClearDestinationMessage(); mDetonateMsg = new Explosive.DetonateMessage(); mIncrementScoreMsg = new PlayerScore.IncrementScoreMessage(); mSetActiveAnimMsg = new SpriteRender.SetActiveAnimationMessage(); mSetTargetObjectMsg = new PathFollow.SetTargetObjectMessage(); }
/// <summary> /// Constructor. /// </summary> public FSMStateGoToExtraction() { mSetActiveAnimationMsg = new SpriteRender.SetActiveAnimationMessage(); mSetDestinationMsg = new PathFind.SetDestinationMessage(); mSetSourceMsg = new PathFind.SetSourceMessage(); mGetCurrentBestNodeMsg = new PathFind.GetCurrentBestNodeMessage(); mGetExtractionPointMsg = new ZombieTaxi.Behaviours.FSMCivilian.GetExtractionPointMessage(); mIncrementScoreMsg = new PlayerScore.IncrementScoreMessage(); mIncrementScoreMsg.mAmount_In = 500; mClearDestinationMsg = new PathFind.ClearDestinationMessage(); mSetTargetObjectMsg = new PathFollow.SetTargetObjectMessage(); mSetStateMsg = new FiniteStateMachine.SetStateMessage(); }
/// <summary> /// Constructor. /// </summary> public FSMStateGoToStandingPosition() { mValidSafeHouses = new List <GameObject>(100); mSetActiveAnimationMsg = new SpriteRender.SetActiveAnimationMessage(); mSetDestinationMsg = new PathFind.SetDestinationMessage(); mSetSourceMsg = new PathFind.SetSourceMessage(); mGetCurrentBestNodeMsg = new PathFind.GetCurrentBestNodeMessage(); mClearDestinationMsg = new PathFind.ClearDestinationMessage(); mSetTargetObjectMsg = new PathFollow.SetTargetObjectMessage(); mSetStateMsg = new FiniteStateMachine.SetStateMessage(); mGetTileAtObjectMsg = new Level.GetTileAtObjectMessage(); mIncrementScoreMsg = new PlayerScore.IncrementScoreMessage(); mGetSafeHouseScoreMessage = new Behaviours.FSMCivilian.GetSafeHouseScoreMessage(); }
/// <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); FSMMedicDefinition def = GameObjectManager.pInstance.pContentManager.Load <FSMMedicDefinition>(fileName); AddState(new States.Common.FSMStateCower("Hide"), "Cower"); AddState(new States.Common.FSMStateFollowTarget("Run"), "Follow"); AddState(new States.Common.FSMStateStay(), "Stay"); AddState(new States.Common.FSMStateGoToStandingPosition(), "GoToStandingPosition"); AddState(new States.Common.FSMStateWaitAtStandingPosition("GameObjects\\Interface\\MedicPopup\\MedicPopup"), "WaitAtStandingPosition"); AddState(new States.Common.FSMStateDead(), "Dead"); AddState(new States.Common.FSMStateGoToExtraction(), "GoToExtraction"); AddState(new States.Common.FSMStateResearchStatBoost(), "ResearchStatBoost"); mParentGOH.pDirection.mSpeed = 0.5f; mSafeHouseScore = def.mSafeHouseScore; mClearDestinationMsg = new PathFind.ClearDestinationMessage(); }
/// <summary> /// Constructor. /// </summary> public FSMStateFollowTarget(String animationName) { mAnimationName = animationName; // We need to detect when the GameObject reaches a safe house and to do so we need // to do a collision check against all objects of a particular classification, in this // case "SAFE_HOUSE". We preallocate the two lists needed to do the check to avoid // triggering the GC. mSafeHouseInRange = new List <GameObject>(16); mSafeHouseClassifications = new List <GameObjectDefinition.Classifications>(); mSafeHouseClassifications.Add(GameObjectDefinition.Classifications.SAFE_HOUSE); mSetActiveAnimationMsg = new SpriteRender.SetActiveAnimationMessage(); mSetDestinationMsg = new PathFind.SetDestinationMessage(); mSetSourceMsg = new PathFind.SetSourceMessage(); mGetCurrentBestNodeMsg = new PathFind.GetCurrentBestNodeMessage(); mClearDestinationMsg = new PathFind.ClearDestinationMessage(); mIncrementScoreMsg = new PlayerScore.IncrementScoreMessage(); mSetTargetObjectMsg = new PathFollow.SetTargetObjectMessage(); mGetTileAtObjectMsg = new Level.GetTileAtObjectMessage(); mGetSafeHouseScoreMessage = new Behaviours.FSMCivilian.GetSafeHouseScoreMessage(); mSetStateMsg = new FiniteStateMachine.SetStateMessage(); }