private void OnDeath() { if (m_bDeathTriggered == false) { m_bDeathTriggered = true; GetAnimator().SetBool("Investigate", false); GetAnimator().SetBool("Attack", false); GetAnimator().SetBool("Moving", false); GetAIAttack().Cleanup(); if (m_SmokeVFX != null) { m_SmokeVFX.Cleanup(); } TryResetPath(); if (GetAgent().enabled == true) { GetAgent().isStopped = true; GetAgent().enabled = false; } Destroy(GetAgent()); CAIManager.RemoveAI_BothLists(this); CAIManager.RemoveFromCombatList(this); CAIManager.RemoveFromInvestigateList(this); } else { m_fDeathTimer += Time.deltaTime; if (m_fDeathTimer > m_fDestroyAfterDuration) { Destroy(gameObject); } } }
//for setting combat to false slowly based on CSenses.m_fTimeToLoseSight variable public bool LoseCombatSlowly( ) { m_fLoseSightTimer -= Time.deltaTime; if (m_fLoseSightTimer < 0.0f) { m_fLoseSightTimer = m_Senses.GetTimeUntilLoseSight(); m_bCombat = false; CAIManager.RemoveFromCombatList(this); return(true); } return(false); }