public Boat(IGameContext context, World world, BoatTemplate template) : base(context, world, template.SpriteTemplate) { this.BoatTemplate = template; this.radar = new Radar(this); this.Mass = template.Mass; this.health = this.BoatTemplate.MaxHealth; this.weapons = new Weapon[this.BoatTemplate.Weapons.Count]; foreach (var placement in this.BoatTemplate.Weapons) { this.AddWeapon(placement.Weapon); } this.Body.AngularDamping = this.Body.LinearDamping = PhysicalObject.WaterFriction; this.Fixture.Restitution = 0.01f; }
private Dictionary <int, List <BoatTemplate> > GetBoatTemplatesByFactionId(IDbConnection connection) { Dictionary <int, List <BoatTemplate> > factionTemplateMap = new Dictionary <int, List <BoatTemplate> >(); IDbCommand command = connection.CreateCommand(); command.CommandText = "SELECT * FROM BoatTemplate"; var reader = command.ExecuteReader(); while (reader.Read()) { int id = reader.GetInt32(0); int factionId = reader.GetInt32(1); string name = reader[2].ToString(); ushort soldierCap = (ushort)reader.GetInt16(3); BoatTemplate boatTemplate = new BoatTemplate(id, name, soldierCap); if (!factionTemplateMap.ContainsKey(factionId)) { factionTemplateMap[factionId] = new List <BoatTemplate>(); } factionTemplateMap[factionId].Add(boatTemplate); } return(factionTemplateMap); }