Exemple #1
0
 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> ();
    }
Exemple #3
0
    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());
    }
Exemple #4
0
 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;
     }
 }