private void SaveDataHelper <I, D, E>(InteractionController interactionCont1, InteractionController interactionCont2,
                                          I internalData, D myBundle, D theirBundle, AddEventTypeToInfoBundleFcn <I, D, E> addInfoFcn) where E : EventData <I, D>, new()
    {
        if (interactionCont1 == null || interactionCont2 == null)
        {
            return;
        }
        E data = new E();

        data.Init(internalData, myBundle, theirBundle);

        CollisionAndTriggerInfoBundle collisionTriggerInfoBundle = null;

        if (!allCollisionAndTriggerInfo.TryGetValue(interactionCont1.gameObject.GetInstanceID(), out collisionTriggerInfoBundle))
        {
            // if info for the object doesn't exist, create it
            collisionTriggerInfoBundle = new CollisionAndTriggerInfoBundle(interactionCont1);
            allCollisionAndTriggerInfo.Add(interactionCont1.gameObject.GetInstanceID(), collisionTriggerInfoBundle);
        }

        // add collision enter info the object paired with the interaction controller it interacted with
        CollisionAndTriggerInfo collisionTriggerInfo = null;

        if (!collisionTriggerInfoBundle.objBasedInteractionsDict.TryGetValue(interactionCont2, out collisionTriggerInfo))
        {
            // if collision info doesn't exist yet add it
            collisionTriggerInfo = new CollisionAndTriggerInfo();
            addInfoFcn(collisionTriggerInfo, data);
            collisionTriggerInfoBundle.objBasedInteractionsDict.Add(interactionCont2, collisionTriggerInfo);
        }
        else
        {
            addInfoFcn(collisionTriggerInfo, data);
        }

        // save interaction just based on type also
        addInfoFcn(collisionTriggerInfoBundle.eventBasedInteractions, data);
    }
 private void AddCollisionExitDataToInfoBundle(CollisionAndTriggerInfo info, CollisionData data)
 {
     info.collisionExitData.Add(data);
 }
 private void AddTriggerExitDataToInfoBundle(CollisionAndTriggerInfo info, TriggerStayExitData data)
 {
     info.triggerExitData.Add(data);
 }
 public CollisionAndTriggerInfoBundle(InteractionController interactionCont)
 {
     this.interactionCont     = interactionCont;
     objBasedInteractionsDict = new Dictionary <InteractionController, CollisionAndTriggerInfo>();
     eventBasedInteractions   = new CollisionAndTriggerInfo();
 }