Exemple #1
0
 // Token: 0x0600140A RID: 5130 RVA: 0x0006EE28 File Offset: 0x0006D028
 protected virtual VRTK_Control.Direction DetectDirection()
 {
     VRTK_Control.Direction result = VRTK_Control.Direction.autodetect;
     if (this.doorHinge && !this.doorHingeCreated)
     {
         if (this.doorHinge.axis == Vector3.right)
         {
             result = VRTK_Control.Direction.x;
         }
         else if (this.doorHinge.axis == Vector3.up)
         {
             result = VRTK_Control.Direction.y;
         }
         else if (this.doorHinge.axis == Vector3.forward)
         {
             result = VRTK_Control.Direction.z;
         }
     }
     else if (this.handles)
     {
         Bounds bounds  = VRTK_SharedMethods.GetBounds(this.handles.transform, base.transform, null);
         Bounds bounds2 = VRTK_SharedMethods.GetBounds(this.GetDoor().transform, base.transform, this.handles.transform);
         if (bounds.center.y + bounds.extents.y > bounds2.center.y + bounds2.extents.y || bounds.center.y - bounds.extents.y < bounds2.center.y - bounds2.extents.y)
         {
             result = VRTK_Control.Direction.x;
         }
         else
         {
             result = VRTK_Control.Direction.y;
         }
     }
     return(result);
 }
Exemple #2
0
        // Token: 0x060013E4 RID: 5092 RVA: 0x0006DAA0 File Offset: 0x0006BCA0
        protected virtual VRTK_Control.Direction DetectDirection()
        {
            VRTK_Control.Direction result = VRTK_Control.Direction.autodetect;
            if (!this.handle)
            {
                return(result);
            }
            Bounds bounds  = VRTK_SharedMethods.GetBounds(this.handle.transform, base.transform, null);
            Bounds bounds2 = VRTK_SharedMethods.GetBounds(this.lid.transform, base.transform, null);
            float  num     = Mathf.Abs(bounds.center.x - (bounds2.center.x + bounds2.extents.x));
            float  num2    = Mathf.Abs(bounds.center.z - (bounds2.center.z + bounds2.extents.z));
            float  num3    = Mathf.Abs(bounds.center.x - (bounds2.center.x - bounds2.extents.x));
            float  num4    = Mathf.Abs(bounds.center.z - (bounds2.center.z - bounds2.extents.z));

            if (VRTK_SharedMethods.IsLowest(num, new float[]
            {
                num2,
                num3,
                num4
            }))
            {
                result = VRTK_Control.Direction.x;
            }
            else if (VRTK_SharedMethods.IsLowest(num3, new float[]
            {
                num,
                num2,
                num4
            }))
            {
                result = VRTK_Control.Direction.x;
            }
            else if (VRTK_SharedMethods.IsLowest(num2, new float[]
            {
                num,
                num3,
                num4
            }))
            {
                result = VRTK_Control.Direction.z;
            }
            else if (VRTK_SharedMethods.IsLowest(num4, new float[]
            {
                num,
                num2,
                num3
            }))
            {
                result = VRTK_Control.Direction.z;
            }
            return(result);
        }
Exemple #3
0
        // Token: 0x06001409 RID: 5129 RVA: 0x0006EDB8 File Offset: 0x0006CFB8
        protected virtual Vector3 Direction2Axis(VRTK_Control.Direction givenDirection)
        {
            Vector3 zero = Vector3.zero;

            switch (givenDirection)
            {
            case VRTK_Control.Direction.x:
                zero = new Vector3(1f, 0f, 0f);
                break;

            case VRTK_Control.Direction.y:
                zero = new Vector3(0f, 1f, 0f);
                break;

            case VRTK_Control.Direction.z:
                zero = new Vector3(0f, 0f, 1f);
                break;
            }
            return(zero);
        }