Пример #1
0
        /// <summary>
        /// Get back the string id when you have a collision;
        /// </summary>
        /// <param name="box"></param>
        /// <returns></returns>
        public static string CollisionDetection(CollisionComponent caller)
        {
            foreach (CollisionComponent a in colliders)
            {
                if (a.bounds.Intersects(caller.bounds) && caller.bounds != a.bounds)
                    return a.id;

            }
            return "";
        }
Пример #2
0
 /// <summary>
 /// Get back the string id when you have a collision;
 /// </summary>
 /// <param name="box"></param>
 /// <returns></returns>
 public static string CollisionDetection(CollisionComponent caller)
 {
     foreach (CollisionComponent a in colliders)
     {
         if (a.bounds.Intersects(caller.bounds) && caller.bounds != a.bounds)
         {
             return(a.id);
         }
     }
     return("");
 }
Пример #3
0
 /// <summary>
 /// Get back the string id when you enter a trigger;
 /// </summary>
 /// <param name="box"></param>
 /// <returns></returns>
 public static string TriggerDetection(CollisionComponent caller)
 {
     foreach (CollisionComponent a in triggers)
     {
         if (a.bounds.Intersects(caller.bounds) && caller.bounds != a.bounds)
         {
             if (caller.triggerEntered && a.id != caller.lastEntered)
                 return "";
             caller.triggerEntered = true;
             caller.lastEntered = a.id;
             return a.id;
         }
     }
     caller.triggerEntered = false;
     return "";
 }
Пример #4
0
 /// <summary>
 /// Get back the string id when you enter a trigger;
 /// </summary>
 /// <param name="box"></param>
 /// <returns></returns>
 public static string TriggerDetection(CollisionComponent caller)
 {
     foreach (CollisionComponent a in triggers)
     {
         if (a.bounds.Intersects(caller.bounds) && caller.bounds != a.bounds)
         {
             if (caller.triggerEntered && a.id != caller.lastEntered)
             {
                 return("");
             }
             caller.triggerEntered = true;
             caller.lastEntered    = a.id;
             return(a.id);
         }
     }
     caller.triggerEntered = false;
     return("");
 }