public override void OnEnter(CombatEvent Event) { if (Fsm.Master.IsStatic) { Fsm.ChangeToIdleState(); return; } BeginPos_ = Fsm.Master.Position; EndPos_ = (Event as NpcWalkEvent).TargetPos; MoveTime_ = 0; MoveTotalTime_ = (EndPos_ - BeginPos_).magnitude / Fsm.Master.CalcFinalAttr(NpcAttrIndex.Speed); IsMove_ = true; Fsm.Master.Actor.PlayAnimation("Walk", true); Fsm.Master.Actor.SetDirection(CombatHelper.CalcDirection(BeginPos_, EndPos_)); }
public void FaceToPosition(Vector2 TargetPosition) { SetDirection(CombatHelper.CalcDirection(Master.Position, TargetPosition)); }