public bool TryDeployShip(Ship ship, Shipyard shipyard) { if (shipyard.HostedShip != ship) { Debug.LogError("Trying to deploy from wrong shipyard"); return(false); } if (ship.ConstructionRemaining > 0) { Debug.LogError("Trying to deploy incomplete ship"); return(false); } // if we get here, all good shipyard.ClearHostedCard(); _game.Player.Ships.Add(ship); _actions.Add(new DeployAction(ship, shipyard)); GameViewController.DeployShip(ship, true); GameViewController.AddGameLogMessage(string.Format("<b>You</b> deploy {0}", ship.CardName)); return(true); }
private void ProcessOpponentDeployShipAction(string shipId, string shipyardId) { // move the ship to the deployed area Shipyard shipyard = _game.Opponent.Shipyards.Find(x => x.CardId == shipyardId); Ship ship = shipyard.HostedShip; _game.Opponent.Ships.Add(ship); shipyard.ClearHostedCard(); GameViewController.DeployShip(ship, false); GameViewController.AddGameLogMessage(string.Format("<b>{0}</b> deploys {1}", _game.Opponent.Name, ship.CardName)); }
private void ProcessDeployShipAction(Player player, Player opponent, Game game, string shipId, string shipyardId) { Shipyard shipyard = FindCardIn(shipyardId, player.Shipyards); // TODO - error if shipyard not found Ship ship = shipyard.HostedShip; // TODO - error if this is not the correct ship // TODO - error if not complete ServerLog(string.Format("Deploying {0}({1}) from {2}({3}) for {4}", ship.CardName, ship.CardId, shipyard.CardName, shipyard.CardId, player.Name), game); shipyard.ClearHostedCard(); player.Ships.Add(ship); }