Esempio n. 1
0
        private bool SurfaceForCollider(Collider collider, ref ExplosionHelper.Surface surface)
        {
            RaycastHit raycastHit;

            if (!collider.enabled)
            {
                surface = new ExplosionHelper.Surface();
                return(false);
            }
            surface.idBase = IDBase.Get(collider);
            if (!surface.idBase)
            {
                surface = new ExplosionHelper.Surface();
                return(false);
            }
            surface.idMain = surface.idBase.idMain;
            if (!surface.idMain || surface.idMain == this.skip)
            {
                surface = new ExplosionHelper.Surface();
                return(false);
            }
            surface.bounds = collider.bounds;
            if (!this.BoundsWork(ref surface.bounds, ref surface.work))
            {
                return(false);
            }
            if (this.raycastLayerMask != 0)
            {
                surface.blocked = (!surface.work.rayTest || !collider.Raycast(new Ray(this.point, surface.work.rayDir), out raycastHit, surface.work.rayDistance) || !Physics.Raycast(this.point, surface.work.rayDir, out raycastHit, raycastHit.distance, this.raycastLayerMask) ? false : raycastHit.collider != collider);
            }
            return(true);
        }
 // Token: 0x06002E65 RID: 11877 RVA: 0x000B2410 File Offset: 0x000B0610
 private bool SurfaceForCollider(Collider collider, ref global::ExplosionHelper.Surface surface)
 {
     if (!collider.enabled)
     {
         surface = default(global::ExplosionHelper.Surface);
         return(false);
     }
     surface.idBase = IDBase.Get(collider);
     if (!surface.idBase)
     {
         surface = default(global::ExplosionHelper.Surface);
         return(false);
     }
     surface.idMain = surface.idBase.idMain;
     if (!surface.idMain || surface.idMain == this.skip)
     {
         surface = default(global::ExplosionHelper.Surface);
         return(false);
     }
     surface.bounds = collider.bounds;
     if (this.BoundsWork(ref surface.bounds, ref surface.work))
     {
         if (this.raycastLayerMask != 0)
         {
             RaycastHit raycastHit;
             surface.blocked = (surface.work.rayTest && collider.Raycast(new Ray(this.point, surface.work.rayDir), ref raycastHit, surface.work.rayDistance) && Physics.Raycast(this.point, surface.work.rayDir, ref raycastHit, raycastHit.distance, this.raycastLayerMask) && raycastHit.collider != collider);
         }
         return(true);
     }
     return(false);
 }
Esempio n. 3
0
 private bool SurfaceForCollider(Collider collider, ref ExplosionHelper.Surface surface)
 {
     if (!collider.enabled)
     {
         surface = new ExplosionHelper.Surface();
         return false;
     }
     surface.idBase = IDBase.Get(collider);
     if (surface.idBase == null)
     {
         surface = new ExplosionHelper.Surface();
         return false;
     }
     surface.idMain = surface.idBase.idMain;
     if ((surface.idMain == null) || (surface.idMain == this.skip))
     {
         surface = new ExplosionHelper.Surface();
         return false;
     }
     surface.bounds = collider.bounds;
     if (!this.BoundsWork(ref surface.bounds, ref surface.work))
     {
         return false;
     }
     if (this.raycastLayerMask != 0)
     {
         RaycastHit hit;
         surface.blocked = ((surface.work.rayTest && collider.Raycast(new Ray(this.point, surface.work.rayDir), out hit, surface.work.rayDistance)) && Physics.Raycast(this.point, surface.work.rayDir, out hit, hit.distance, this.raycastLayerMask)) && (hit.collider != collider);
     }
     return true;
 }
Esempio n. 4
0
    // Token: 0x0600034B RID: 843 RVA: 0x00010354 File Offset: 0x0000E554
    public global::Character GetFromCollider(Collider other)
    {
        IDBase idbase = IDBase.Get(other);

        if (!idbase)
        {
            return(null);
        }
        return(idbase.idMain as global::Character);
    }
Esempio n. 5
0
    public Character GetFromCollider(Collider other)
    {
        IDBase base2 = IDBase.Get(other);

        if (base2 == null)
        {
            return(null);
        }
        return(base2.idMain as Character);
    }
Esempio n. 6
0
    public Character GetFromCollider(Collider other)
    {
        IDBase dBase = IDBase.Get(other);

        if (!dBase)
        {
            return(null);
        }
        return(dBase.idMain as Character);
    }
Esempio n. 7
0
    public static bool GetIDBaseFromCollider(Collider collider, out IDBase id)
    {
        if (collider == null)
        {
            id = null;
            return(false);
        }
        id = IDBase.Get(collider);
        if (id != null)
        {
            return(true);
        }
        Rigidbody attachedRigidbody = collider.attachedRigidbody;

        if (attachedRigidbody != null)
        {
            id = attachedRigidbody.GetComponent <IDBase>();
            return((bool)id);
        }
        return(false);
    }
Esempio n. 8
0
    public static bool GetIDBaseFromCollider(Collider collider, out IDBase id)
    {
        if (!collider)
        {
            id = null;
            return(false);
        }
        id = IDBase.Get(collider);
        if (id)
        {
            return(true);
        }
        Rigidbody rigidbody = collider.attachedRigidbody;

        if (!rigidbody)
        {
            return(false);
        }
        id = rigidbody.GetComponent <IDBase>();
        return(id);
    }
    protected virtual void ReadHitInfo(uLink.BitStream stream, out GameObject hitObj, out bool hitNetworkObj, out bool hitBodyPart, out BodyPart bodyPart, out IDRemoteBodyPart remoteBodyPart, out NetEntityID hitViewID, out Transform fromTransform, out Vector3 endPos, out Vector3 offset, out bool isHeadshot)
    {
        HitBoxSystem hitBoxSystem;
        bool         flag;
        byte         num = stream.ReadByte();

        if (num >= 255)
        {
            hitNetworkObj = false;
            hitBodyPart   = false;
            bodyPart      = BodyPart.Undefined;
        }
        else
        {
            hitNetworkObj = true;
            if (num >= 120)
            {
                hitBodyPart = false;
                bodyPart    = BodyPart.Undefined;
            }
            else
            {
                hitBodyPart = true;
                bodyPart    = (BodyPart)num;
            }
        }
        if (!hitNetworkObj)
        {
            hitViewID      = NetEntityID.unassigned;
            hitObj         = null;
            remoteBodyPart = null;
        }
        else
        {
            hitViewID = stream.Read <NetEntityID>(new object[0]);
            if (hitViewID.isUnassigned)
            {
                hitObj         = null;
                remoteBodyPart = null;
            }
            else
            {
                hitObj = hitViewID.gameObject;
                if (!hitObj)
                {
                    remoteBodyPart = null;
                }
                else
                {
                    IDBase dBase = IDBase.Get(hitObj);
                    if (!dBase)
                    {
                        remoteBodyPart = null;
                    }
                    else
                    {
                        IDMain dMain = dBase.idMain;
                        if (!dMain)
                        {
                            remoteBodyPart = null;
                        }
                        else
                        {
                            hitBoxSystem = (!(dMain is Character) ? dMain.GetRemote <HitBoxSystem>() : ((Character)dMain).hitBoxSystem);
                            if (!hitBoxSystem)
                            {
                                remoteBodyPart = null;
                            }
                            else
                            {
                                hitBoxSystem.bodyParts.TryGetValue((BodyPart)((int)bodyPart), out remoteBodyPart);
                            }
                        }
                    }
                }
            }
        }
        endPos = stream.ReadVector3();
        offset = Vector3.zero;
        if (remoteBodyPart)
        {
            flag          = false;
            fromTransform = remoteBodyPart.transform;
            BodyPart bodyPart1 = (BodyPart)((int)bodyPart);
            switch (bodyPart1)
            {
            case BodyPart.Brain:
            case BodyPart.L_Eye:
            case BodyPart.R_Eye:
            {
Label0:
                isHeadshot = true;
                break;
            }

            default:
            {
                switch (bodyPart1)
                {
                case BodyPart.Head:
                case BodyPart.Jaw:
                {
                    goto Label0;
                }

                case BodyPart.Scalp:
                case BodyPart.Nostrils:
                {
                    isHeadshot = false;
                    break;
                }

                default:
                {
                    goto case BodyPart.Nostrils;
                }
                }
                break;
            }
            }
        }
        else if (!hitObj)
        {
            fromTransform = null;
            flag          = false;
            isHeadshot    = false;
        }
        else
        {
            fromTransform = hitObj.transform;
            flag          = true;
            isHeadshot    = false;
        }
        if (fromTransform)
        {
            offset = endPos;
            endPos = fromTransform.TransformPoint(endPos);
        }
    }
Esempio n. 10
0
    // Token: 0x06003319 RID: 13081 RVA: 0x000C0CA0 File Offset: 0x000BEEA0
    protected virtual void ReadHitInfo(BitStream stream, out GameObject hitObj, out bool hitNetworkObj, out bool hitBodyPart, out BodyPart bodyPart, out IDRemoteBodyPart remoteBodyPart, out global::NetEntityID hitViewID, out Transform fromTransform, out Vector3 endPos, out Vector3 offset, out bool isHeadshot)
    {
        byte b = stream.ReadByte();

        if (b < 255)
        {
            hitNetworkObj = true;
            if (b < 120)
            {
                hitBodyPart = true;
                bodyPart    = (int)b;
            }
            else
            {
                hitBodyPart = false;
                bodyPart    = 0;
            }
        }
        else
        {
            hitNetworkObj = false;
            hitBodyPart   = false;
            bodyPart      = 0;
        }
        if (hitNetworkObj)
        {
            hitViewID = stream.Read <global::NetEntityID>(new object[0]);
            if (!hitViewID.isUnassigned)
            {
                hitObj = hitViewID.gameObject;
                if (hitObj)
                {
                    IDBase idbase = IDBase.Get(hitObj);
                    if (idbase)
                    {
                        IDMain idMain = idbase.idMain;
                        if (idMain)
                        {
                            global::HitBoxSystem hitBoxSystem;
                            if (idMain is global::Character)
                            {
                                hitBoxSystem = ((global::Character)idMain).hitBoxSystem;
                            }
                            else
                            {
                                hitBoxSystem = idMain.GetRemote <global::HitBoxSystem>();
                            }
                            if (hitBoxSystem)
                            {
                                hitBoxSystem.bodyParts.TryGetValue(bodyPart, ref remoteBodyPart);
                            }
                            else
                            {
                                remoteBodyPart = null;
                            }
                        }
                        else
                        {
                            remoteBodyPart = null;
                        }
                    }
                    else
                    {
                        remoteBodyPart = null;
                    }
                }
                else
                {
                    remoteBodyPart = null;
                }
            }
            else
            {
                hitObj         = null;
                remoteBodyPart = null;
            }
        }
        else
        {
            hitViewID      = global::NetEntityID.unassigned;
            hitObj         = null;
            remoteBodyPart = null;
        }
        endPos = stream.ReadVector3();
        offset = Vector3.zero;
        if (remoteBodyPart)
        {
            fromTransform = remoteBodyPart.transform;
            BodyPart bodyPart2 = bodyPart;
            switch (bodyPart2)
            {
            case 16:
            case 20:
            case 21:
                break;

            default:
                switch (bodyPart2)
                {
                case 9:
                case 12:
                    goto IL_1A3;
                }
                isHeadshot = false;
                goto IL_1B5;
            }
IL_1A3:
            isHeadshot = true;
            IL_1B5 :;
        }
        else if (hitObj)
        {
            fromTransform = hitObj.transform;
            isHeadshot    = false;
        }
        else
        {
            fromTransform = null;
            isHeadshot    = false;
        }
        if (fromTransform)
        {
            offset = endPos;
            endPos = fromTransform.TransformPoint(endPos);
        }
    }
Esempio n. 11
0
    protected virtual void ReadHitInfo(BitStream stream, out GameObject hitObj, out bool hitNetworkObj, out bool hitBodyPart, out BodyPart bodyPart, out IDRemoteBodyPart remoteBodyPart, out NetEntityID hitViewID, out Transform fromTransform, out Vector3 endPos, out Vector3 offset, out bool isHeadshot)
    {
        bool flag;
        byte num = stream.ReadByte();

        if (num < 0xff)
        {
            hitNetworkObj = true;
            if (num < 120)
            {
                hitBodyPart = true;
                bodyPart    = (BodyPart)num;
            }
            else
            {
                hitBodyPart = false;
                bodyPart    = BodyPart.Undefined;
            }
        }
        else
        {
            hitNetworkObj = false;
            hitBodyPart   = false;
            bodyPart      = BodyPart.Undefined;
        }
        if (hitNetworkObj)
        {
            hitViewID = stream.Read <NetEntityID>(new object[0]);
            if (!hitViewID.isUnassigned)
            {
                hitObj = hitViewID.gameObject;
                if (hitObj != null)
                {
                    IDBase base2 = IDBase.Get(hitObj);
                    if (base2 != null)
                    {
                        IDMain idMain = base2.idMain;
                        if (idMain != null)
                        {
                            HitBoxSystem hitBoxSystem;
                            if (idMain is Character)
                            {
                                hitBoxSystem = ((Character)idMain).hitBoxSystem;
                            }
                            else
                            {
                                hitBoxSystem = idMain.GetRemote <HitBoxSystem>();
                            }
                            if (hitBoxSystem != null)
                            {
                                hitBoxSystem.bodyParts.TryGetValue(bodyPart, out remoteBodyPart);
                            }
                            else
                            {
                                remoteBodyPart = null;
                            }
                        }
                        else
                        {
                            remoteBodyPart = null;
                        }
                    }
                    else
                    {
                        remoteBodyPart = null;
                    }
                }
                else
                {
                    remoteBodyPart = null;
                }
            }
            else
            {
                hitObj         = null;
                remoteBodyPart = null;
            }
        }
        else
        {
            hitViewID      = NetEntityID.unassigned;
            hitObj         = null;
            remoteBodyPart = null;
        }
        endPos = stream.ReadVector3();
        offset = Vector3.zero;
        if (remoteBodyPart == null)
        {
            if (hitObj != null)
            {
                fromTransform = hitObj.transform;
                flag          = true;
                isHeadshot    = false;
            }
            else
            {
                fromTransform = null;
                flag          = false;
                isHeadshot    = false;
            }
        }
        else
        {
            flag          = false;
            fromTransform = remoteBodyPart.transform;
            BodyPart part = bodyPart;
            switch (part)
            {
            case BodyPart.Brain:
            case BodyPart.L_Eye:
            case BodyPart.R_Eye:
                break;

            default:
                switch (part)
                {
                case BodyPart.Head:
                case BodyPart.Jaw:
                    break;

                case BodyPart.Scalp:
                case BodyPart.Nostrils:
                    goto Label_01AC;

                default:
                    goto Label_01AC;
                }
                break;
            }
            isHeadshot = true;
        }
        goto Label_01E7;
Label_01AC:
        isHeadshot = false;
Label_01E7:
        if (fromTransform != null)
        {
            offset = endPos;
            endPos = fromTransform.TransformPoint(endPos);
        }
    }