Пример #1
0
 private bool CanSetEnemy(Being being)
 {
     if (being.GetPlayerComponent <ReplicatedPlayerParams>().m_IsInSafeZone)
     {
         return(false);
     }
     if (being.GetPlayerComponent <ReplicatedPlayerParams>().m_IsDead)
     {
         return(false);
     }
     if (this.m_AI.IsHuman())
     {
         HumanAI humanAI = (HumanAI)this.m_AI;
         if ((humanAI.GetState() == HumanAI.State.Attack || humanAI.GetState() == HumanAI.State.StartWave) && this.m_AI.m_EnemyModule.m_Enemy == being)
         {
             return(true);
         }
     }
     if (this.m_AI.m_BleedingDamage > 0f)
     {
         return(true);
     }
     if (this.m_AI.m_SightModule && this.m_AI.m_SightModule.m_VisiblePlayers.Contains(being))
     {
         return(true);
     }
     if (this.m_AI.m_HearingModule && this.m_AI.m_HearingModule.m_Noise != null)
     {
         return(true);
     }
     if (this.m_AI.m_EnemySenseModule && this.m_AI.m_EnemySenseModule.m_Enemies.Contains(being))
     {
         return(true);
     }
     if (this.m_Enemy)
     {
         this.m_SafeDuration += Time.deltaTime;
         float safeDuration     = this.m_SafeDuration;
         float timeToLooseEnemy = this.m_TimeToLooseEnemy;
         return(false);
     }
     return(false);
 }
Пример #2
0
        private void UpdateEnemy()
        {
            if (this.m_AI.IsHuman())
            {
                HumanAI humanAI = (HumanAI)this.m_AI;
                if (humanAI.GetState() == HumanAI.State.Attack || humanAI.GetState() == HumanAI.State.StartWave)
                {
                    this.SetEnemy(true);
                    return;
                }
            }
            if (this.m_AI.m_SightModule && this.m_AI.m_SightModule.m_PlayerVisible)
            {
                this.SetEnemy(true);
                return;
            }
            bool flag = this.m_AI.m_HearingModule && this.m_AI.m_HearingModule.m_Noise != null;

            if (flag)
            {
                this.SetEnemy(true);
                return;
            }
            if (this.m_AI.m_EnemySenseModule && this.m_AI.m_EnemySenseModule.m_Enemy)
            {
                this.SetEnemy(true);
                return;
            }
            if (this.m_Enemy)
            {
                this.m_SafeDuration += Time.deltaTime;
                if (this.m_SafeDuration >= this.m_TimeToLooseEnemy)
                {
                    this.SetEnemy(false);
                }
            }
        }