コード例 #1
0
        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;
        }
コード例 #2
0
        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;
        }
コード例 #3
0
 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;
 }
コード例 #4
0
 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;
 }
コード例 #5
0
 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;
 }