public void CheckForCombat() { if (CheckLocalVision() || tm.visibleEnemies.Count > 0) { currentState = attackState; //attack priority moved to attackState } }
//called by strategy when switching from ai -> player public void ResetOnSwitch() { targetedEnemy = null; currentState = idleState; StopAllCoroutines(); navMeshAgent.speed = navSpeedDefault; if (abilities != null) { activeSpecialAbility = null; } }
private IEnumerator DefendRoutine(float delay) { currentState = defendState; yield return(new WaitForFixedUpdate()); currentState = defendState; yield return(new WaitForFixedUpdate()); navMeshAgent.Resume(); yield return(new WaitForSeconds(delay)); if (currentState == defendState) { currentState = idleState; } }
// Use this for initialization void Start() { currentState = idleState; }