Esempio n. 1
0
 public override void EnterState(FSMBase fsm)
 {
     base.EnterState(fsm);
     idleTime = fsm.idleTimer;
     //播放待机动画
     //            fsm.animator.SetBool()
 }
Esempio n. 2
0
 public override void EnterState(FSMBase fsm)
 {
     base.EnterState(fsm);
     //人物移动类激活
     fsm.GetComponent <PlayerMovementKeys> ().enabled = true;
     //播放待机动画
     //            fsm.animator.SetBool()
 }
 public override void EnterState(FSMBase fsm)
 {
     base.EnterState(fsm);
     hurtedTime          = fsm.hurtedTimer;
     fsm.serachDistance *= 2;
     //播放待机动画
     //            fsm.animator.SetBool()
 }
Esempio n. 4
0
 public override void EnterState(FSMBase fsm)
 {
     base.EnterState(fsm);
     //设置速度
     fsm.characterStatus.SetMoveSpeed(fsm.runPercent);
     //播放待机动画
     //            fsm.animator.SetBool()
 }
 public override void ActionState(FSMBase fsm)
 {
     //倒计时
     hurtedTime -= Time.deltaTime;
     if (hurtedTime <= 0)
     {
         this.addMap(FSMTriggerID.DetectTarget, FSMStateID.Chase);
         this.addMap(FSMTriggerID.LostTarget, FSMStateID.Patrol);
     }
 }
Esempio n. 6
0
 public override void EnterState(FSMBase fsm)
 {
     base.EnterState(fsm);
     //死亡之后状态机禁用
     fsm.enabled = false;
     //播放待机动画
     fsm.animator.SetBool("IsDead", true);
     //            fsm.animator.SetBool()
     //            GameObject.Destroy (fsm.gameObject, 1f);
     fsm.Invoke("DeadDelay", 1f);
 }
Esempio n. 7
0
 public override void ActionState(FSMBase fsm)
 {
     if (Input.GetMouseButtonDown(0))
     {
         int id = 1001;
         fsm.skillSystem.AttackUseSkill(id);
     }
     if (Input.GetMouseButtonDown(1))
     {
     }
 }
Esempio n. 8
0
 public override void ActionState(FSMBase fsm)
 {
     base.EnterState(fsm);
     if (atkTime <= Time.time)
     {
         //不用播放动画,技能里有动画播放器
         fsm.skillSystem.UseRandomSkill();
         //攻击间隔
         atkTime = Time.time + fsm.attackInterval;
     }
 }
Esempio n. 9
0
 //检测当前状态的条件是否满足:满足就切换状态
 public void DetectTriggers(FSMBase fsm)
 {
     for (int i = 0; i < triggers.Count; i++)
     {
         //判断该条件是否满足
         if (triggers[i].HandleTrigger(fsm))
         {
             //从映射表中获得该条件的映射状态
             FSMStateID nextState = map[triggers[i].triggerID];
             //切换状态
             fsm.ChangeActiveState(nextState);
             return;
         }
     }
 }
Esempio n. 10
0
        public override void ActionState(FSMBase fsm)
        {
            base.ActionState(fsm);
            //不断更新抵达目标位置的路径表
            //获取位置
            List <PathNode> pathList = fsm.GetPath(fsm.targetTF.position);

            //如果有路径而且不为路径长度不为1(1为自身位置)
            if (pathList != null && pathList.Count > 1)
            {
                //移动方法的路径列表设置
                fsm.GetComponent <IMovePosition> ().SetPathList(pathList);
                //开始移动
                fsm.GetComponent <IMovePosition> ().PathMoving();
            }
        }
Esempio n. 11
0
        public override void EnterState(FSMBase fsm)
        {
            base.EnterState(fsm);

            //设置移动速度
            fsm.characterStatus.SetMoveSpeed(fsm.movePercent);

            //获取随机路径:自身初始位置,半径为搜索半径的圆圈内,最低需为1格
            Vector3         movePosition;
            List <PathNode> pathList = fsm.FindRandomPos(out movePosition);

            //设置路径位置
            fsm.SetPatrolPosition(movePosition);
            //移动方法的路径列表设置
            fsm.GetComponent <IMovePosition> ().SetPathList(pathList);

            //播放动画
            //            fsm.animator.SetBool()
        }
Esempio n. 12
0
 public override void ExitState(FSMBase fsm)
 {
     //人物移动类激活
     fsm.GetComponent <PlayerMovementKeys> ().enabled = false;
 }
Esempio n. 13
0
 //判断条件:周围有敌人
 public override bool HandleTrigger(FSMBase fsm)
 {
     //如果敌人的transform不为空(即周围有敌人,而且是最近的敌人)
     return(fsm.targetTF != null);
 }
Esempio n. 14
0
 public override void ExitState(FSMBase fsm)
 {
     //恢复计时器
     fsm.idleTimer = idleTime;
 }
Esempio n. 15
0
 public virtual void ActionState(FSMBase fsm)
 {
 }
 //判断条件:和目标位置的距离是否小于PATHDISTANCE
 public override bool HandleTrigger(FSMBase fsm)
 {
     //是否到达目标位置,最低距离:1f,因为grid的位置和实际距离有些差异,所以设置一个1f的可控范围
     return(Vector3.Distance(fsm.transform.position, fsm.patrolPosition) <= 1f);
 }
Esempio n. 17
0
 public override void ExitState(FSMBase fsm)
 {
     //停止移动
     fsm.GetComponent <IMovePosition> ().StopPosition();
 }
 //判断条件:是否被攻击了
 public override bool HandleTrigger(FSMBase fsm)
 {
     //isHurted是否为true
     return(fsm.characterStatus.data.textureTime > 0);
 }
Esempio n. 19
0
 //逻辑处理
 public abstract bool HandleTrigger(FSMBase fsm);
Esempio n. 20
0
 public virtual void ExitState(FSMBase fsm)
 {
 }
Esempio n. 21
0
 //判断条件:当前生命值是否小于0
 public override bool HandleTrigger(FSMBase fsm)
 {
     //生命值是否小于0
     return(fsm.characterStatus.data.health <= 0);
 }
 //判断条件:敌人的距离超出攻击范围
 public override bool HandleTrigger(FSMBase fsm)
 {
     //敌人和自身距离大于攻击范围
     return(Vector3.Distance(fsm.transform.position, fsm.targetTF.position) > fsm.attackDistance);
 }
Esempio n. 23
0
 public override void ActionState(FSMBase fsm)
 {
     fsm.idleTimer -= Time.deltaTime;
 }
Esempio n. 24
0
 public override void ActionState(FSMBase fsm)
 {
     //开始移动
     fsm.GetComponent <IMovePosition> ().PathMoving();
 }
Esempio n. 25
0
 //为具体类提供可选实现
 public virtual void EnterState(FSMBase fsm)
 {
 }
Esempio n. 26
0
 //判断条件:闲置时间是否完成
 public override bool HandleTrigger(FSMBase fsm)
 {
     //idle计时器是否<=0
     return(fsm.idleTimer < 0);
 }
Esempio n. 27
0
 public override void ExitState(FSMBase fsm)
 {
     //删除映射
     ClearAll();
 }