Inheritance: Obi.ObiShapeTracker
        /**
         * Creates an OniColliderTracker of the appropiate type.
         */
        protected override void CreateTracker()
        {
            if (tracker != null)
            {
                Oni.SetColliderShape(oniCollider, IntPtr.Zero);
                tracker.Destroy();
                tracker = null;
            }

            if (sourceCollider is CircleCollider2D)
            {
                tracker = new ObiCircleShapeTracker2D((CircleCollider2D)sourceCollider);
            }
            else if (sourceCollider is BoxCollider2D)
            {
                tracker = new ObiBoxShapeTracker2D((BoxCollider2D)sourceCollider);
            }
            else if (sourceCollider is CapsuleCollider2D)
            {
                tracker = new ObiCapsuleShapeTracker2D((CapsuleCollider2D)sourceCollider);
            }
            else if (sourceCollider is EdgeCollider2D)
            {
                tracker = new ObiEdgeShapeTracker2D((EdgeCollider2D)sourceCollider);
            }
            else
            {
                Debug.LogWarning("Collider2D type not supported by Obi.");
            }

            if (tracker != null)
            {
                Oni.SetColliderShape(oniCollider, tracker.OniShape);
            }
        }
        /**
         * Creates an OniColliderTracker of the appropiate type.
         */
        protected override void CreateTracker()
        {
            if (tracker != null)
            {
                tracker.Destroy();
                tracker = null;
            }

            if (sourceCollider is CircleCollider2D)
            {
                tracker = new ObiCircleShapeTracker2D(this, (CircleCollider2D)sourceCollider);
            }
            else if (sourceCollider is BoxCollider2D)
            {
                tracker = new ObiBoxShapeTracker2D(this, (BoxCollider2D)sourceCollider);
            }
            else if (sourceCollider is CapsuleCollider2D)
            {
                tracker = new ObiCapsuleShapeTracker2D(this, (CapsuleCollider2D)sourceCollider);
            }
            else if (sourceCollider is EdgeCollider2D)
            {
                tracker = new ObiEdgeShapeTracker2D(this, (EdgeCollider2D)sourceCollider);
            }
            else
            {
                Debug.LogWarning("Collider2D type not supported by Obi.");
            }
        }
Esempio n. 3
0
 /**
  * Creates an OniColliderTracker of the appropiate type.
  */
 protected override void CreateTracker()
 {
     if (unityCollider is CircleCollider2D)
     {
         tracker = new ObiCircleShapeTracker2D((CircleCollider2D)unityCollider);
     }
     else if (unityCollider is BoxCollider2D)
     {
         tracker = new ObiBoxShapeTracker2D((BoxCollider2D)unityCollider);
     }
     else if (unityCollider is CapsuleCollider2D)
     {
         tracker = new ObiCapsuleShapeTracker2D((CapsuleCollider2D)unityCollider);
     }
     else if (unityCollider is EdgeCollider2D)
     {
         tracker = new ObiEdgeShapeTracker2D((EdgeCollider2D)unityCollider);
     }
     else
     {
         Debug.LogWarning("Collider2D type not supported by Obi.");
     }
 }