Ejemplo n.º 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.HitLeft(base.transform.position, 0.05f);
                }
                else
                {
                    component2.HitRight(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;
        }
    }