public override void OnExcuteWithEvent(OrdinaryEnemyTop fsm) { fsm.Velocity = Vector2.zero; if (fsm.ChaseProcess()) { return; } if (!fsm.InRadius(0.2f)) { fsm.ChangeState <ReturnState>(null); } }
public override void OnExcuteWithEvent(OrdinaryEnemyTop fsm) { if (fsm.ChaseProcess()) { return; } if (path.Finished) { fsm.ChangeState <HomeState>(null); return; } Vector2 dir = path.GetDir(); float dis = (fsm.mov.Position - fsm.originPos).magnitude; float speed = fsm.returnDistanceSpeedCurve.Evaluate(dis); fsm.mov.Velocity = dir.normalized * speed; }
public OrdinaryEnemyChase(OrdinaryEnemyTop top, ChaseState chaseState) { this.top = top; this.chaseState = chaseState; }
public override void OnExitWithEvent(OrdinaryEnemyTop fsm) { fsm.chase = null; }
public override void OnExcuteWithEvent(OrdinaryEnemyTop fsm) { fsm.chase.Update(); }
public override void OnEnterWithEvent(OrdinaryEnemyTop fsm) { fsm.chase = new OrdinaryEnemyChase(fsm, this); fsm.chase.ChangeState <OrdinaryEnemyChase.SlowState>(null); }
public override void OnEnterWithEvent(OrdinaryEnemyTop fsm) { nevMap = fsm.returnNevMap; path = nevMap.CreatePath(() => fsm.mov.Position, fsm.originPos); }