예제 #1
0
 /// <summary>
 /// Test collisions with another group.
 /// </summary>
 /// <param name="groupToTest">Other group to test.</param>
 public void DoCollision(ColliderGroup groupToTest)
 {
     for (int i = 0; i < m_entries.Count; ++i)
         for(int j = 0; j < groupToTest.m_entries.Count; ++j)
             if (m_methods.TestCollision(m_entries[i].collider, groupToTest.m_entries[j].collider))
             {
                 if(m_entries[i].onCollision != null)
                     m_entries[i].onCollision(groupToTest.m_entries[j].collider);
                 if (groupToTest.m_entries[j].onCollision != null)
                     groupToTest.m_entries[j].onCollision(m_entries[i].collider);
             }
 }
 public static void Initialise()
 {
     for (int i = 0; i < DestructibleColliders.Length; ++i)
         DestructibleColliders[i] = new ColliderGroup();
 }
 public InsoGame()
 {
     colliders = new ColliderGroup();
 }
 public void SetHitEvent(AttackType attackType, ColliderGroup.OnCollision attackHitEvent)
 {
     int i = (int)attackType;
     if (m_attackHitEventCache[i] == null)
         DestructibleColliders[i].Add(m_collider, attackHitEvent);
     else
         DestructibleColliders[i].ReplaceAction(m_collider, attackHitEvent);
     m_attackHitEventCache[i] = attackHitEvent;
 }