示例#1
0
    public void FixedUpdate()
    {
        if (!base.photonView.isMine || disabled)
        {
            return;
        }
        LayerMask mask  = 1 << LayerMask.NameToLayer("PlayerAttackBox");
        LayerMask mask2 = 1 << LayerMask.NameToLayer("EnemyBox");
        LayerMask mask3 = (int)mask | (int)mask2;

        if (!isCollider)
        {
            LayerMask mask4 = 1 << LayerMask.NameToLayer("Ground");
            mask3 = ((int)mask3 | (int)mask4);
        }
        Collider[] array = Physics.OverlapSphere(base.transform.position, 0.6f, mask3.value);
        bool       flag  = false;

        for (int i = 0; i < array.Length; i++)
        {
            GameObject gameObject = array[i].gameObject;
            if (gameObject.layer == 16)
            {
                TitanTrigger component = gameObject.GetComponent <TitanTrigger>();
                if (component != null && !myTitanTriggers.Contains(component))
                {
                    component.isCollide = true;
                    myTitanTriggers.Add(component);
                }
            }
            else if (gameObject.layer == 10)
            {
                TITAN component2 = gameObject.transform.root.gameObject.GetComponent <TITAN>();
                if (component2 == null)
                {
                    continue;
                }
                if (component2.abnormalType == TitanClass.Crawler)
                {
                    if (gameObject.name == "head")
                    {
                        component2.photonView.RPC("DieByCannon", component2.photonView.owner, myHero.photonView.viewID);
                        component2.dieBlow(base.transform.position, 0.2f);
                        i = array.Length;
                    }
                }
                else if (gameObject.name == "head")
                {
                    component2.photonView.RPC("DieByCannon", component2.photonView.owner, myHero.photonView.viewID);
                    component2.dieHeadBlow(base.transform.position, 0.2f);
                    i = array.Length;
                }
                else if (Random.Range(0f, 1f) < 0.5f)
                {
                    component2.hitL(base.transform.position, 0.05f);
                }
                else
                {
                    component2.hitR(base.transform.position, 0.05f);
                }
                destroyMe();
            }
            else if (gameObject.layer == 9 && (gameObject.transform.root.name.Contains("CannonWall") || gameObject.transform.root.name.Contains("CannonGround")))
            {
                flag = true;
            }
        }
        if (!isCollider && !flag)
        {
            isCollider = true;
            GetComponent <SphereCollider>().enabled = true;
        }
    }
示例#2
0
 public void FixedUpdate()
 {
     if (base.photonView.isMine && !this.disabled)
     {
         LayerMask mask  = ((int)1) << LayerMask.NameToLayer("PlayerAttackBox");
         LayerMask mask2 = ((int)1) << LayerMask.NameToLayer("EnemyBox");
         LayerMask mask3 = mask | mask2;
         if (!this.isCollider)
         {
             LayerMask mask4 = ((int)1) << LayerMask.NameToLayer("Ground");
             mask3 |= mask4;
         }
         Collider[] colliderArray = Physics.OverlapSphere(base.transform.position, 0.6f, mask3.value);
         bool       flag          = false;
         for (int i = 0; i < colliderArray.Length; i++)
         {
             GameObject gameObject = colliderArray[i].gameObject;
             if (gameObject.layer == 0x10)
             {
                 TitanTrigger component = gameObject.GetComponent <TitanTrigger>();
                 if ((component != null) && !this.myTitanTriggers.Contains(component))
                 {
                     component.isCollide = true;
                     this.myTitanTriggers.Add(component);
                 }
             }
             else if (gameObject.layer == 10)
             {
                 TITAN titan = gameObject.transform.root.gameObject.GetComponent <TITAN>();
                 if (titan != null)
                 {
                     if (titan.abnormalType == AbnormalType.TYPE_CRAWLER)
                     {
                         if (gameObject.name == "head")
                         {
                             titan.photonView.RPC("DieByCannon", titan.photonView.owner, new object[] { this.myHero.photonView.viewID });
                             titan.dieBlow(base.transform.position, 0.2f);
                             i = colliderArray.Length;
                         }
                     }
                     else if (gameObject.name == "head")
                     {
                         titan.photonView.RPC("DieByCannon", titan.photonView.owner, new object[] { this.myHero.photonView.viewID });
                         titan.dieHeadBlow(base.transform.position, 0.2f);
                         i = colliderArray.Length;
                     }
                     else if (UnityEngine.Random.Range((float)0f, (float)1f) < 0.5f)
                     {
                         titan.hitL(base.transform.position, 0.05f);
                     }
                     else
                     {
                         titan.hitR(base.transform.position, 0.05f);
                     }
                     this.destroyMe();
                 }
             }
             else if ((gameObject.layer == 9) && (gameObject.transform.root.name.Contains("CannonWall") || gameObject.transform.root.name.Contains("CannonGround")))
             {
                 flag = true;
             }
         }
         if (!this.isCollider && !flag)
         {
             this.isCollider = true;
             base.GetComponent <SphereCollider>().enabled = true;
         }
     }
 }
示例#3
0
 public void FixedUpdate()
 {
     if (BasePV.IsMine && !disabled)
     {
         LayerMask mask = Layers.PlayerAttackBox | Layers.EnemyBox;
         if (!isCollider)
         {
             mask |= Layers.Ground;
         }
         Collider[] array = Physics.OverlapSphere(base.transform.position, 0.6f, mask.value);
         bool       flag3 = false;
         for (int i = 0; i < array.Length; i++)
         {
             GameObject gameObject = array[i].gameObject;
             bool       flag4      = gameObject.layer == 16;
             if (flag4)
             {
                 TitanTrigger component = gameObject.GetComponent <TitanTrigger>();
                 bool         flag5     = !(component == null) && !this.myTitanTriggers.Contains(component);
                 if (flag5)
                 {
                     component.IsCollide = true;
                     this.myTitanTriggers.Add(component);
                 }
             }
             else
             {
                 bool flag6 = gameObject.layer == 10;
                 if (flag6)
                 {
                     TITAN component2 = gameObject.transform.root.gameObject.GetComponent <TITAN>();
                     bool  flag7      = component2 != null;
                     if (flag7)
                     {
                         bool flag8 = component2.abnormalType == AbnormalType.Crawler;
                         if (flag8)
                         {
                             bool flag9 = gameObject.name == "head";
                             if (flag9)
                             {
                                 component2.BasePV.RPC("DieByCannon", component2.BasePV.owner, new object[]
                                 {
                                     this.myHero.BasePV.viewID
                                 });
                                 component2.dieBlow(base.transform.position, 0.2f);
                                 i = array.Length;
                             }
                         }
                         else
                         {
                             bool flag10 = gameObject.name == "head";
                             if (flag10)
                             {
                                 component2.BasePV.RPC("DieByCannon", component2.BasePV.owner, new object[]
                                 {
                                     this.myHero.BasePV.viewID
                                 });
                                 component2.dieHeadBlow(base.transform.position, 0.2f);
                                 i = array.Length;
                             }
                             else
                             {
                                 bool flag11 = UnityEngine.Random.Range(0f, 1f) < 0.5f;
                                 if (flag11)
                                 {
                                     component2.hitL(base.transform.position, 0.05f);
                                 }
                                 else
                                 {
                                     component2.hitR(base.transform.position, 0.05f);
                                 }
                             }
                         }
                         this.destroyMe();
                     }
                 }
                 else
                 {
                     bool flag12 = gameObject.layer == 9 && (gameObject.transform.root.name.Contains("CannonWall") || gameObject.transform.root.name.Contains("CannonGround"));
                     if (flag12)
                     {
                         flag3 = true;
                     }
                 }
             }
         }
         bool flag13 = !this.isCollider && !flag3;
         if (flag13)
         {
             this.isCollider = true;
             base.GetComponent <SphereCollider>().enabled = true;
         }
     }
 }