public Ship(int owner, int id, double xPos, double yPos, int health, DockingStatus dockingStatus, int dockedPlanet, int dockingProgress, int weaponCooldown) : base(owner, id, xPos, yPos, health, Constants.SHIP_RADIUS) { this.dockingStatus = dockingStatus; this.dockedPlanet = dockedPlanet; this.dockingProgress = dockingProgress; this.weaponCooldown = weaponCooldown; }
/// <summary> /// Constructor for the Ship Class /// </summary> /// <param name="owner">Owner of this ship</param> /// <param name="tokens">Tokens from the game environment to pazrse</param> public Ship(int owner, Queue <String> tokens) : base() { this.EntityInfo = new EntityInfo(owner, int.Parse(tokens.Dequeue()), EntityType.Ship); this.Position = new Position(Double.Parse(tokens.Dequeue()), Double.Parse(tokens.Dequeue())); this.health = int.Parse(tokens.Dequeue()); this.velocity = new Velocity(Double.Parse(tokens.Dequeue()), Double.Parse(tokens.Dequeue())); this.dockingStatus = (DockingStatus)Enum.Parse(typeof(DockingStatus), tokens.Dequeue()); this.dockedPlanet = int.Parse(tokens.Dequeue()); this.dockingProgress = int.Parse(tokens.Dequeue()); this.weaponCooldown = int.Parse(tokens.Dequeue()); this.Radius = Constants.ShipRadius; Log.Information(this.ToString(), LogingLevel.Game); }
private static Ship NewShipFromMetadata(int owner, Metadata metadata) { int id = int.Parse(metadata.Pop()); double xPos = double.Parse(metadata.Pop(), CultureInfo.InvariantCulture); double yPos = double.Parse(metadata.Pop(), CultureInfo.InvariantCulture); int health = int.Parse(metadata.Pop()); // Ignoring velocity(x,y) which is always (0,0) in current version. metadata.Pop(); metadata.Pop(); DockingStatus dockingStatus = (DockingStatus)int.Parse(metadata.Pop()); int dockedPlanet = int.Parse(metadata.Pop()); int dockingProgress = int.Parse(metadata.Pop()); int weaponCooldown = int.Parse(metadata.Pop()); return(new Ship(owner, id, xPos, yPos, health, dockingStatus, dockedPlanet, dockingProgress, weaponCooldown)); }