Example #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("enemyCollide"))
     {
         mutantHitReceiver component = other.GetComponent <mutantHitReceiver>();
         if (component)
         {
             component.forceEnemyStop();
         }
     }
 }
Example #2
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("enemyCollide") || other.gameObject.CompareTag("Player") || other.gameObject.CompareTag("animalCollide"))
     {
         if (other.gameObject.CompareTag("enemyCollide"))
         {
             mutantHitReceiver component = other.transform.GetComponent <mutantHitReceiver>();
             if (component && component.inNooseTrap)
             {
                 Debug.Log("target is already in a trap");
                 return;
             }
         }
         if (!this.disable)
         {
             if (this.trigger.largeSpike)
             {
                 other.gameObject.SendMessageUpwards("setTrapLookat", base.transform.root.gameObject, SendMessageOptions.DontRequireReceiver);
                 base.gameObject.SendMessage("addTrappedMutant", other.transform.root.gameObject, SendMessageOptions.DontRequireReceiver);
                 other.gameObject.SendMessageUpwards("setCurrentTrap", this.trigger.gameObject, SendMessageOptions.DontRequireReceiver);
             }
             if (this.trigger.largeSwingingRock)
             {
                 if (this.rb.velocity.magnitude > 9f)
                 {
                     other.gameObject.SendMessageUpwards("Explosion", 11, SendMessageOptions.DontRequireReceiver);
                     other.gameObject.SendMessage("lookAtExplosion", base.transform.position, SendMessageOptions.DontRequireReceiver);
                     other.gameObject.SendMessageUpwards("DieTrap", this.trapType, SendMessageOptions.DontRequireReceiver);
                 }
             }
             else
             {
                 other.gameObject.SendMessageUpwards("DieTrap", this.trapType, SendMessageOptions.DontRequireReceiver);
             }
             if (!this.disable && !this.trigger.largeSwingingRock)
             {
                 base.Invoke("disableCollision", 0.05f);
             }
         }
     }
 }
Example #3
0
    private void OnTriggerEnter(Collider other)
    {
        bool flag = this.rabbitTrap || this.fishTrap;

        if ((other.gameObject.CompareTag("Player") || other.gameObject.CompareTag("enemyCollide")) && !flag && !this.sprung)
        {
            if (other.gameObject.CompareTag("enemyCollide"))
            {
                mutantHitReceiver component  = other.transform.GetComponent <mutantHitReceiver>();
                netId             component2 = other.transform.GetComponent <netId>();
                if (component && component.inNooseTrap)
                {
                    return;
                }
                if (component2)
                {
                    return;
                }
                Animator componentInChildren = other.transform.root.GetComponentInChildren <Animator>();
                if (componentInChildren)
                {
                    if (!componentInChildren.enabled)
                    {
                        return;
                    }
                    if (componentInChildren.GetBool("deathfinalBOOL"))
                    {
                        return;
                    }
                    if (componentInChildren.GetBool("sleepBOOL"))
                    {
                        return;
                    }
                }
            }
            if (this.MpClientCheck)
            {
                if (other.gameObject.CompareTag("Player"))
                {
                    TriggerLargeTrap triggerLargeTrap = global::TriggerLargeTrap.Create(GlobalTargets.OnlyServer);
                    triggerLargeTrap.Player = LocalPlayer.Entity;
                    triggerLargeTrap.Trap   = this.entity;
                    triggerLargeTrap.Send();
                    this.TriggerLargeTrap(null);
                }
            }
            else
            {
                if (this.MpHostCheck && this.entity && this.entity.isAttached && this.entity.StateIs <ITrapLargeState>())
                {
                    this.entity.GetState <ITrapLargeState>().Sprung = true;
                }
                this.TriggerLargeTrap(other);
            }
        }
        if (this.MpClientCheck)
        {
            return;
        }
        if ((this.rabbitTrap && (other.gameObject.CompareTag("animalCollide") || other.gameObject.CompareTag("enemyCollide"))) || (this.fishTrap && other.gameObject.CompareTag("Fish")))
        {
            bool flag2 = false;
            if (flag && !base.transform.parent.gameObject.CompareTag("trapSprung"))
            {
                this.trappedGo = other.gameObject;
                other.gameObject.SendMessageUpwards("setTrapped", base.gameObject, SendMessageOptions.DontRequireReceiver);
                base.transform.parent.gameObject.tag = "trapSprung";
                this.TriggerRabbitTrap();
                if (this.MpHostCheck && this.entity && this.entity.isAttached && this.entity.StateIs <ITrapRabbitState>())
                {
                    this.entity.GetState <ITrapRabbitState>().Sprung = true;
                }
            }
            animalType component3 = other.GetComponent <animalType>();
            if (component3 && component3.deer && this.largeDeadfall)
            {
                if (this.hitbox)
                {
                    this.hitbox.SetActive(true);
                }
                this.CheckAnimReference();
                this.anim.GetComponent <Animation>().Play("trapFall");
                flag2 = true;
                base.Invoke("enableTrapReset", 3f);
            }
            if (flag2)
            {
                this.PlayTriggerSFX();
            }
        }
    }
Example #4
0
 private void registerTrapHit(Collider other)
 {
     if (other.GetComponent <creepyHitReactions>() && !this.disable && this.trigger.largeSpike)
     {
         this.sendCreepyDamageFromRoot(other);
         if (!this.disable)
         {
             base.Invoke("disableCollision", 0.8f);
         }
         return;
     }
     if (other.gameObject.CompareTag("enemyCollide") || other.gameObject.CompareTag("playerHitDetect") || other.gameObject.CompareTag("Player") || other.gameObject.CompareTag("animalCollide"))
     {
         if (other.gameObject.CompareTag("enemyCollide"))
         {
             mutantHitReceiver component = other.transform.GetComponent <mutantHitReceiver>();
             if (component && component.inNooseTrap)
             {
                 return;
             }
             explodeDummy component2 = other.GetComponent <explodeDummy>();
             if (component2)
             {
                 return;
             }
         }
         if (!this.disable)
         {
             if (this.trigger.largeSpike)
             {
                 other.gameObject.SendMessageUpwards("setTrapLookat", base.transform.root.gameObject, SendMessageOptions.DontRequireReceiver);
                 base.gameObject.SendMessage("addTrappedMutant", other.transform.root.gameObject, SendMessageOptions.DontRequireReceiver);
                 other.gameObject.SendMessageUpwards("setCurrentTrap", this.trigger.gameObject, SendMessageOptions.DontRequireReceiver);
                 this.sendCreepyDamage(other);
                 if (other.gameObject.CompareTag("Player"))
                 {
                     other.gameObject.SendMessage("HitFromTrap", 35, SendMessageOptions.DontRequireReceiver);
                 }
             }
             else if (this.trigger.largeDeadfall)
             {
                 if (other.gameObject.CompareTag("playerHitDetect"))
                 {
                     other.gameObject.SendMessageUpwards("HitFromTrap", 35, SendMessageOptions.DontRequireReceiver);
                 }
                 if (other.gameObject.CompareTag("enemyCollide"))
                 {
                     this.sendCreepyDamage(other);
                 }
             }
             if (this.trigger.largeSwingingRock)
             {
                 if (this.rb.velocity.magnitude > 11f)
                 {
                     other.gameObject.SendMessageUpwards("Explosion", -1, SendMessageOptions.DontRequireReceiver);
                     other.gameObject.SendMessage("lookAtExplosion", base.transform.position, SendMessageOptions.DontRequireReceiver);
                     other.gameObject.SendMessageUpwards("DieTrap", this.trapType, SendMessageOptions.DontRequireReceiver);
                 }
             }
             else
             {
                 other.gameObject.SendMessageUpwards("DieTrap", this.trapType, SendMessageOptions.DontRequireReceiver);
                 if (other.gameObject.CompareTag("enemyCollide") && this.trigger.largeSpike)
                 {
                     Vector3 vector = this.PutOnSpikes(other.transform.root.gameObject);
                     other.gameObject.SendMessageUpwards("setPositionAtSpikes", vector, SendMessageOptions.DontRequireReceiver);
                 }
             }
             if (!this.disable && !this.trigger.largeSwingingRock)
             {
                 base.Invoke("disableCollision", 0.8f);
             }
         }
     }
 }
Example #5
0
    public void TriggerLargeTrap(Collider other)
    {
        if (this.MpClientCheck && other == null && this.largeNoose)
        {
            base.Invoke("switchNooseRope", 0.5f);
            this.cutTrigger.SetActive(true);
            this.animator.enabled = true;
            this.animator.SetIntegerReflected("direction", 0);
            this.animator.SetBoolReflected("trapSpringBool", true);
        }
        if (this.sprung)
        {
            return;
        }
        this.CheckAnimReference();
        bool flag = !BoltNetwork.isRunning || this.MpHostCheck;

        if (this.hitbox)
        {
            this.hitbox.SetActive(true);
        }
        if (this.largeSwingingRock)
        {
            this.cutRope.SetActive(false);
            this.swingingRock.SendMessage("enableSwingingRock");
            base.Invoke("enableTrapReset", 3f);
        }
        if (this.largeDeadfall)
        {
            this.anim.GetComponent <Animation>().Play("trapFall");
            base.Invoke("enableTrapReset", 3f);
        }
        if (this.largeSpike)
        {
            this.anim.GetComponent <Animation>().Play("trapSpring");
            this.spikeTrapBlockerGo.SetActive(true);
            if (flag && other)
            {
                other.gameObject.SendMessageUpwards("enableController", SendMessageOptions.DontRequireReceiver);
                if (other.gameObject.CompareTag("enemyCollide"))
                {
                    this.mutantSetup = other.transform.root.GetComponentInChildren <mutantScriptSetup>();
                    if (this.mutantSetup && !this.mutantSetup.ai.creepy && !this.mutantSetup.ai.creepy_male && !this.mutantSetup.ai.creepy_fat && !this.mutantSetup.ai.creepy_baby)
                    {
                        other.gameObject.SendMessageUpwards("setCurrentTrap", base.gameObject, SendMessageOptions.DontRequireReceiver);
                    }
                }
            }
            base.Invoke("enableTrapReset", 3f);
        }
        if (this.largeNoose)
        {
            if (flag && other)
            {
                if (base.transform.InverseTransformPoint(other.transform.position).x > 0f)
                {
                    this.animator.SetIntegerReflected("direction", 0);
                }
                else
                {
                    this.animator.SetIntegerReflected("direction", 1);
                }
                other.gameObject.SendMessageUpwards("setFootPivot", this.nooseFootPivot, SendMessageOptions.DontRequireReceiver);
                if (other.gameObject.CompareTag("enemyCollide"))
                {
                    mutantHitReceiver component = other.transform.GetComponent <mutantHitReceiver>();
                    if (component)
                    {
                        component.inNooseTrap = true;
                    }
                    this.mutantSetup = other.transform.root.GetComponentInChildren <mutantScriptSetup>();
                }
                this.animator.enabled = true;
                this.animator.SetBoolReflected("trapSpringBool", true);
                if (this.mutantSetup)
                {
                    if (!this.mutantSetup.ai.creepy && !this.mutantSetup.ai.creepy_male && !this.mutantSetup.ai.creepy_fat && !this.mutantSetup.ai.creepy_baby)
                    {
                        other.gameObject.SendMessageUpwards("setInNooseTrap", this.noosePivot);
                    }
                    other.gameObject.SendMessageUpwards("setCurrentTrap", base.gameObject);
                }
            }
            if (other)
            {
                other.gameObject.SendMessageUpwards("DieTrap", 2, SendMessageOptions.DontRequireReceiver);
            }
            base.Invoke("switchNooseRope", 0.5f);
            this.cutTrigger.SetActive(true);
            if (this.entity.IsOwner() && this.largeNoose)
            {
                this.entity.GetState <ITrapLargeState>().CanCutDown = true;
                this.entity.GetState <ITrapLargeState>().CanReset   = false;
            }
            if (other && (other.gameObject.CompareTag("Player") || other.gameObject.CompareTag("PlayerNet")))
            {
                base.Invoke("enableTrapReset", 2f);
            }
        }
        if (this.hitbox)
        {
            base.Invoke("disableHitbox", 1.5f);
        }
        base.transform.GetComponent <Collider>().enabled = false;
        this.sprung = true;
        this.PlayTriggerSFX();
    }
Example #6
0
 private void doAwake()
 {
     if (this.disableAiForDebug)
     {
         this.disableForDebug();
     }
     this.allFSM = base.gameObject.GetComponents<PlayMakerFSM>();
     PlayMakerFSM[] array = this.allFSM;
     for (int i = 0; i < array.Length; i++)
     {
         PlayMakerFSM playMakerFSM = array[i];
         if (playMakerFSM.FsmName == "action_combatFSM")
         {
             this.pmCombat = playMakerFSM;
             this.actionFSM.Add(playMakerFSM);
         }
         if (playMakerFSM.FsmName == "action_inTreeFSM")
         {
             this.pmTree = playMakerFSM;
             this.actionFSM.Add(playMakerFSM);
         }
         if (playMakerFSM.FsmName == "global_visionFSM")
         {
             this.pmVision = playMakerFSM;
         }
         if (playMakerFSM.FsmName == "action_searchFSM")
         {
             this.pmSearch = playMakerFSM;
             this.actionFSM.Add(playMakerFSM);
         }
         if (playMakerFSM.FsmName == "action_stalkingFSM")
         {
             this.pmStalk = playMakerFSM;
             this.actionFSM.Add(playMakerFSM);
         }
         if (playMakerFSM.FsmName == "global_motorFSM")
         {
             this.pmMotor = playMakerFSM;
         }
         if (playMakerFSM.FsmName == "action_sleepingFSM")
         {
             this.pmSleep = playMakerFSM;
             this.actionFSM.Add(playMakerFSM);
         }
         if (playMakerFSM.FsmName == "global_brainFSM")
         {
             this.pmBrain = playMakerFSM;
         }
         if (playMakerFSM.FsmName == "global_alertManagerFSM")
         {
             this.pmAlert = playMakerFSM;
         }
         if (playMakerFSM.FsmName == "action_encounterFSM")
         {
             this.pmEncounter = playMakerFSM;
             this.actionFSM.Add(playMakerFSM);
         }
         if (playMakerFSM.FsmName == "global_targetManagerFSM")
         {
             this.pmTargetManager = playMakerFSM;
         }
     }
     this.thisGo = base.gameObject;
     this.rootTr = base.transform.root.transform;
     this.rotateTr = base.transform;
     this.familyFunctions = base.transform.parent.GetComponent<mutantFamilyFunctions>();
     this.animator = base.GetComponent<Animator>();
     this.ai = base.GetComponent<mutantAI>();
     this.aiManager = base.GetComponent<mutantAiManager>();
     this.typeSetup = base.transform.parent.GetComponent<mutantTypeSetup>();
     this.health = base.GetComponent<EnemyHealth>();
     this.dayCycle = base.GetComponentInChildren<mutantDayCycle>();
     this.enemyEvents = base.transform.GetComponent<enemyAnimEvents>();
     this.controller = base.transform.root.GetComponent<CharacterController>();
     this.hashs = base.transform.GetComponent<mutantMaleHashId>();
     this.propManager = base.transform.GetComponent<mutantPropManager>();
     this.bodyVariation = base.transform.GetComponentInChildren<setupBodyVariation>();
     this.collisionDetect = base.transform.GetComponentInChildren<mutantCollisionDetect>();
     this.hitReceiver = base.transform.GetComponentInChildren<mutantHitReceiver>();
     this.animControl = base.transform.GetComponentInChildren<mutantAnimatorControl>();
     if (!this.disableAiForDebug)
     {
         this.sceneInfo = Scene.SceneTracker;
     }
     this.search = base.GetComponent<mutantSearchFunctions>();
     this.worldSearch = base.transform.parent.GetComponent<mutantWorldSearchFunctions>();
     this.mutantStats = base.transform.parent.GetComponent<targetStats>();
     Transform[] componentsInChildren = base.transform.parent.GetComponentsInChildren<Transform>();
     Transform[] array2 = componentsInChildren;
     for (int j = 0; j < array2.Length; j++)
     {
         Transform transform = array2[j];
         if (transform.name == "char_Head")
         {
             this.headJoint = transform.gameObject;
         }
         if (transform.name == "char_LeftHandWeapon")
         {
             this.charLeftWeaponGo = transform.gameObject;
         }
         if (transform.name == "currentWaypoint")
         {
             this.currentWaypoint = transform.gameObject;
         }
         if (transform.name == "lastPlayerSighting")
         {
             this.lastSighting = transform.gameObject;
         }
         if (transform.name == "tempLookat")
         {
             this.lookatTr = transform;
         }
         if (transform.name == "char_club_mesh1")
         {
             this.weapon = transform.gameObject;
         }
         if (transform.name == "FireStick")
         {
             this.fireWeapon = transform.gameObject;
         }
         if (transform.name == "char_RightHand")
         {
             this.clawsWeapon = transform.gameObject;
         }
         if (transform.name == "weaponLeftGO")
         {
             this.leftWeapon = transform.gameObject;
         }
         if (transform.name == "weaponLeftGO1")
         {
             this.leftWeapon1 = transform.gameObject;
         }
         if (transform.name == "weaponRightGO")
         {
             this.rightWeapon = transform.gameObject;
         }
         if (transform.name == "mainHitTrigger")
         {
             this.mainWeapon = transform.gameObject;
         }
         if (transform.name == "fireBomb")
         {
             this.fireBombGo = transform.gameObject;
         }
         if (transform.name == "dragPointGo")
         {
             this.familyFunctions.dragPoint = transform.gameObject;
         }
         if (transform.name == "bodyCollision")
         {
             if (this.pmCombat)
             {
                 this.pmCombat.FsmVariables.GetFsmGameObject("bodyCollisionGo").Value = transform.gameObject;
             }
             this.bodyCollisionCollider = transform.GetComponent<CapsuleCollider>();
         }
         if (transform.name == "char_LeftFoot")
         {
             this.leftFoot = transform;
         }
         if (transform.name == "headCollision")
         {
             this.headColliderGo = transform.gameObject;
         }
     }
 }
Example #7
0
        public override void TriggerLargeTrap(Collider other)
        {
            if (this.MpClientCheck && other == null && this.largeNoose)
            {
                this.switchNooseRope();
                base.Invoke("EnableCutTrigger", 1.5f);
                this.animator.enabled = true;
                this.animator.SetIntegerReflected("direction", 0);
                this.animator.SetBoolReflected("trapSpringBool", true);
            }
            else if (this.MpHostCheck && this.largeNoose)
            {
                this.SprungTrap();
            }
            if (this.sprung)
            {
                return;
            }
            this.CheckAnimReference();
            bool flag = !BoltNetwork.isRunning || this.MpHostCheck;

            if (this.hitbox && !this.hitbox.activeSelf)
            {
                this.hitbox.SetActive(true);
            }
            if (this.largeSwingingRock)
            {
                this.cutRope.SetActive(false);
                this.swingingRock.SendMessage("enableSwingingRock", false);
                base.Invoke("enableTrapReset", 3f);
            }
            if (this.largeDeadfall)
            {
                this.anim.GetComponent <Animation>().Play("trapFall");
                this.spikeTrapBlockerGo.SetActive(true);
                base.Invoke("enableTrapReset", 3f);
            }
            if (this.largeSpike)
            {
                this.anim.GetComponent <Animation>().Play("trapSpring");
                this.spikeTrapBlockerGo.SetActive(true);
                if (flag && other)
                {
                    other.gameObject.SendMessageUpwards("enableController", SendMessageOptions.DontRequireReceiver);
                    if (other.gameObject.CompareTag("enemyCollide"))
                    {
                        this.mutantSetup = other.transform.root.GetComponentInChildren <mutantScriptSetup>();
                        if (this.mutantSetup && !this.mutantSetup.ai.creepy && !this.mutantSetup.ai.creepy_male && !this.mutantSetup.ai.creepy_fat && !this.mutantSetup.ai.creepy_baby)
                        {
                            other.gameObject.SendMessageUpwards("setCurrentTrap", base.gameObject, SendMessageOptions.DontRequireReceiver);
                        }
                    }
                }
                base.Invoke("enableTrapReset", 3f);
            }
            if (this.largeNoose)
            {
                if (flag && other)
                {
                    if (other.gameObject.GetComponentInParent <EnemyProgression>()?.abilities.Count > 0)
                    {
                        return;                        //noose traps are too strong against elites
                    }
                    //so they no longer work on them

                    mutantHitReceiver component = other.transform.GetComponent <mutantHitReceiver>();
                    if (other.gameObject.CompareTag("enemyCollide"))
                    {
                        if (component)
                        {
                            component.inNooseTrap = true;
                            component.DisableWeaponHits(2f);
                        }
                        this.mutantSetup = other.transform.root.GetComponentInChildren <mutantScriptSetup>();
                    }
                    this.trappedMutants.Clear();
                    this.trappedMutantMasks.Clear();
                    GameObject gameObject = other.transform.root.gameObject;
                    this.addTrappedMutant(gameObject);
                    mutantScriptSetup componentInChildren = other.transform.root.GetComponentInChildren <mutantScriptSetup>();
                    if (componentInChildren && componentInChildren.ai && componentInChildren.ai.pale)
                    {
                        this.FixPalePosition(componentInChildren, true);
                    }
                    if (base.transform.InverseTransformPoint(other.transform.position).x > 0f)
                    {
                        this.animator.SetIntegerReflected("direction", 0);
                    }
                    else
                    {
                        this.animator.SetIntegerReflected("direction", 1);
                    }
                    other.gameObject.SendMessageUpwards("setFootPivot", this.nooseFootPivot, SendMessageOptions.DontRequireReceiver);
                    this.animator.enabled = true;
                    this.animator.SetBoolReflected("trapSpringBool", true);
                    if (this.mutantSetup)
                    {
                        if (!this.mutantSetup.ai.creepy && !this.mutantSetup.ai.creepy_male && !this.mutantSetup.ai.creepy_fat && !this.mutantSetup.ai.creepy_baby)
                        {
                            other.gameObject.SendMessageUpwards("setInNooseTrap", this.noosePivot);
                        }
                        other.gameObject.SendMessageUpwards("setCurrentTrap", base.gameObject);
                    }
                }
                if (other)
                {
                    other.gameObject.SendMessageUpwards("DieTrap", 2, SendMessageOptions.DontRequireReceiver);
                }
                this.switchNooseRope();
                base.Invoke("EnableCutTrigger", 1.5f);
                if (base.entity.IsOwner() && this.largeNoose)
                {
                    base.entity.GetState <ITrapLargeState>().CanCutDown = true;
                    base.entity.GetState <ITrapLargeState>().CanReset   = false;
                }
                if (other && (other.gameObject.CompareTag("Player") || other.gameObject.CompareTag("PlayerNet")))
                {
                    base.Invoke("enableTrapReset", 2f);
                }
            }
            if (this.hitbox)
            {
                base.Invoke("disableHitbox", 1.5f);
            }
            base.transform.GetComponent <Collider>().enabled = false;
            this.SprungTag = true;
            this.PlayTriggerSFX();
        }
Example #8
0
 private void doAwake()
 {
     if (this.disableAiForDebug)
     {
         this.disableForDebug();
     }
     this.allFSM = base.gameObject.GetComponents <PlayMakerFSM>();
     PlayMakerFSM[] array = this.allFSM;
     for (int i = 0; i < array.Length; i++)
     {
         PlayMakerFSM playMakerFSM = array[i];
         if (playMakerFSM.FsmName == "action_combatFSM")
         {
             this.pmCombat = playMakerFSM;
             this.actionFSM.Add(playMakerFSM);
         }
         if (playMakerFSM.FsmName == "action_inTreeFSM")
         {
             this.pmTree = playMakerFSM;
             this.actionFSM.Add(playMakerFSM);
         }
         if (playMakerFSM.FsmName == "global_visionFSM")
         {
             this.pmVision = playMakerFSM;
         }
         if (playMakerFSM.FsmName == "action_searchFSM")
         {
             this.pmSearch = playMakerFSM;
             this.actionFSM.Add(playMakerFSM);
         }
         if (playMakerFSM.FsmName == "action_stalkingFSM")
         {
             this.pmStalk = playMakerFSM;
             this.actionFSM.Add(playMakerFSM);
         }
         if (playMakerFSM.FsmName == "global_motorFSM")
         {
             this.pmMotor = playMakerFSM;
         }
         if (playMakerFSM.FsmName == "action_sleepingFSM")
         {
             this.pmSleep = playMakerFSM;
             this.actionFSM.Add(playMakerFSM);
         }
         if (playMakerFSM.FsmName == "global_brainFSM")
         {
             this.pmBrain = playMakerFSM;
         }
         if (playMakerFSM.FsmName == "global_alertManagerFSM")
         {
             this.pmAlert = playMakerFSM;
         }
         if (playMakerFSM.FsmName == "action_encounterFSM")
         {
             this.pmEncounter = playMakerFSM;
             this.actionFSM.Add(playMakerFSM);
         }
         if (playMakerFSM.FsmName == "global_targetManagerFSM")
         {
             this.pmTargetManager = playMakerFSM;
         }
     }
     this.thisGo          = base.gameObject;
     this.rootTr          = base.transform.root.transform;
     this.rotateTr        = base.transform;
     this.familyFunctions = base.transform.parent.GetComponent <mutantFamilyFunctions>();
     this.animator        = base.GetComponent <Animator>();
     this.ai              = base.GetComponent <mutantAI>();
     this.aiManager       = base.GetComponent <mutantAiManager>();
     this.typeSetup       = base.transform.parent.GetComponent <mutantTypeSetup>();
     this.health          = base.GetComponent <EnemyHealth>();
     this.dayCycle        = base.GetComponentInChildren <mutantDayCycle>();
     this.enemyEvents     = base.transform.GetComponent <enemyAnimEvents>();
     this.controller      = base.transform.root.GetComponent <CharacterController>();
     this.hashs           = base.transform.GetComponent <mutantMaleHashId>();
     this.propManager     = base.transform.GetComponent <mutantPropManager>();
     this.bodyVariation   = base.transform.GetComponentInChildren <setupBodyVariation>();
     this.collisionDetect = base.transform.GetComponentInChildren <mutantCollisionDetect>();
     this.hitReceiver     = base.transform.GetComponentInChildren <mutantHitReceiver>();
     this.animControl     = base.transform.GetComponentInChildren <mutantAnimatorControl>();
     if (!this.disableAiForDebug)
     {
         this.sceneInfo = Scene.SceneTracker;
     }
     this.search      = base.GetComponent <mutantSearchFunctions>();
     this.worldSearch = base.transform.parent.GetComponent <mutantWorldSearchFunctions>();
     this.mutantStats = base.transform.parent.GetComponent <targetStats>();
     Transform[] componentsInChildren = base.transform.parent.GetComponentsInChildren <Transform>();
     Transform[] array2 = componentsInChildren;
     for (int j = 0; j < array2.Length; j++)
     {
         Transform transform = array2[j];
         if (transform.name == "char_Head")
         {
             this.headJoint = transform.gameObject;
         }
         if (transform.name == "char_LeftHandWeapon")
         {
             this.charLeftWeaponGo = transform.gameObject;
         }
         if (transform.name == "currentWaypoint")
         {
             this.currentWaypoint = transform.gameObject;
         }
         if (transform.name == "lastPlayerSighting")
         {
             this.lastSighting = transform.gameObject;
         }
         if (transform.name == "tempLookat")
         {
             this.lookatTr = transform;
         }
         if (transform.name == "char_club_mesh1")
         {
             this.weapon = transform.gameObject;
         }
         if (transform.name == "FireStick")
         {
             this.fireWeapon = transform.gameObject;
         }
         if (transform.name == "char_RightHand")
         {
             this.clawsWeapon = transform.gameObject;
         }
         if (transform.name == "weaponLeftGO")
         {
             this.leftWeapon = transform.gameObject;
         }
         if (transform.name == "weaponLeftGO1")
         {
             this.leftWeapon1 = transform.gameObject;
         }
         if (transform.name == "weaponRightGO")
         {
             this.rightWeapon = transform.gameObject;
         }
         if (transform.name == "mainHitTrigger")
         {
             this.mainWeapon = transform.gameObject;
         }
         if (transform.name == "fireBomb")
         {
             this.fireBombGo = transform.gameObject;
         }
         if (transform.name == "dragPointGo")
         {
             this.familyFunctions.dragPoint = transform.gameObject;
         }
         if (transform.name == "bodyCollision")
         {
             if (this.pmCombat)
             {
                 this.pmCombat.FsmVariables.GetFsmGameObject("bodyCollisionGo").Value = transform.gameObject;
             }
             this.bodyCollisionCollider = transform.GetComponent <CapsuleCollider>();
         }
         if (transform.name == "char_LeftFoot")
         {
             this.leftFoot = transform;
         }
         if (transform.name == "headCollision")
         {
             this.headColliderGo = transform.gameObject;
         }
     }
 }
        public override void OnEvent(PlayerHitEnemy ev)
        {
            //this needed to be changed.
            //the command would send damage using hitReal - pure damage.
            //this made clients attack ignore armor and deal too much dmg
            if (!this.ValidateSender(ev, SenderTypes.Any))
            {
                return;
            }
            if (!ev.Target)
            {
                return;
            }
            if (ev.Hit == 0)
            {
                return;
            }
            try
            {
                if (EnemyHealth.CurrentAttacker == null)
                {
                    EnemyHealth.CurrentAttacker = ev.Target;
                }
                var packed = ev.Target.networkId.PackedValue;
                if (EnemyManager.hostDictionary.ContainsKey(packed))
                {
                    var enemy = EnemyManager.hostDictionary[packed];
                    if (ev.explosion)
                    {
                        enemy.HealthScript.Explosion(-1);
                    }
                    if (ev.Burn)
                    {
                        enemy.HealthScript.Burn();
                    }
                    if (ev.getAttackerType == DamageMath.SILENTattackerType)
                    {
                        //ghost hit
                        float damage = BitConverter.ToSingle(BitConverter.GetBytes(ev.Hit), 0);
                        enemy.HitPhysicalSilent(damage);
                    }
                    else if (ev.getAttackerType == DamageMath.SILENTattackerTypeMagic)
                    {
                        //ghost hit
                        float damage = BitConverter.ToSingle(BitConverter.GetBytes(ev.Hit), 0);
                        enemy.HitMagic(damage);
                    }
                    else if (ev.getAttackerType == DamageMath.PURE)
                    {
                        float damage = BitConverter.ToSingle(BitConverter.GetBytes(ev.Hit), 0);
                        enemy.HitPure(damage);
                    }
                    else
                    {
                        if (ev.Hit > 0)
                        {
                            float damage = ev.getAttackerType >= DamageMath.CONVERTEDFLOATattackerType ? BitConverter.ToSingle(BitConverter.GetBytes(ev.Hit), 0) : ev.Hit;
                            if (ev.getAttackerType >= DamageMath.CONVERTEDFLOATattackerType)
                            {
                                ev.getAttackerType -= DamageMath.CONVERTEDFLOATattackerType;
                            }
                            //just in case i ever need this
                            //this is how to get the player object which raised the event (ev.RaisedBy.UserData as BoltEntity)
                            enemy.HealthScript.getAttackDirection(ev.getAttackerType);
                            var attackerGO = (ev.RaisedBy.UserData as BoltEntity).gameObject;
                            enemy.setup.search.switchToNewTarget(attackerGO);
                            enemy.setup.hitReceiver.getAttackDirection(ev.getAttackDirection);
                            enemy.setup.hitReceiver.getCombo(ev.getCombo);
                            enemy.HealthScript.takeDamage(ev.takeDamage);
                            enemy.HealthScript.setSkinDamage(1);
                            enemy.HitPhysical(damage);
                        }
                        else
                        {
                            ModAPI.Console.Write("The good armor reduction");
                            enemy.ReduceArmor(-ev.Hit);
                        }
                    }
                    return;
                }

                //F**k all of this spaghetti below
                lb_Bird   component           = ev.Target.GetComponent <lb_Bird>();
                Fish      componentInChildren = ev.Target.GetComponentInChildren <Fish>();
                Transform transform;
                if (componentInChildren)
                {
                    transform = componentInChildren.transform;
                }
                else if (ev.Target.GetComponent <animalHealth>())
                {
                    transform = ev.Target.transform;
                }
                else if (component)
                {
                    transform = component.transform;
                }
                else
                {
                    EnemyHealth componentInChildren2 = ev.Target.GetComponentInChildren <EnemyHealth>();
                    transform = componentInChildren2 ? componentInChildren2.transform : ev.Target.transform.GetChild(0);
                }
                if (ev.getAttacker == 10 && ev.Weapon)
                {
                    ArrowDamage componentInChildren3 = ev.Weapon.GetComponentInChildren <ArrowDamage>();
                    if (componentInChildren3.Live)
                    {
                        arrowStickToTarget componentInChildren4 = transform.GetComponentInChildren <arrowStickToTarget>();
                        Transform          target = transform;
                        if (componentInChildren4)
                        {
                            target = componentInChildren4.transform;
                        }
                        componentInChildren3.CheckHit(Vector3.zero, target, false, transform.GetComponent <Collider>());
                    }
                }
                if (ev.explosion)
                {
                    transform.SendMessage("Explosion", -1, SendMessageOptions.DontRequireReceiver);
                }
                if (ev.HitHead)
                {
                    transform.SendMessage("HitHead", SendMessageOptions.DontRequireReceiver);
                }
                if (ev.getStealthAttack)
                {
                    transform.SendMessage("getStealthAttack", SendMessageOptions.DontRequireReceiver);
                }
                float dmg = ev.getAttackerType >= DamageMath.CONVERTEDFLOATattackerType ? BitConverter.ToSingle(BitConverter.GetBytes(ev.Hit), 0) : ev.Hit;
                if (ev.hitFallDown)
                {
                    mutantHitReceiver componentInChildren5 = transform.GetComponentInChildren <mutantHitReceiver>();
                    if (componentInChildren5)
                    {
                        componentInChildren5.sendHitFallDown(dmg);
                    }
                }
                else
                {
                    if (ev.Hit > 0)
                    {
                        transform.SendMessage("getAttacker", (ev.RaisedBy.UserData as BoltEntity).gameObject, SendMessageOptions.DontRequireReceiver);
                        transform.SendMessage("getAttackerType", ev.getAttackerType, SendMessageOptions.DontRequireReceiver);
                        transform.SendMessage("getAttackDirection", ev.getAttackDirection, SendMessageOptions.DontRequireReceiver);
                        transform.SendMessage("getCombo", ev.getCombo, SendMessageOptions.DontRequireReceiver);
                        transform.SendMessage("takeDamage", ev.takeDamage, SendMessageOptions.DontRequireReceiver);
                        transform.SendMessage("setSkinDamage", UnityEngine.Random.Range(0, 3), SendMessageOptions.DontRequireReceiver);
                        transform.SendMessage("ApplyAnimalSkinDamage", ev.getAttackDirection, SendMessageOptions.DontRequireReceiver);
                        transform.SendMessage("Hit", dmg, SendMessageOptions.DontRequireReceiver);
                        if (ev.HitAxe)
                        {
                            transform.SendMessage("HitAxe", SendMessageOptions.DontRequireReceiver);
                        }
                        if (ev.Burn)
                        {
                            transform.SendMessage("Burn", SendMessageOptions.DontRequireReceiver);
                        }
                    }
                    else
                    {
                        ModAPI.Console.Write("The bad armor reduction");
                        transform.SendMessage("ReduceArmor", -dmg, SendMessageOptions.DontRequireReceiver);
                    }
                }
            }
            finally
            {
                EnemyHealth.CurrentAttacker = null;
            }
        }