public override void UpdateState(AI _owner) { /** * if (_owner.InSpotRangeFront() == true) * { * _owner.StopAndStare(); * //play a sound here! * }*/ if (_owner.InAttackRadius() == true) { _owner.stateMachine.ChangeState(FollowState.Instance); } //leave this state after you are unable to see the player //relook at this variable if (searchingTimer >= totalSearchingTimer && _owner.InSpotRangeFront() == false) { _owner.stateMachine.ChangeState(PatrolState.Instance); } //while ghost spots you if (_owner.InSpotRangeFront() == true) { detectionMeter += Time.deltaTime; searchingTimer = 0f; _owner.StopAndStare(); } //if you leave line of sight if (_owner.InSpotRangeFront() == false && searchingTimer <= totalSearchingTimer) { searchingTimer += Time.deltaTime; //Debug.Log("im searching"); //Debug.Log(searchingTimer); ghost.MoveAt(ghost.getPlayerPosition()); } //while you have exceeded the amount of staredown time if (detectionMeter >= totaldetectionMeter) { //Debug.Log("i think i see you"); //possible issue with moving forward //ghost.MoveAt(ghost.getPlayerPosition()); _owner.stateMachine.ChangeState(FollowState.Instance); } }
void ChasePlayer() { //GetDistance(); //TODO test and change if required ghost.MoveAt(ghost.getPlayerPosition()); }