Пример #1
0
        public override void Enter()
        {
            base.Enter();
            DebugMsg.Log("进入警戒状态");

            OnComplete();
        }
Пример #2
0
 public override void Enter()
 {
     base.Enter();
     DebugMsg.Log("进入战斗待机状态");
     _time = 0;
     SetAgentState(KeyNameEnum.NEAR_ENEMY, false);
 }
Пример #3
0
        public void UpdateData()
        {
            //检测是否需要重新制定计划
            //当前计划是否完成
            if (planHandler.IsComplete)
            {
                DebugMsg.Log("制定新计划");
                BuildPlanAndStart();
            }

            //制定计划并开始计划
            void BuildPlanAndStart()
            {
                if (goalManager.CurrentGoal != null)
                {
                    DebugMsg.Log("----------------新的目标:" + goalManager.CurrentGoal.Label.ToString());
                }
                //若目标完成则重新寻找目标
                var plan = planner.BuildPlan(goalManager.CurrentGoal);

                if (plan != null && plan.Count > 0)
                {
                    planHandler.Init(actionManager, plan);
                    planHandler.HandlerAction();
                    actionManager.IsPerformAction = true;
                }
            }
        }
Пример #4
0
 public override void Enter()
 {
     base.Enter();
     DebugMsg.Log("进入移动状态");
     _self       = (Transform)_agent.Maps.GetGameData(DataName.SELF_TRANS);
     _enemy      = (Transform)_agent.Maps.GetGameData(DataName.ENEMY_TRANS);
     _controller = _self.GetComponent <CharacterController>();
 }
Пример #5
0
        public async override void Enter()
        {
            DebugMsg.Log("进入受伤状态");
            //模拟受伤状态的延时时间
            await Task.Delay(TimeSpan.FromSeconds(2));

            OnComplete();
        }
Пример #6
0
 public void UpdateData()
 {
     if (WhetherToReplan())
     {
         DebugMsg.Log("制定新计划");
         BuildPlanAndStart();
     }
 }
Пример #7
0
 //计划完成了当前动作
 private void PlanActionComplete(TAction actionLabel)
 {
     DebugMsg.Log("下一步");
     if (_planHandler.GetCurrentHandler().Label.ToString() == actionLabel.ToString())
     {
         _planHandler.NextAction();
     }
 }
Пример #8
0
 public override void Execute()
 {
     base.Execute();
     if (_time < 2)
     {
         _time += Time.fixedDeltaTime;
     }
     else
     {
         DebugMsg.Log("战斗待机状态完成");
         OnComplete();
     }
 }
Пример #9
0
        public void UpdateData()
        {
            if (_agent.IsAgentOver)
            {
                return;
            }

            if (WhetherToReplan())
            {
                DebugMsg.Log("制定新计划");
                BuildPlanAndStart();
            }
        }
Пример #10
0
        //制定计划并开始计划
        private void BuildPlanAndStart()
        {
            if (_goalManager.CurrentGoal != null)
            {
                DebugMsg.Log("----------------新的目标:" + _goalManager.CurrentGoal.Label.ToString());
            }
            //若目标完成则重新寻找目标
            var plan = _planner.BuildPlan(_goalManager.CurrentGoal);

            if (plan != null && plan.Count > 0)
            {
                _planHandler.Init(_actionManager, plan);
                _planHandler.StartPlan();
                _actionManager.IsPerformAction = true;
            }
        }
Пример #11
0
        public override void Enter()
        {
            DebugMsg.Log("进入受伤状态:" + Label);
            int       injureValue = GetGameDataValue <int>(GameDataKeyEnum.INJURE_VALUE);
            EnemyData data        = GetGameData <EnemyData>(GameDataKeyEnum.CONFIG);

            data.Life = data.Life - injureValue;
            isDead    = data.Life <= 0;
            if (isDead)
            {
                SetAgentState(StateKeyEnum.IS_DEAD, true);
            }
            else
            {
                base.Enter();
            }
        }
Пример #12
0
 public Performer(IAgent <TAction, TGoal> agent)
 {
     planHandler = new PlanHandler <TAction>();
     planHandler.AddCompleteCallBack(() =>
     {
         //计划完成
         DebugMsg.Log("计划完成");
         actionManager.IsPerformAction = false;
     });
     planner       = new Planner <TAction, TGoal>(agent);
     goalManager   = agent.GoalManager;
     actionManager = agent.ActionManager;
     actionManager.AddActionCompleteListener((actionLabel) =>
     {
         //计划完成了当前动作
         DebugMsg.Log("下一步");
         if (planHandler.GetCurrentHandler().Label.ToString() == actionLabel.ToString())
         {
             planHandler.HandlerAction();
         }
     });
 }
Пример #13
0
 public override void Enter()
 {
     base.Enter();
     DebugMsg.Log("进入警戒状态");
     _data = GetGameData <GameDataKeyEnum, EnemyData>(GameDataKeyEnum.CONFIG);
 }
Пример #14
0
 //计划完成
 private void PlanComplete()
 {
     DebugMsg.Log("计划完成");
     _actionManager.IsPerformAction = false;
 }
Пример #15
0
 public override void Exit()
 {
     DebugMsg.Log("退出警戒状态");
 }
Пример #16
0
 public override void Enter()
 {
     base.Enter();
     DebugMsg.Log("进入待机状态");
 }
Пример #17
0
 public void Interruptible()
 {
     DebugMsg.Log("打断计划");
     planHandler.Interruptible();
 }
Пример #18
0
 public override void Exit()
 {
     base.Exit();
     DebugMsg.Log("退出战斗待机状态");
 }
Пример #19
0
 public override void Enter()
 {
     base.Enter();
     DebugMsg.Log("进入攻击待机状态");
     CreateTimer(Const.IDLE_SWORD_DELAY_TIME);
 }