public SolarSystemController(SolarSystem ss, ActorSolarSystem parentActor, IActorRef actorTextOutput) { _model = ss; _parentActor = parentActor; _actorTextOutput = actorTextOutput; // create child controller for each planet in ss _planetCs = new Dictionary <Int64, PlanetController>(); foreach (Planet p in ss.Planets) { PlanetController pc = new PlanetController(p, actorTextOutput); _planetCs.Add(p.PlanetId, pc); } _planetValues = _planetCs.Values; // create child controller for each ship in ss _shipCs = new Dictionary <Int64, ShipController>(); foreach (Ship s in ss.Ships) { ShipController sc = new ShipController(s, this, actorTextOutput); _shipCs.Add(s.ShipId, sc); } _shipValues = _shipCs.Values; }
public SolarSystemController(SolarSystem ss, ActorSolarSystem parentActor, IActorRef actorTextOutput) { _model = ss; _parentActor = parentActor; _actorTextOutput = actorTextOutput; // create child controller for each planet in ss _planetCs = new Dictionary<Int64, PlanetController>(); foreach (Planet p in ss.Planets) { PlanetController pc = new PlanetController(p, actorTextOutput); _planetCs.Add(p.PlanetId, pc); } _planetValues = _planetCs.Values; // create child controller for each ship in ss _shipCs = new Dictionary<Int64, ShipController>(); foreach (Ship s in ss.Ships) { ShipController sc = new ShipController(s, this, actorTextOutput); _shipCs.Add(s.ShipId, sc); } _shipValues = _shipCs.Values; }
private bool ShipDock(MessageShipCommand msg, ShipController sc) { bool success = false; if (sc.checkValidDockCommand(msg)) { Ship s = _model.Ships.Where(x => x.ShipId == msg.ShipId).First(); _planetCs[sc.GetDestination.PlanetId].DockShip(s); sc.Dock(); success = true; } return success; }
private bool ShipUndock(MessageShipCommand msg, ShipController sc) { bool success = false; if (sc.checkValidUndockCommand(msg)) { _planetCs[sc.DockedPlanet.PlanetId].UndockShip(msg.ShipId); sc.Undock(); success = true; } return success; }
private static bool ShipSetDestination(MessageShipCommand msg, ShipController sc) { bool success = false; if (sc.checkValidSetDestinationCommand(msg)) { MessageShipSetDestination msd = (MessageShipSetDestination)msg.Command; sc.SetDestination(msd.DestinationScId); success = true; } return success; }