Beispiel #1
0
 public override void OnEvent(TriggerLargeTrap evnt)
 {
     if (evnt.Trap)
     {
         evnt.Trap.GetState <ITrapLargeState>().Sprung = true;
         Component[] componentsInChildren = evnt.Trap.GetComponentsInChildren(typeof(trapTrigger), true);
         if (componentsInChildren.Length > 0)
         {
             (componentsInChildren[0] as trapTrigger).TriggerLargeTrap(null);
         }
     }
 }
Beispiel #2
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();
            }
        }
    }
 public override void OnEvent(TriggerLargeTrap evnt)
 {
     if (evnt.Trap)
     {
         evnt.Trap.GetState<ITrapLargeState>().Sprung = true;
         Component[] componentsInChildren = evnt.Trap.GetComponentsInChildren(typeof(trapTrigger), true);
         if (componentsInChildren.Length > 0)
         {
             (componentsInChildren[0] as trapTrigger).TriggerLargeTrap(null);
         }
     }
 }