Beispiel #1
0
 public static void Add(Entity entity)
 {
     if (!isUpdating)
         AddEntity(entity);
     else
         addedEntities.Add(entity);
 }
Beispiel #2
0
 private static void AddEntity(Entity entity)
 {
     entities.Add(entity);
     if (entity is Bullet)
         bullets.Add(entity as Bullet);
     else if (entity is Enemy)
         enemies.Add(entity as Enemy);
     else if (entity is BlackHole)
         blackHoles.Add(entity as BlackHole);
 }
Beispiel #3
0
 private static bool IsColliding(Entity a, Entity b)
 {
     float radius = a.Radius + b.Radius;
     return !a.IsExpired && !b.IsExpired && Vector2.DistanceSquared(a.Position, b.Position) < radius * radius;
 }