// Update is called once per frame void Update() { if (listholder != null) { listholder = list.GetComponent <EnemiesInRange>().triggerList; } if (money >= 100) { SceneManager.LoadScene(3); } if (behaveState == PlayerbehavourState.Suspicious) { if (listholder != null) { for (int i = 0; i != listholder.Count; i++) { if (listholder[i].GetComponent <Ghost>().spiritState == Ghost.SpiritState.Suspicious || listholder[i].GetComponent <Ghost>().spiritState == Ghost.SpiritState.Attack) { numofAngryGhosts++; } } if (numofAngryGhosts == 0) { time += Time.deltaTime; if (time >= timeToHide) { behaveState = PlayerbehavourState.Hidden; time = 0; } } } } }
public void isSuspicious() { behaveState = PlayerbehavourState.Suspicious; time = 0.0f; }
void Start() { playerState = PlayerState.Idle; behaveState = PlayerbehavourState.Hidden; }