// Start is called before the first frame update protected override void Start() { base.Start(); BehaviourMap mapping = GetComponent <BehaviourMap>(); mapping.behaviourMap.Add(UnitController.TargetType.Enemy, GetType()); animator = GetComponent <Animator>(); state = AttackUnitState.DEFENDING; }
private void ChangeState(AttackUnitState toState) { if (currentRoutine != null) { StopCoroutine(currentRoutine); currentRoutine = null; } animator.SetBool("Attacking", false); target = null; state = toState; }
// 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; }