void Start() { Player = GameObject.FindGameObjectWithTag("Player"); currentState = FearState.NotScared; fearAmount = 0f; fillAmount = 0f; }
protected void Awake() { idleState = new IdleState(this); huntState = new HuntState(this); fearState = new FearState(this); engageState = new EngageState(this); counterState = new CounterState(this); nav = GetComponent<NavMeshAgent> (); }
private void fearManager() { currentFear += Time.deltaTime * scareInc; if (currentFear > 0.0f && currentFear - Time.deltaTime * scareDec > 0.0f) { currentFear -= Time.deltaTime * scareDec; } else { currentFear = 0.0f; } FearMeter.updateMeter(currentFear / MAXFEAR); FearState.updateFearState(scaredState.ToString()); }
void UpdateFearState() { if (fillAmount == 0) { currentState = FearState.NotScared; } else if (fillAmount <= 0.25f && fillAmount > 0f) { currentState = FearState.NotTooScared; } else if (fillAmount > 0.25f && fillAmount <= 0.5f) { currentState = FearState.LittleScared; } else if (fillAmount > 0.5f && fillAmount <= 0.75f) { currentState = FearState.ModeratelyScared; } else if (fillAmount > 0.75f && fillAmount <= 1.0f) { currentState = FearState.VeryScared; } }