示例#1
0
        /// <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();
        }
示例#2
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public FSMStatePatrol()
 {
     mSetTargetObjectMsg    = new PathFollow.SetTargetObjectMessage();
     mGetTileAtPositionMsg  = new Level.GetTileAtPositionMessage();
     mSetDestinationMsg     = new PathFind.SetDestinationMessage();
     mSetSourceMsg          = new PathFind.SetSourceMessage();
     mSetActiveAnimationMsg = new SpriteRender.SetActiveAnimationMessage();
     mSetStateMsg           = new FiniteStateMachine.SetStateMessage();
 }
 /// <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>
        /// Constructor.
        /// </summary>
        public FSMStateRepair()
        {
            mDamagedTiles        = new List <Level.Tile>(16);
            mFoundTileObjects    = new List <GameObject>(1);
            mTileClassifications = new List <GameObjectDefinition.Classifications>(1);
            mTileClassifications.Add(GameObjectDefinition.Classifications.WALL);

            mSetTargetObjectMsg    = new PathFollow.SetTargetObjectMessage();
            mGetTileAtPositionMsg  = new Level.GetTileAtPositionMessage();
            mSetDestinationMsg     = new PathFind.SetDestinationMessage();
            mSetSourceMsg          = new PathFind.SetSourceMessage();
            mSetActiveAnimationMsg = new SpriteRender.SetActiveAnimationMessage();
            mSetStateMsg           = new FiniteStateMachine.SetStateMessage();
            mGetHealthMsg          = new Health.GetHealthMessage();
            mSetTileToRepairMsg    = new FSMEngineer.SetTileToRepairMessage();
        }
        /// <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();
        }