public void Increment(ShipTypes shipType) { if (TargetShipType.Contains((int)shipType)) { Increment(); } }
public ShipTypes SunkShip; //Filled in if ResultType is Sunk public AttackResult(int playerIndex, Position position, AttackResultType attackResultType = AttackResultType.Miss, ShipTypes sunkShip = ShipTypes.None) { PlayerIndex = playerIndex; Position = position; ResultType = attackResultType; SunkShip = sunkShip; }
public Ship(ShipTypes type, int id) { ShipId = id; Type = type; Condition = ShipCondition.Intact; switch (Type) { case ShipTypes.Destroyer: Health = 2; break; case ShipTypes.Submarine: Health = 3; break; case ShipTypes.Cruiser: Health = 4; break; case ShipTypes.Battleship: Health = 5; break; case ShipTypes.Carrier: Health = 5; break; } }
public MissionClearConditionResult CheckFlagshipType(ShipTypes shipType) { Assert( members.FirstOrDefault()?.MasterShip?.ShipType == shipType, () => $"旗艦:{KCDatabase.Instance.ShipTypes[(int)shipType].Name}"); return(this); }
public void Update(RawMasterInfo rpInfo) { Ships.UpdateRawData(rpInfo.Ships, r => new ShipInfo(r), (rpData, rpRawData) => rpData.Update(rpRawData)); ShipTypes.UpdateRawData(rpInfo.ShipTypes, r => new ShipTypeInfo(r), (rpData, rpRawData) => rpData.Update(rpRawData)); Equipment.UpdateRawData(rpInfo.Equipment, r => new EquipmentInfo(r), (rpData, rpRawData) => rpData.Update(rpRawData)); EquipmentTypes.UpdateRawData(rpInfo.EquipmentTypes, r => new EquipmentTypeInfo(r), (rpData, rpRawData) => rpData.Update(rpRawData)); Items.UpdateRawData(rpInfo.Items, r => new ItemInfo(r), (rpData, rpRawData) => rpData.Update(rpRawData)); MapAreas.UpdateRawData(rpInfo.MapAreas, r => new MapAreaInfo(r), (rpData, rpRawData) => rpData.Update(rpRawData)); Maps.UpdateRawData(rpInfo.Maps, r => new MapMasterInfo(r), (rpData, rpRawData) => rpData.Update(rpRawData)); Expeditions.UpdateRawData(rpInfo.Expeditions, r => new ExpeditionInfo(r), (rpData, rpRawData) => rpData.Update(rpRawData)); EventMapCount = (from rArea in MapAreas.Values where rArea.IsEventArea join rMap in Maps.Values on rArea.ID equals rMap.AreaID select rMap).Count(); if (r_InitializationLock != null) { r_InitializationLock.Set(); r_InitializationLock.Dispose(); r_InitializationLock = null; } }
public ShipStats(ShipStatData data) { ShieldType = data.ShieldType; ShipType = data.ShipType; Id = data.Id; Name = data.Name; Description = data.Description; MaxShields = data.MaxShields; MaxHealth = data.MaxHealth; Energy = data.Energy; MaxHolds = data.TotalHolds; BaseWeight = data.BaseWeight; Graphic = data.Graphic; ThrustGraphic = data.ThrustGraphic; Class = data.Class; TurnRate = data.TurnRate; EnergyRegenRate = data.EnergyRegenRate; HaloShieldRegenRate = data.HaloShieldRegenRate; SlowShieldRegenRate = data.SlowShieldRegenRate; BoostBonus = data.BoostBonus; TopSpeed = data.TopSpeed; BaseThrustForward = data.BaseThrustForward; BaseThrustReverse = data.BaseThrustReverse; BaseThrustLateral = data.BaseThrustLateral; }
public Ship CreateShip(Random r, ShipTypes shipType) { List <Cell> possibleCells = allPossibleCells; int dirCount = 4; int numOfCell = r.Next(possibleCells.Count - 1); Cell cell = possibleCells[numOfCell]; int x = cell.X; int y = cell.Y; int dirNum = r.Next(0, dirCount); Directions dir = (Directions)dirNum; int deckCount = GetDeckCount(shipType); bool success = CheckCells(y, x, this, GetDeckCount(shipType), dir); while (success == false) { if (CheckAllDirections(x, y, deckCount, ref dir) != true) { possibleCells.RemoveAt(numOfCell); SetNewCoordinates(r, possibleCells, deckCount, ref x, ref y, ref dir, ref numOfCell); success = CheckCells(y, x, this, deckCount, dir); } else { break; } } Ship ship = new Ship(x, y, shipType, dir); return(ship); }
public ShipTypes Update(ShipTypes a) { try { var item = ctx.TypeI.Find(a.Id); if (item != null) { if (!object.Equals(item, a)) { ctx.Entry(item).CurrentValues.SetValues(a); ctx.SaveChanges(); } else { ctx.SaveChanges(); } return(ctx.TypeI.Find(a.Id)); } else { return(null); } } catch { throw; } }
protected Texture2D GetTexture(ShipTypes shipType) { if (_textureManager == null) { return(null); } switch (shipType) { case ShipTypes.Barge: return(_textureManager.ZYVariantBarge); case ShipTypes.Reaper: return(_textureManager.Reaper); case ShipTypes.BattleCruiser: return(_textureManager.Battlecruiser); case ShipTypes.Penguin: return(_textureManager.Penguin); case ShipTypes.Dread: return(_textureManager.Dread); default: ConsoleManager.WriteLine("Texture not implemented for ShipType " + shipType, ConsoleMessageType.Error); return(null); } }
// Vérifie si le bateau est coulé public bool HasSunkenShip(ShipTypes ship) { for (int p = 0; p < (int)ShipTypes.SIZEOF_SHIPTYPES; p++) if (ShipPositions[(int)ship, p].X != -1) return false; return true; }
public ShipCreationProperties(float posX, float posY, int areaId, PilotTypes pilotType, ShipTypes shipType, IEnumerable <WeaponTypes> weaponTypes) { PosX = posX; PosY = posY; AreaId = areaId; PilotType = pilotType; ShipType = shipType; WeaponTypes = weaponTypes; SetAsActiveShip = false; }
public void AddShipToFleet(Ship ship, ShipTypes droneType) { if (!ship.IsOperational() || ships.Exists(x => x._cubeGrid == ship._cubeGrid)) { return; } ship.SetOwner(PlayerId); ship.SetFleetZone(ship.GetPosition()); ships.Add(ship); }
/// <summary> /// Arena Enter packet constructor /// </summary> public ArenaEnterPacket() { m_nArenaIdentifier = 0xFFFF; m_shipType = ShipTypes.Spectator; m_nResolutionX = 1280; m_nResolutionY = 1024; m_nHearVoices = 1; m_nBlockObscenity = 0; m_strArenaName = ""; }
//public int DeckCount { get { return deckCount; } } public Ship(int x, int y, ShipTypes shipType, Directions direction) { Dir = direction; CellsList = new List <Cell>(); int deckCount = 0; switch (shipType) { case ShipTypes.BOAT: deckCount = 1; break; case ShipTypes.DESTROYER: deckCount = 2; break; case ShipTypes.CRUISER: deckCount = 3; break; case ShipTypes.BATTLESHIP: deckCount = 4; break; } switch (direction) { case Directions.UP: for (int i = 0; i < deckCount; i++) { CellsList.Add(new Cell(x, y - i)); } break; case Directions.RIGHT: for (int i = 0; i < deckCount; i++) { CellsList.Add(new Cell(x + i, y)); } break; case Directions.DOWN: for (int i = 0; i < deckCount; i++) { CellsList.Add(new Cell(x, y + i)); } break; case Directions.LEFT: for (int i = 0; i < deckCount; i++) { CellsList.Add(new Cell(x - i, y)); } break; } }
internal void AddFighterToFleet(Ship ship, ShipTypes droneType) { if (!ship.IsOperational() || fighters.Exists(x => x._cubeGrid == ship._cubeGrid)) { return; } ship.SetOwner(PlayerId); ship.SetFleetZone(ship.GetPosition()); fighters.Add(ship); //MyAPIGateway.Session.Factions.AddNewNPCToFaction(12); }
/// <summary> /// Clear the database /// </summary> public void Clear() { MasterShips.Clear(); ShipTypes.Clear(); MasterEquipments.Clear(); EquipmentTypes.Clear(); MasterUseItems.Clear(); MapArea.Clear(); MapInfo.Clear(); Mission.Clear(); }
public ShipManager() { // Initialisation du tableau de position ShipPositions = new Point[(int)ShipTypes.SIZEOF_SHIPTYPES, (int)ShipTypes.SIZEOF_SHIPTYPES]; for (int c = 0; c < (int)ShipTypes.SIZEOF_SHIPTYPES; c++) for (int r = 0; r < (int)ShipTypes.SIZEOF_SHIPTYPES; r++) ShipPositions[c, r] = new Point(-1, -1); // Le premier bateau à placer est le porte-avions CurrentShipIndex = ShipTypes.PORTEAVIONS; CurrentShipPosition = new Point(); }
public FleetController(String fleetName, long playerid, ShipTypes fighter, ShipTypes largeShip, Vector3D spawnLocation, int maxFighterCount, int maxshipcount) { this.largeShip = largeShip; maxNumberOfFighters = maxFighterCount; maxNumberOfShips = maxshipcount; LogPath = fleetName; PlayerId = playerid; fighterShip = fighter; spawnZone = spawnLocation; numberOfFleets++; fleetNum = numberOfFleets; }
//------------------------------------------ #region Types Insert public ShipTypes Insert(ShipTypes a) { try { a = ctx.TypeI.Add(a); ctx.SaveChanges(); return(a); } catch { throw; } }
/// <summary> /// Ship that is sold in a port. /// </summary> /// <param name="p">Port that ship is sold at</param> /// <param name="shipType"></param> /// <param name="currentPrice"></param> /// <param name="numInStock"></param> /// <param name="cargoSpaceTaken"></param> public ShipGood(ShipTypes shipType, string name, string description, Int16 ID, int currentPrice, int numInStock, Int16 shields, Int16 hull, Int16 energy, byte value, Int16 cargo) : base(GoodTypes.Ship, name, currentPrice, numInStock) // Not sure about inception ships { this.shipType = shipType; this.description = description; this.ID = ID; this.shields = shields; this.hull = hull; this.energy = energy; this.value = value; this.cargo = cargo; }
public void PlaceShipOnBoard(Player player) { for (ShipTypes s = ShipTypes.Destroyer; s <= ShipTypes.Carrier; s++) { ShipRequest ShipToPlace = new ShipRequest(); ShipPlacements result; do { ShipToPlace = ControlInput.GetLocationFromComputer(); ShipToPlace.ShipType = s; result = player.PlayerBoard.PlaceShip(ShipToPlace); } while (result != ShipPlacements.Ok); } }
public static Ship Add(ShipTypes typeOfShip) { switch (typeOfShip) { case ShipTypes.Defender: { Ship newShip = new DefenderShip(); shipRegistry.Add(newShip); return(newShip); } default: throw new Exception("Ship not programmed for"); } }
public Escort(Transform me) { Name = "Escort"; Ship = me; DecayFactor = 5; //Set new variables here to ensure they're overwritten delayCounter = 0; //I don't understand the other methods of doing this so fireDelay = 0.1f; //this will have to do for now ShipTypes sl = GameObject.FindGameObjectsWithTag("Library")[0].GetComponent <ShipTypes>(); int index = sl.GetIndexFromName(Name); sprite = sl.Sprites[index]; Bullet = sl.Bullets[index]; shield = sl.Secondary[index]; }
protected Model GetModel(ShipTypes shipType) { if (_textureManager == null) { return(null); } switch (shipType) { case ShipTypes.SuperCoolAwesome3DShip: return(_textureManager.SuperCoolAwesome3DShipModel); default: ConsoleManager.WriteLine("Model not implemented for ShipType " + shipType, ConsoleMessageType.Error); return(null); } }
//Player1Board1 public GameBoard(int tableDimension, bool isAutomatic) { ShipTypes.Add(Ships.Carrier); ShipTypes.Add(Ships.Battleship); ShipTypes.Add(Ships.Submarine); ShipTypes.Add(Ships.Cruiser); ShipTypes.Add(Ships.Patrol); ShipLengths.Add(4); ShipLengths.Add(3); ShipLengths.Add(2); ShipLengths.Add(1); ShipLengths.Add(0); TableDimension = tableDimension; this.isAutomatic = isAutomatic; //player 1 own ships table for (int i = 0; i < TableDimension; i++) { Player1Board1.Add(new List <BoardSquareState>()); for (int j = 0; j < TableDimension; j++) { Player1Board1[i].Add(BoardSquareState.Empty); } } //player 2 own ships table for (int i = 0; i < TableDimension; i++) { Player2Board1.Add(new List <BoardSquareState>()); for (int j = 0; j < TableDimension; j++) { Player2Board1[i].Add(BoardSquareState.Empty); } } }
public bool Delete(ShipTypes a) { try { if (ctx.TypeI.Find(a.Id) != null) { ctx.TypeI.Remove(a); return(ctx.SaveChanges() > 0); } else { return(false); } } catch { throw; } }
/// <summary> /// Processes the fired shot /// </summary> /// <returns>Shot is missed or hit</returns> /// <param name="coords">Coordinates</param> public ShotResult ProcessShot(BoardCorrdinates coords) { var panel = GameBoard.Panels.At(coords.Row, coords.Column); if (!panel.IsOccupied) { Console.WriteLine(" > \"You missed shot!\""); return(ShotResult.Miss); } var ship = ShipTypes.First(x => x.AttackerShipType == panel.AttackerShipType); ship.Hits++; Console.WriteLine(" > \"It's a Hit!\""); if (ship.IsSunk) { Console.WriteLine(" > \"You have sunk " + ship.Name + ".\"\n\n"); } return(ShotResult.Hit); }
public static Battleships CreateShip(ShipTypes type) { switch (type) { case ShipTypes.Destroyer: return(new Battleships(ShipTypes.Destroyer, 2)); case ShipTypes.Cruiser: return(new Battleships(ShipTypes.Cruiser, 3)); case ShipTypes.Submarine: return(new Battleships(ShipTypes.Submarine, 3)); case ShipTypes.Battleship: return(new Battleships(ShipTypes.Battleship, 4)); default: return(new Battleships(ShipTypes.Carrier, 5)); } }
public Unit(ShipTypes ShipType, string Name, GameVector Position, GameVector Size, DerivativeControlledParameter Speed, DerivativeControlledParameter RotationSpeed, DerivativeControlledParameter RotationAngle, Gun Gun, float HP, int team, Shots shots, float BlowDamage, float BlowRadius) { shipType = ShipType; blowDamage = BlowDamage; blowRadius = BlowRadius; name = Name; position = Position; size = Size; speed = Speed; rotationSpeed = RotationSpeed; rotationAngle = RotationAngle; gun = Gun; gun.owner = this; this.hp = HP; this.team = team; maxTimeAfterDeath = 5 * 0.2f; timeAfterDeath = 0; IsAliveInPrevLoop = true; this.shots = Core.shots; }
public void Update() { if (!ready) { return; } IEnumerable <Ship> baseships = Staff.Current.Homeport.Ships; if (baseships == null) { return; } int[] typeid = ShipTypes.Where(x => x.IsSelected).Select(x => x.ShipType.Id).ToArray(); baseships = baseships.Where(x => typeid.Contains(x.ShipInfo.ShipType.Id)); Filters.ForEach(x => baseships = x.Apply(baseships)); Ship[] sortedships = baseships.ToArray(); MultiComparer <Ship> comparer = new MultiComparer <Ship> { Selectors = Selectors.TakeWhile(x => x.SelectedIndex != 0).Select(x => new Tuple <Func <Ship, int>, bool>(x.Sorter.KeySelector, x.IsDescend)) }; Array.Sort(sortedships, comparer); ShownShips = sortedships.Select(ItemWithIndex <Ship> .Generator).ToArray(); }
public int GetDeckCount(ShipTypes shipType) { int deckCount = 1; switch (shipType) { case ShipTypes.BOAT: deckCount = 1; break; case ShipTypes.DESTROYER: deckCount = 2; break; case ShipTypes.CRUISER: deckCount = 3; break; case ShipTypes.BATTLESHIP: deckCount = 4; break; } return(deckCount); }
public override void Parse(string[] data) { int index = 1; this.Id = data[index++]; int.TryParse(data[index++], out this.SourceId); this.Time = DateTime.Parse(data[index++]); double x = 0; double.TryParse(data[index++], out x); double y = 0; double.TryParse(data[index++], out y); this.Shape = new GeoPointShape(x, y); double.TryParse(data[index++], out this.SOG); double.TryParse(data[index++], out this.COG); bool.TryParse(data[index++], out this.Lost); int.TryParse(data[index++], out this.RateOfTurn); double.TryParse(data[index++], out this.Orientation); double.TryParse(data[index++], out this.Length); double.TryParse(data[index++], out this.Breadth); double.TryParse(data[index++], out this.Altitude); this.NavStatus = (NavStatuses)Enum.Parse(typeof(NavStatuses), data[index++]); this.UpdSensorType = (UpdSensor)Enum.Parse(typeof(UpdSensor), data[index++]); bool.TryParse(data[index++], out this.ATONOffPos); this.StaticId = data[index++]; this.SourceName = data[index++]; this.Source = (SourceTypes)Enum.Parse(typeof(SourceTypes), data[index++]); //this.Callsign = data[index++]; this.Callsign = EncodeStr.Decode(data[index++]); //this.ShipName = data[index++]; this.ShipName = EncodeStr.Decode(data[index++]); this.ObjectType = (ObjectTypes)Enum.Parse(typeof(ObjectTypes), data[index++]); this.ShipType = (ShipTypes)Enum.Parse(typeof(ShipTypes), data[index++]); int.TryParse(data[index++], out this.IMO); int.TryParse(data[index++], out this.MMSI); this.ATONType = (ATONTypes)Enum.Parse(typeof(ATONTypes), data[index++]); this.ATONName = data[index++]; int.TryParse(data[index++], out this.AntPosDistFromFront); int.TryParse(data[index++], out this.AntPosDistFromLeft); this.NatLangShipName = data[index++]; this.PortOfRegistry = data[index++]; this.CountryFlag = data[index++]; double.TryParse(data[index++], out this.MaxAirDraught); double.TryParse(data[index++], out this.MaxDraught); bool.TryParse(data[index++], out this.DeepWaterVesselind); this.VoyageId = data[index++]; this.CargoType = (CargoTypes)Enum.Parse(typeof(CargoTypes), data[index++]); //this.Destination = data[index++]; this.Destination = EncodeStr.Decode(data[index++]); DateTime.TryParse(data[index++], out this.ETA); DateTime.TryParse(data[index++], out this.ATA); double.TryParse(data[index++], out this.AirDraught); double.TryParse(data[index++], out this.Draught); if (index < data.Length) { this.GID = data[index++]; } if (index < data.Length) { this.FID = data[index++]; } }
void DrawUnitBatch(Vector4[] UnitInstanceParams, ref int CUnits, Texture2D Text, Texture2D TextSmall, GameVector Size, ShipTypes type) { float BigLength = 3000; shipEffect.Begin(); float SizeMultiplier = 0; EffectPass p = shipEffect.CurrentTechnique.Passes[0]; shipEffect.Parameters["Positions"].SetValue(UnitInstanceParams); if (CameraPosition.Z > BigLength) { shipEffect.Parameters["tex"].SetValue(TextSmall); switch (type) { case ShipTypes.Corvette: SizeMultiplier = 2.2f; break; case ShipTypes.Cruiser: SizeMultiplier = 1.6f; break; case ShipTypes.Destroyer: SizeMultiplier = 3.2f; break; } SizeMultiplier *= CameraPosition.Z / BigLength; shipEffect.Parameters["Size"].SetValue(ToVector2(Size * SizeMultiplier)); p.Begin(); graphics.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, CUnits * 6, 0, CUnits * 2); p.End(); } if (CameraPosition.Z > BigLength) SizeMultiplier = 1.2f * CameraPosition.Z / BigLength; else SizeMultiplier = 1.2f; shipEffect.Parameters["Size"].SetValue(ToVector2(Size * SizeMultiplier)); shipEffect.Parameters["tex"].SetValue(Text); p.Begin(); graphics.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, CUnits * 6, 0, CUnits * 2); p.End(); CUnits = 0; shipEffect.End(); }
public static void SpawnShip(ShipTypes type, Vector3D location, long ownerid) { var freeplace = MyAPIGateway.Entities.FindFreePlace(location, 20); spawner.SpawnShip(type, (Vector3D)freeplace, ownerid); }
public Unit(ShipTypes ShipType, int Player, GameVector Position, float Angle, string Name) { shipType = ShipType; switch (shipType) { case ShipTypes.Destroyer: blowDamage = 70; blowRadius = 40; name = Name; position = Position; size = Core.DestroyerSize; speed = new DerivativeControlledParameter(0, 0, 20 * TimingClass.SpeedsMultiplier, 9 * TimingClass.SpeedsMultiplier, false); rotationSpeed = new DerivativeControlledParameter(0, -0.22f * TimingClass.SpeedsMultiplier, 0.22f * TimingClass.SpeedsMultiplier, 0.5f * TimingClass.SpeedsMultiplier, false); rotationAngle = new DerivativeControlledParameter(Angle, -MathHelper.Pi, MathHelper.Pi, 1000, true); gun = new Gun(1, 50 * TimingClass.SpeedsMultiplier, 9 / TimingClass.SpeedsMultiplier, 15); gun.owner = this; this.hp = 80; this.team = Player; maxTimeAfterDeath = 5 * 0.2f; timeAfterDeath = 0; IsAliveInPrevLoop = true; this.shots = Core.shots; break; case ShipTypes.Corvette: blowDamage = 150; blowRadius = 120; maxTimeAfterDeath = 5 * 0.2f; speed = new DerivativeControlledParameter(0, 0, 5 * TimingClass.SpeedsMultiplier, 1 * TimingClass.SpeedsMultiplier, false); rotationSpeed = new DerivativeControlledParameter(0, -0.12f * TimingClass.SpeedsMultiplier, 0.12f * TimingClass.SpeedsMultiplier, 0.39f * TimingClass.SpeedsMultiplier, false); gun = new Gun(1, 50 * TimingClass.SpeedsMultiplier, 18 / TimingClass.SpeedsMultiplier, 40); this.hp = 400; this.team = Player; IsAliveInPrevLoop = true; this.shots = Core.shots; timeAfterDeath = 0; name = Name; position = Position; size = Core.CorvetteSize; //size.Y *= 0.9f; //real object size (see texture) rotationAngle = new DerivativeControlledParameter( Angle , -MathHelper.Pi, MathHelper.Pi, 1000, true); gun.owner = this; break; case ShipTypes.Cruiser: blowDamage = 300; blowRadius = 150; maxTimeAfterDeath = 8 * 0.2f; speed = new DerivativeControlledParameter(0, 0, 2 * TimingClass.SpeedsMultiplier, 1.0f * TimingClass.SpeedsMultiplier, false); rotationSpeed = new DerivativeControlledParameter(0, -0.05f * TimingClass.SpeedsMultiplier, 0.05f * TimingClass.SpeedsMultiplier, 0.2f * TimingClass.SpeedsMultiplier, false); gun = new Gun(4, 50 * TimingClass.SpeedsMultiplier, 27 / TimingClass.SpeedsMultiplier, 200); this.hp = 800; this.team = Player; IsAliveInPrevLoop = true; this.shots = Core.shots; timeAfterDeath = 0; name = Name; position = Position; size = Core.CruiserSize; //size.X *= 0.7f; //real object size (see texture) //size.Y *= 0.9f; //real object size (see texture) rotationAngle = new DerivativeControlledParameter( Angle , -MathHelper.Pi, MathHelper.Pi, 1000, true); gun.owner = this; break; } }