public override void Action(BaseFSM fsm) { //判断是否到达路点 if (Vector3.Distance(fsm.transform.position, fsm.PatrolWayPoints[currentWayPointIndex].position) < arrivalDistance) { if (currentWayPointIndex == fsm.PatrolWayPoints.Length - 1) { if (fsm.patrolMode == PatrolMode.Once)//单程 { patrolComplete = true; currentWayPointIndex = 0; return; } //结束巡逻 else if (fsm.patrolMode == PatrolMode.PingPong) { Array.Reverse(fsm.PatrolWayPoints); } } //到 : 换下一个路点 currentWayPointIndex += 1; currentWayPointIndex = currentWayPointIndex % fsm.PatrolWayPoints.Length; } currentWayPoint = fsm.PatrolWayPoints[currentWayPointIndex]; fsm.MoveToTarget(currentWayPoint.position, fsm.walkSpeed, fsm.RotationSpeed, arrivalDistance); //播动画 fsm.PlayeAnimation(fsm.animParams.Walk); }
public override void EnterState(BaseFSM fsm) { fsm.StopMove(); if (attackTime == 0) { attackTime = fsm.chStatus.attackSpeed; } fsm.PlayeAnimation(fsm.animParams.FightIdle); }
public override void Action(BaseFSM fsm) { if (fsm.targetObject == null) { return; } //位移 //播放跑动画 if (fsm.targetPlayer != null && fsm.targetPlayer.gameObject != null) { fsm.PlayeAnimation(fsm.animParams.Run); fsm.MoveToTarget(fsm.targetPlayer.position, fsm.MoveSpeed, fsm.RotationSpeed); } }
public override void Action(BaseFSM fsm) { //计时等待 //计时时间到---攻击(使用技能) //盯住玩家 TransformHelper.LookAtTarget(fsm.targetPlayer.position - fsm.transform.position, fsm.transform, fsm.RotationSpeed); if (attackTime <= 0) { attackTime = fsm.chStatus.attackSpeed; fsm.PlayeAnimation(fsm.animParams.Attack); fsm.RandomAttack(); } attackTime -= Time.deltaTime; }
public override void Action(BaseFSM fsm) { //播待机动画 fsm.PlayeAnimation(fsm.animParams.Idle); }
public override void EnterState(BaseFSM fsm) { //播放死亡动画 fsm.PlayeAnimation(fsm.animParams.Dead); }