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); //Debug.Log("fsm.walkSpeed = " + fsm.walkSpeed); //播待行走动画 if (animationIsRun == false) { //fsm.PlayeAnimation(fsm.animParams.Walk); fsm.PlayeAnimation(fsm.animNames.Walk); animationIsRun = true; } }
public override void EnterState(BaseFSM fsm) { if (attackTime == 0) { attackTime = fsm.chStatus.attackSpeed; } fsm.PlayeAnimation(fsm.animParams.FightIdle); }
public override void EnterState(BaseFSM fsm) { //播放死亡动画 Debug.Log(fsm.animNames.Dead); Debug.Log(fsm.animNames.Idle); //fsm.PlayeAnimation(fsm.animNames.Dead); fsm.PlayeAnimation("Death"); }
public override void EnterState(BaseFSM fsm) { if (attackTime == 0) { attackTime = fsm.chStatus.attackSpeed; } fsm.PlayeAnimation(fsm.animNames.Stand); }
public override void Action(BaseFSM fsm) { //播放跑动画 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) { //播待机动画 if (animationIsRun == false) { //fsm.PlayeAnimation(fsm.animParams.Idle); fsm.PlayeAnimation(fsm.animNames.Idle); animationIsRun = true; } }
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) { if (animationIsRun == false) { fsm.PlayeAnimation(fsm.animNames.Run); animationIsRun = true; } //播放跑动画 if (fsm.targetPlayer != null && fsm.targetPlayer.gameObject != null) { fsm.MoveToTarget(fsm.targetPlayer.position, fsm.MoveSpeed, fsm.RotationSpeed); } }
public override void EnterState(BaseFSM fsm) { //播放死亡动画 fsm.PlayeAnimation(fsm.animParams.Dead); }
public override void Action(BaseFSM fsm) { //播待机动画 fsm.PlayeAnimation(fsm.animParams.Idle); }