private EnemyBehaviorStateS[] GetBehaviorStates() { EnemyBehaviorStateS[] states = new EnemyBehaviorStateS[behaviorStates.Count]; int i = 0; foreach (GameObject bStateHolder in behaviorStates) { states[i] = bStateHolder.GetComponent <EnemyBehaviorStateS>(); i++; } return(states); }
private void CheckStates() { if (!_isDead) { behaviorSet = false; foreach (EnemyBehaviorStateS bState in _behaviorStates) { if (bState.isActive() && !behaviorSet) { stateToChangeTo = bState; behaviorSet = true; if (debugState) { Debug.Log("Switch to " + bState.stateName); } } } if (stateToChangeTo != null) { if (_currentState == null) { ChangeBehaviorState(stateToChangeTo); } else { if (_currentState != stateToChangeTo) { ChangeBehaviorState(stateToChangeTo); } else { _currentState.NextBehavior(); } } } } }
private void ChangeBehaviorState(EnemyBehaviorStateS newState) { _currentState = newState; _currentState.StartActions(); }
public void ForceBehaviorState(EnemyBehaviorStateS newState) { _currentBehavior.EndAction(); _currentState = newState; }
public virtual void SetState(EnemyBehaviorStateS myState) { myBehaviorState = myState; }