protected void UpdateOnTarget() { bool target = Vector3.Distance(this._navMeshAgent.destination, this.transform.position) <= 1; if (target && !this.OnTarget) { if (!this.IsTargetOnSight()) { this._animator.SetTrigger("ReachTarget"); this._navMeshAgent.Stop(); this.StartCoroutine(CallbackHelper.WaitForSecondsAndCall(3, () => this._navMeshAgent.Resume())); } } this.OnTarget = target; }
protected void UpdateOnAlert() { bool alert = Vector3.Distance(this._finalTarget.transform.position, this.transform.position) <= Mathf.Max(this._alertDistance / 7, (this._alertDistance * this._finalTarget.GetComponent <AudioSource>().volume)); if (alert && !this.OnAlert) { this._animator.SetTrigger("Alert"); this._lastPositionSeen = this._finalTarget.transform.position; this.UpdateNavPointPositionToNearstPoint(); this._navMeshAgent.Stop(); this.StartCoroutine(CallbackHelper.WaitForSecondsAndCall(3, () => this._navMeshAgent.Resume())); } else if (!alert && this.OnAlert) { this.FadeUnitichanGhost(); } this.OnAlert = alert; }