// Constructor public WavePattern(Unit unit) { _unit = unit; seekBehavior = new SeekBehavior(_unit); pursuitBehavior = new PursuitBehavior(_unit); reachTargetState = new ReachTargetState(this, seekBehavior); attackTargetState = new AttackTargetState(this, seekBehavior); attackUnitState = new AttackUnitState(this, pursuitBehavior); currentState = reachTargetState; }
// Inicializace a nastaví počáteční stav void Start() { EnemyController controller = GetComponent <EnemyController>(); _followPathToTargetState = new FollowPathToTargetState(controller, this); _waitForNextActionState = new WaitForNextActionState(controller, this); _attackTargetState = new AttackTargetState(controller, this); _followTargetState = new FollowTargetState(controller, this); _walkToRandomPlaceState = new WalkToRandomPlaceState(controller, this); _faceRandomDirectionState = new FaceRandomDirectionState(controller, this); SetState(EnemyStateType.WaitForNextAction); _currentState.OnEntered(); }