public int AddBullet(double x, double y, double velocityX, double velocityY, double radius, int damage, int ownerId) { GameObject owner; if (GameObjects.TryGetValue(ownerId, out owner)) { Bullet bullet = new Bullet(new Point(x, y), new Vector(velocityX, velocityY), radius, damage, owner); if (!GameObjects.TryAdd(bullet.Id, bullet)) { Console.WriteLine($"Bullet {bullet.Id} dongoofed"); return 0; } bullet.Register(Observation.EXTERMINATION, this, ExterminationNotification); return bullet.Id; } return 0; }
public int AddBullet(double x, double y, double velocityX, double velocityY, double diameter, int damage, int bulletType, int ownerId) { GameObject owner; if (GameObjects.TryGetValue(ownerId, out owner)) { Bullet bullet = new Bullet(new Point(x, y), new Vector(velocityX, velocityY), diameter, damage, bulletType, owner); if (!GameObjects.TryAdd(bullet.Id, bullet)) { BoDConsole.WriteLine($"Could not add {bullet.Id} an existing gameobject has type {GameObjects[bullet.Id].Type}"); BoDConsole.WriteLine($"Bullet {bullet.Id} dongoofed"); return 0; } bullet.Register(Observation.EXTERMINATION, this, ExterminationNotification); bullet.WallId = CollisionHandler.GetFirstObjectIntersectingPath<Wall>(GameObjects.Values, bullet); return bullet.Id; } return 0; }