public void setMinAlertState(ALERTSTATE alState) { if (alState > alertState) { alertState = alState; alertnessMin = alertnessStep * (int)alState; alertness = alertnessMin; } }
void Awake() { if (nonPlayerMode) { Debug.Log("Enemy E" + enemyIndex.ToString() + " has no Player object; continuing in non-Player-mode"); } alertnessMax = alertnessStep * (int)ALERTSTATE.ALERTNESS2; senseState = SENSESTATE.NONE; alertState = ALERTSTATE.NONE; taskState = TASKSTATE.NONE; }
// is called from a Sense script public void senseTrigger(float fac) { alertness += fac * Time.deltaTime; if (alertness >= alertnessStep * (int)ALERTSTATE.ALERTNESS1 && alertState < ALERTSTATE.ALERTNESS1) { alertnessMin = alertnessStep * (int)ALERTSTATE.ALERTNESS1; alertState = ALERTSTATE.ALERTNESS1; } if (alertness > alertnessMax) { alertState = ALERTSTATE.ALERTNESS2; alertness = alertnessMax; } }