Exemple #1
0
    private Vector3 CheckWarpPos2()
    {
        //IL_0013: Unknown result type (might be due to invalid IL or missing references)
        //IL_0018: Unknown result type (might be due to invalid IL or missing references)
        //IL_001d: Unknown result type (might be due to invalid IL or missing references)
        //IL_0029: Unknown result type (might be due to invalid IL or missing references)
        //IL_002e: Unknown result type (might be due to invalid IL or missing references)
        //IL_0033: Unknown result type (might be due to invalid IL or missing references)
        //IL_003a: Unknown result type (might be due to invalid IL or missing references)
        //IL_003f: Unknown result type (might be due to invalid IL or missing references)
        //IL_0044: Unknown result type (might be due to invalid IL or missing references)
        //IL_0055: Unknown result type (might be due to invalid IL or missing references)
        //IL_0056: Unknown result type (might be due to invalid IL or missing references)
        //IL_0057: Unknown result type (might be due to invalid IL or missing references)
        //IL_005c: Unknown result type (might be due to invalid IL or missing references)
        //IL_0078: Unknown result type (might be due to invalid IL or missing references)
        //IL_007d: Unknown result type (might be due to invalid IL or missing references)
        //IL_008a: Unknown result type (might be due to invalid IL or missing references)
        //IL_008c: Unknown result type (might be due to invalid IL or missing references)
        //IL_008e: Unknown result type (might be due to invalid IL or missing references)
        //IL_010f: Unknown result type (might be due to invalid IL or missing references)
        //IL_0111: Unknown result type (might be due to invalid IL or missing references)
        //IL_0442: Unknown result type (might be due to invalid IL or missing references)
        //IL_0447: Unknown result type (might be due to invalid IL or missing references)
        //IL_044e: Unknown result type (might be due to invalid IL or missing references)
        //IL_0455: Unknown result type (might be due to invalid IL or missing references)
        //IL_045a: Unknown result type (might be due to invalid IL or missing references)
        SphereCollider val        = this.GetComponent <Collider>() as SphereCollider;
        float          radius     = val.get_radius();
        Vector3        lossyScale = this.get_transform().get_lossyScale();
        float          num        = radius * lossyScale.x;
        Vector3        position   = this.get_transform().get_position();
        Vector3        position2  = endObject.get_transform().get_position();

        position.y  = num;
        position2.y = num;
        Vector3 val2      = position2 - position;
        float   magnitude = val2.get_magnitude();
        float   num2      = 5f;

        if (num2 >= magnitude)
        {
            return(this.get_transform().get_position());
        }
        List <CastHitInfo> list = new List <CastHitInfo>();

        RaycastHit[] array = Physics.SphereCastAll(position2, num, -val2, magnitude, 393728);
        int          i     = 0;

        for (int num3 = array.Length; i < num3; i++)
        {
            CastHitInfo castHitInfo = new CastHitInfo();
            castHitInfo.distance  = array[i].get_distance();
            castHitInfo.faceToEnd = true;
            list.Add(castHitInfo);
        }
        CastHitInfo castHitInfo2 = new CastHitInfo();

        castHitInfo2.distance  = 0f;
        castHitInfo2.faceToEnd = false;
        list.Add(castHitInfo2);
        array = Physics.SphereCastAll(position, num, val2, magnitude, 393728);
        int j = 0;

        for (int num4 = array.Length; j < num4; j++)
        {
            CastHitInfo castHitInfo3 = new CastHitInfo();
            castHitInfo3.distance  = magnitude - array[j].get_distance();
            castHitInfo3.faceToEnd = false;
            list.Add(castHitInfo3);
        }
        CastHitInfo castHitInfo4 = new CastHitInfo();

        castHitInfo4.distance  = magnitude;
        castHitInfo4.faceToEnd = true;
        list.Add(castHitInfo4);
        list.Sort(delegate(CastHitInfo a, CastHitInfo b)
        {
            float num7 = a.distance - b.distance;
            if (num7 == 0f)
            {
                if (a.faceToEnd == b.faceToEnd)
                {
                    return(0);
                }
                return(a.faceToEnd ? 1 : (-1));
            }
            return((num7 > 0f) ? 1 : (-1));
        });
        Debug.Log((object)"----------------------------------------");
        int k = 0;

        for (int count = list.Count; k < count; k++)
        {
            Debug.Log((object)("############ : " + list[k].distance + ", " + list[k].faceToEnd));
        }
        int         num5         = 0;
        CastHitInfo castHitInfo5 = null;

        while (num5 < list.Count)
        {
            CastHitInfo castHitInfo6 = list[num5];
            if (castHitInfo5 == null)
            {
                castHitInfo5 = castHitInfo6;
                num5++;
            }
            else if (castHitInfo6.faceToEnd == castHitInfo5.faceToEnd)
            {
                if (castHitInfo6.faceToEnd)
                {
                    list.RemoveAt(num5);
                }
                else
                {
                    list.RemoveAt(num5 - 1);
                    castHitInfo5 = castHitInfo6;
                }
            }
            else
            {
                castHitInfo5 = castHitInfo6;
                num5++;
            }
        }
        num5 = 0;
        while (num5 + 1 < list.Count)
        {
            CastHitInfo castHitInfo7 = list[num5];
            CastHitInfo castHitInfo8 = list[num5 + 1];
            if (castHitInfo7.distance == castHitInfo8.distance && castHitInfo7.faceToEnd != castHitInfo8.faceToEnd)
            {
                list.RemoveRange(num5, 2);
            }
            else
            {
                num5++;
            }
        }
        Debug.Log((object)"----------------------------------------");
        int l = 0;

        for (int count2 = list.Count; l < count2; l++)
        {
            Debug.Log((object)("############ : " + list[l].distance + ", " + list[l].faceToEnd));
        }
        float num6 = magnitude;
        int   m    = 0;

        for (int count3 = list.Count; m + 1 < count3; m++)
        {
            CastHitInfo castHitInfo9  = list[m];
            CastHitInfo castHitInfo10 = list[m + 1];
            if (!castHitInfo9.faceToEnd && castHitInfo10.faceToEnd)
            {
                if (castHitInfo9.distance >= num2)
                {
                    num6 = castHitInfo9.distance;
                    break;
                }
                if (castHitInfo9.distance <= num2 && castHitInfo10.distance >= num2)
                {
                    num6 = num2;
                    break;
                }
            }
        }
        Debug.Log((object)("res : " + num6));
        return(endObject.get_transform().get_position() - val2.get_normalized() * num6);
    }
Exemple #2
0
    private Vector3 CheckWarpPos()
    {
        //IL_0013: Unknown result type (might be due to invalid IL or missing references)
        //IL_0018: Unknown result type (might be due to invalid IL or missing references)
        //IL_001d: Unknown result type (might be due to invalid IL or missing references)
        //IL_0029: Unknown result type (might be due to invalid IL or missing references)
        //IL_002e: Unknown result type (might be due to invalid IL or missing references)
        //IL_0033: Unknown result type (might be due to invalid IL or missing references)
        //IL_003a: Unknown result type (might be due to invalid IL or missing references)
        //IL_003f: Unknown result type (might be due to invalid IL or missing references)
        //IL_0044: Unknown result type (might be due to invalid IL or missing references)
        //IL_0055: Unknown result type (might be due to invalid IL or missing references)
        //IL_0056: Unknown result type (might be due to invalid IL or missing references)
        //IL_0057: Unknown result type (might be due to invalid IL or missing references)
        //IL_005c: Unknown result type (might be due to invalid IL or missing references)
        //IL_007f: Unknown result type (might be due to invalid IL or missing references)
        //IL_0084: Unknown result type (might be due to invalid IL or missing references)
        //IL_0091: Unknown result type (might be due to invalid IL or missing references)
        //IL_0093: Unknown result type (might be due to invalid IL or missing references)
        //IL_0095: Unknown result type (might be due to invalid IL or missing references)
        //IL_00e5: Unknown result type (might be due to invalid IL or missing references)
        //IL_00ea: Expected O, but got Unknown
        //IL_0133: Unknown result type (might be due to invalid IL or missing references)
        //IL_0135: Unknown result type (might be due to invalid IL or missing references)
        //IL_0185: Unknown result type (might be due to invalid IL or missing references)
        //IL_018a: Expected O, but got Unknown
        //IL_038f: Unknown result type (might be due to invalid IL or missing references)
        //IL_0394: Unknown result type (might be due to invalid IL or missing references)
        //IL_039b: Unknown result type (might be due to invalid IL or missing references)
        //IL_03a2: Unknown result type (might be due to invalid IL or missing references)
        //IL_03a7: Unknown result type (might be due to invalid IL or missing references)
        SphereCollider val        = this.GetComponent <Collider>() as SphereCollider;
        float          radius     = val.get_radius();
        Vector3        lossyScale = this.get_transform().get_lossyScale();
        float          num        = radius * lossyScale.x;
        Vector3        position   = this.get_transform().get_position();
        Vector3        position2  = endObject.get_transform().get_position();

        position.y  = num;
        position2.y = num;
        Vector3 val2      = position2 - position;
        float   magnitude = val2.get_magnitude();
        float   num2      = 5f;
        float   num3      = 2f;

        if (num2 >= magnitude)
        {
            return(this.get_transform().get_position());
        }
        List <CastHitInfo> list = new List <CastHitInfo>();

        RaycastHit[] array = Physics.SphereCastAll(position2, num, -val2, magnitude, 393728);
        int          i     = 0;

        for (int num4 = array.Length; i < num4; i++)
        {
            CastHitInfo castHitInfo = new CastHitInfo();
            castHitInfo.distance  = array[i].get_distance();
            castHitInfo.faceToEnd = true;
            castHitInfo.collider  = array[i].get_collider();
            list.Add(castHitInfo);
        }
        CastHitInfo castHitInfo2 = new CastHitInfo();

        castHitInfo2.distance  = 0f;
        castHitInfo2.faceToEnd = false;
        castHitInfo2.collider  = null;
        list.Add(castHitInfo2);
        array = Physics.SphereCastAll(position, num, val2, magnitude, 393728);
        int j = 0;

        for (int num5 = array.Length; j < num5; j++)
        {
            CastHitInfo castHitInfo3 = new CastHitInfo();
            castHitInfo3.distance  = magnitude - array[j].get_distance();
            castHitInfo3.faceToEnd = false;
            castHitInfo3.collider  = array[j].get_collider();
            list.Add(castHitInfo3);
        }
        CastHitInfo castHitInfo4 = new CastHitInfo();

        castHitInfo4.distance  = magnitude;
        castHitInfo4.faceToEnd = true;
        castHitInfo4.collider  = null;
        list.Add(castHitInfo4);
        list.Sort(delegate(CastHitInfo a, CastHitInfo b)
        {
            float num9 = a.distance - b.distance;
            if (num9 == 0f)
            {
                if (a.faceToEnd == b.faceToEnd)
                {
                    return(0);
                }
                return(a.faceToEnd ? 1 : (-1));
            }
            return((num9 > 0f) ? 1 : (-1));
        });
        int k = 0;

        for (int count = list.Count; k < count; k++)
        {
            CastHitInfo castHitInfo5 = list[k];
            if (!castHitInfo5.checkCollider && !(castHitInfo5.collider == null))
            {
                int num6 = k;
                while (0 <= num6 && num6 < count)
                {
                    CastHitInfo castHitInfo6 = list[num6];
                    if (num6 != k)
                    {
                        if (castHitInfo6.collider == castHitInfo5.collider)
                        {
                            castHitInfo6.checkCollider = true;
                            break;
                        }
                        castHitInfo6.enable = false;
                    }
                    num6 = ((!castHitInfo5.faceToEnd) ? (num6 - 1) : (num6 + 1));
                }
            }
        }
        float num7 = magnitude;

        for (int num8 = list.Count - 2; num8 >= 0; num8--)
        {
            CastHitInfo castHitInfo7 = list[num8];
            CastHitInfo castHitInfo8 = list[num8 + 1];
            if (castHitInfo7.enable && castHitInfo8.enable && !castHitInfo7.faceToEnd && castHitInfo8.faceToEnd)
            {
                if (castHitInfo7.distance <= num2 && castHitInfo8.distance >= num2)
                {
                    num7 = num2;
                    break;
                }
                if (castHitInfo7.distance >= num2)
                {
                    num7 = castHitInfo7.distance;
                }
                else if (castHitInfo8.distance >= num2 - num3)
                {
                    num7 = castHitInfo8.distance;
                    break;
                }
            }
        }
        return(endObject.get_transform().get_position() - val2.get_normalized() * num7);
    }
    private static Vector3 _GetAppearToTargetPos(Vector3 from_pos, Vector3 target_pos, Vector3 col_offset, float col_radius, float appear_distance, float appear_margin, bool from_inside, bool target_inside, out bool just_appear)
    {
        //IL_0004: Unknown result type (might be due to invalid IL or missing references)
        //IL_0005: Unknown result type (might be due to invalid IL or missing references)
        //IL_0006: Unknown result type (might be due to invalid IL or missing references)
        //IL_000b: Unknown result type (might be due to invalid IL or missing references)
        //IL_0023: Unknown result type (might be due to invalid IL or missing references)
        //IL_002d: Unknown result type (might be due to invalid IL or missing references)
        //IL_0052: Unknown result type (might be due to invalid IL or missing references)
        //IL_0053: Unknown result type (might be due to invalid IL or missing references)
        //IL_0054: Unknown result type (might be due to invalid IL or missing references)
        //IL_0059: Unknown result type (might be due to invalid IL or missing references)
        //IL_005a: Unknown result type (might be due to invalid IL or missing references)
        //IL_00a7: Unknown result type (might be due to invalid IL or missing references)
        //IL_00ac: Expected O, but got Unknown
        //IL_00f7: Unknown result type (might be due to invalid IL or missing references)
        //IL_00f8: Unknown result type (might be due to invalid IL or missing references)
        //IL_00f9: Unknown result type (might be due to invalid IL or missing references)
        //IL_00fe: Unknown result type (might be due to invalid IL or missing references)
        //IL_0149: Unknown result type (might be due to invalid IL or missing references)
        //IL_014e: Expected O, but got Unknown
        //IL_0367: Unknown result type (might be due to invalid IL or missing references)
        //IL_0369: Unknown result type (might be due to invalid IL or missing references)
        //IL_036c: Unknown result type (might be due to invalid IL or missing references)
        //IL_0373: Unknown result type (might be due to invalid IL or missing references)
        //IL_0378: Unknown result type (might be due to invalid IL or missing references)
        just_appear = false;
        Vector3 val       = target_pos - from_pos;
        float   magnitude = val.get_magnitude();

        if (magnitude <= 0f)
        {
            just_appear = true;
            return(from_pos);
        }
        if (appear_distance >= magnitude)
        {
            return(from_pos);
        }
        if (col_offset.y <= 0f)
        {
            col_offset.y = 0.1f;
        }
        List <CastHitInfo> list = new List <CastHitInfo>();

        RaycastHit[] array = Physics.RaycastAll(target_pos + col_offset, -val, magnitude, 393728);
        int          i     = 0;

        for (int num = array.Length; i < num; i++)
        {
            CastHitInfo castHitInfo = new CastHitInfo();
            castHitInfo.distance     = array[i].get_distance() - col_radius;
            castHitInfo.faceToTarget = true;
            castHitInfo.collider     = array[i].get_collider();
            list.Add(castHitInfo);
        }
        CastHitInfo castHitInfo2 = new CastHitInfo();

        castHitInfo2.distance     = 0f;
        castHitInfo2.faceToTarget = !target_inside;
        castHitInfo2.collider     = null;
        list.Add(castHitInfo2);
        array = Physics.RaycastAll(from_pos + col_offset, val, magnitude, 393728);
        int j = 0;

        for (int num2 = array.Length; j < num2; j++)
        {
            CastHitInfo castHitInfo3 = new CastHitInfo();
            castHitInfo3.distance     = magnitude - array[j].get_distance() + col_radius;
            castHitInfo3.faceToTarget = false;
            castHitInfo3.collider     = array[j].get_collider();
            list.Add(castHitInfo3);
        }
        CastHitInfo castHitInfo4 = new CastHitInfo();

        castHitInfo4.distance     = magnitude;
        castHitInfo4.faceToTarget = from_inside;
        castHitInfo4.collider     = null;
        list.Add(castHitInfo4);
        list.Sort(delegate(CastHitInfo a, CastHitInfo b)
        {
            float num6 = a.distance - b.distance;
            if (num6 == 0f)
            {
                if (a.faceToTarget == b.faceToTarget)
                {
                    return(0);
                }
                return(a.faceToTarget ? 1 : (-1));
            }
            return((num6 > 0f) ? 1 : (-1));
        });
        int k = 0;

        for (int count = list.Count; k < count; k++)
        {
            CastHitInfo castHitInfo5 = list[k];
            if (!castHitInfo5.checkCollider && !(castHitInfo5.collider == null))
            {
                int num3 = k;
                while (0 <= num3 && num3 < count)
                {
                    CastHitInfo castHitInfo6 = list[num3];
                    if (num3 != k)
                    {
                        if (castHitInfo6.collider == castHitInfo5.collider)
                        {
                            castHitInfo6.checkCollider = true;
                            break;
                        }
                        castHitInfo6.enable = false;
                    }
                    num3 = ((!castHitInfo5.faceToTarget) ? (num3 - 1) : (num3 + 1));
                }
            }
        }
        float num4 = magnitude;

        for (int num5 = list.Count - 2; num5 >= 0; num5--)
        {
            CastHitInfo castHitInfo7 = list[num5];
            CastHitInfo castHitInfo8 = list[num5 + 1];
            if (castHitInfo7.enable && castHitInfo8.enable && castHitInfo7.distance != castHitInfo8.distance && !castHitInfo7.faceToTarget && castHitInfo8.faceToTarget)
            {
                if (castHitInfo7.distance <= appear_distance && castHitInfo8.distance >= appear_distance)
                {
                    num4        = appear_distance;
                    just_appear = true;
                    break;
                }
                if (castHitInfo7.distance >= appear_distance)
                {
                    num4 = castHitInfo7.distance;
                }
                else if (castHitInfo8.distance >= appear_distance - appear_margin)
                {
                    num4 = castHitInfo8.distance;
                    break;
                }
            }
        }
        if (num4 == magnitude)
        {
            return(from_pos);
        }
        return(target_pos - val.get_normalized() * num4);
    }