public SO_weapon(SO_weaponData _data, Ship _host) { p = new SO_weaponData(_data); host = _host; activated = false; fire = false; }
public SO_weaponData(SO_weaponData value) { Type = value.Type; Damage = value.Damage; Reload = value.Reload; AmmoSpeed = value.AmmoSpeed; ActiveTime = value.ActiveTime; SqrDistanse_max = value.SqrDistanse_max; Capasitor_use = value.Capasitor_use; }
public ShipData(ShipData value, Ship ship) : base(value) { ShipLink = ship; SpeedMax = value.SpeedMax; RotationSpeed = value.RotationSpeed; AccelerationMax = value.AccelerationMax; SpeedNew = value.SpeedNew; Hull_full = value.Hull_full; Armor_full = value.Armor_full; Shield_full = value.Shield_full; Capasitor_full = value.Capasitor_full; Hull = value.Hull; Armor = value.Armor; Shield = value.Shield; Capasitor = value.Capasitor; Hull_restore = value.Hull_restore; Armor_restore = value.Armor_restore; Shield_restore = value.Shield_restore; Capasitor_restore = value.Capasitor_restore; AgrDistance = value.AgrDistance; VisionDistance = value.VisionDistance; Destroyed = value.Destroyed; Hidden = value.Hidden; Mob = value.Mob; WarpDriveStartTime = value.WarpDriveStartTime; WarpSpeed = value.WarpSpeed; Weapons = new SO_weaponData[value.Weapons.Length]; for (int i = 0; i < value.Weapons.Length; i++) { Weapons[i] = new SO_weaponData(value.Weapons[i]); } Equipments = new SO_equipmentData[value.Equipments.Length]; for (int i = 0; i < value.Equipments.Length; i++) { Equipments[i] = new SO_equipmentData(value.Equipments[i]); } }
private SO_weaponData[] GetWeapons(int ship_id) { List <SO_weaponData> retList = new List <SO_weaponData>(); SO_weaponData _weapon; string qwery = @"SELECT SO_id , WeaponType, active, damage, reload, ammoSpeed, activeTime, sqrDistanse_max, capasitor_use FROM SO_weapondata WHERE SO_id=" + ship_id.ToString(); GetReader(qwery); while (reader.Read()) { int _type = 0; _weapon = new SO_weaponData(); // if (!reader.IsDBNull(0)) _weapon. = reader.GetInt32(0); if (!reader.IsDBNull(1)) { _type = reader.GetInt32(1); } // if (!reader.IsDBNull (2))_weapon.active = (reader.GetInt32(2) == 1); if (!reader.IsDBNull(3)) { _weapon.Damage = reader.GetFloat(3); } if (!reader.IsDBNull(4)) { _weapon.Reload = reader.GetFloat(4); } if (!reader.IsDBNull(5)) { _weapon.AmmoSpeed = reader.GetFloat(5); } if (!reader.IsDBNull(6)) { _weapon.ActiveTime = reader.GetFloat(6); } if (!reader.IsDBNull(7)) { _weapon.SqrDistanse_max = reader.GetFloat(7); } if (!reader.IsDBNull(8)) { _weapon.Capasitor_use = reader.GetFloat(8); } switch (_type) { case 1: _weapon.Type = SO_weaponData.WeaponType.laser; break; case 2: _weapon.Type = SO_weaponData.WeaponType.missile; break; case 3: _weapon.Type = SO_weaponData.WeaponType.projective; break; } retList.Add(_weapon); } SO_weaponData[] retArray = new SO_weaponData[retList.Count]; for (int i = 0; i < retList.Count; i++) { retArray[i] = retList[i]; } return(retArray); }