void IMonsterState.Update() { float angle = 40; // should be a little less than field of view if (Vector3.Angle(player.transform.forward, monsterController.transform.position - player.transform.position) < angle) { if (currentState != ScareState.awaitingDialog) { monsterController.StartCoroutine(waitThenExecuteReaction()); } } // debug inputs should be replaced by microphone detection if (Input.GetKeyDown(KeyCode.P)) { this.monsterController.DoScare(); } if (Input.GetKeyDown(KeyCode.O)) { this.monsterController.DoLove(); } monsterController.CheckDistanceToPlayer(); if (Constants.phoneCallOver) { loopTimer += Time.deltaTime; if (loopTimer > listenLoop) { monsterController.StartRecording(2); loopTimer = 0; } } }
void IMonsterState.Update() { if (Vector3.Distance(monsterController.monsterNavAgent.destination, monsterController.transform.position) < 2.1f) { if (currentDestination.name != "Final") { monsterController.SwitchState(new MonsterIdleState(monsterController)); } else { Constants.isEndGame = true; monsterController.SwitchState(new MonsterEndGameState(monsterController)); } } // TODO Monster is still charging at the end of the game. if (currentDestination.name != "Final") { monsterController.CheckDistanceToPlayer(); } }