Beispiel #1
0
            public override void OnExcuteWithEvent(OrdinaryEnemyChase fsm)
            {
                var dir = chasePoint - fsm.top.mov.Position;

                fsm.velocity = dir.normalized * GetSpeed(fsm);
                if (dir.magnitude < 0.1f || timer.Value == 1)
                {
                    fsm.ChangeState(GetNextState());
                }
            }
Beispiel #2
0
            public override void OnExcuteWithEvent(OrdinaryEnemyChase fsm)
            {
                Vector2 chasePoint = fsm.chaseState.chaseTarget.transform.position;
                var     dir        = chasePoint - fsm.top.mov.Position;

                fsm.velocity = dir.normalized * fsm.top.slowSpeed;
                if (timer.Value == 1)
                {
                    fsm.ChangeState <FastState>(null);
                }
            }