Example #1
0
        private void UpdateActivity()
        {
            if (Time.time < this.m_NextUpdateActivityTime)
            {
                return;
            }
            float num  = 0f;
            bool  flag = this.m_Bounds.Contains(Player.Get().transform.position);
            bool  flag2;

            if (flag)
            {
                flag2 = true;
            }
            else
            {
                Vector3 vector = this.m_Bounds.ClosestPoint(Player.Get().transform.position);
                num   = vector.Distance(Player.Get().transform.position);
                flag2 = (num <= AIManager.Get().m_FishDeactivationRange);
            }
            if (flag2 && !base.gameObject.activeSelf)
            {
                this.Activate();
                if (this.m_Water == null)
                {
                    this.FindWater();
                }
            }
            else if (!flag2 && base.gameObject.activeSelf)
            {
                this.Deactivate();
            }
            this.m_NextUpdateActivityTime = Time.time + CJTools.Math.GetProportionalClamp(0.1f, 5f, num, AIManager.Get().m_FishDeactivationRange, AIManager.Get().m_FishDeactivationRange * 5f);
        }
Example #2
0
 protected override void OnDestroy()
 {
     base.OnDestroy();
     AIManager.Get().m_DeadBodies.Remove(this);
 }
Example #3
0
        private void OnHarvest()
        {
            AIParams aiparams = AIManager.Get().m_AIParamsMap[(int)this.m_AIID];

            Player.Get().DirtAddOnHarvest(aiparams.m_DirtAddOnHarvest);
        }
Example #4
0
 private void OnDestroy()
 {
     AIManager.Get().UnregisterSpawner(this);
 }
Example #5
0
 private bool CanSpawn()
 {
     return(!(AIManager.Get() == null) && !ScenarioManager.Get().IsDreamOrPreDream() && (!AI.IsCat(this.m_ID) || EnemyAISpawnManager.Get().CanSpawnPredator()) && DifficultySettings.IsAIIDEnabled(this.m_ID) && this.m_AICount < this.GetWantedAICount() && (!this.m_SpawnersGroup || this.m_SpawnersGroup.CanSpawnAI()));
 }
Example #6
0
 private void PlayDamageSound()
 {
     if (this.m_DamageAudioSource == null)
     {
         this.m_DamageAudioSource = base.gameObject.AddComponent <AudioSource>();
         this.m_DamageAudioSource.outputAudioMixerGroup = GreenHellGame.Instance.GetAudioMixerGroup(AudioMixerGroupGame.AI);
         this.m_DamageAudioSource.spatialBlend          = 1f;
         this.m_DamageAudioSource.rolloffMode           = AudioRolloffMode.Linear;
         this.m_DamageAudioSource.maxDistance           = 12f;
         this.m_DamageAudioSource.spatialize            = true;
     }
     this.m_DamageAudioSource.Stop();
     this.m_DamageAudioSource.clip = AIManager.Get().m_FleshHitSounds[UnityEngine.Random.Range(0, AIManager.Get().m_FleshHitSounds.Count)];
     this.m_DamageAudioSource.Play();
 }
Example #7
0
        public override void OnTakeDamage(DamageInfo info)
        {
            base.OnTakeDamage(info);
            AIManager.BloodFXType key  = (!info.m_DamageItem) ? AIManager.BloodFXType.Blunt : info.m_DamageItem.m_Info.m_BloodFXType;
            List <string>         list = AIManager.Get().m_BloodFXNames[(int)key];

            if (list.Count == 0)
            {
                DebugUtils.Assert("Missing blood fxes!", true, DebugUtils.AssertType.Info);
                return;
            }
            string text = list[UnityEngine.Random.Range(0, list.Count)];

            text += ((!this.m_AI.m_Params.m_Human && !this.m_AI.m_Params.m_BigAnimal) ? "_S" : "_M");
            Vector3 vector = Vector3.zero;

            if (this.m_AI.m_RagdollBones.Count > 0)
            {
                float num = float.MaxValue;
                foreach (Collider collider in this.m_AI.m_RagdollBones.Keys)
                {
                    Vector3 vector2 = collider.ClosestPoint(info.m_Position);
                    float   num2    = vector2.Distance(info.m_Position);
                    if (num2 < num)
                    {
                        vector = vector2;
                        Transform transform = collider.transform;
                        num = num2;
                    }
                }
            }
            else
            {
                vector = base.transform.position;
            }
            ParticlesManager.Get().Spawn(text, vector, Quaternion.LookRotation((Camera.main.transform.position - Camera.main.transform.right - vector).normalized), null);
            this.m_DamageAudioSource.Stop();
            this.m_DamageAudioSource.clip = AIManager.Get().m_FleshHitSounds[UnityEngine.Random.Range(0, AIManager.Get().m_FleshHitSounds.Count)];
            this.m_DamageAudioSource.Play();
        }