コード例 #1
0
ファイル: ShipController.cs プロジェクト: AshRolls/GalaxyGen
 internal bool checkValidDockCommand(MessageShipCommand msg)
 {
     if (msg.Command.CommandType == ShipCommandEnum.Dock && _model.DockedPlanet == null && _model.ShipState != ShipStateEnum.Docked)
     {
         return true;
     }
     return false;
 }
コード例 #2
0
ファイル: ShipController.cs プロジェクト: AshRolls/GalaxyGen
 internal bool checkValidSetDestinationCommand(MessageShipCommand msg)
 {
     if (msg.Command.CommandType == ShipCommandEnum.SetDestination)
     {
         return true;
     }
     return false;
 }
コード例 #3
0
        internal bool ReceiveCommandForShip(MessageShipCommand msg)
        {
            bool success = false;
            ShipController sc = _shipCs[msg.ShipId];
            // check the ship *could* execute this command

            if (msg.Command.CommandType == ShipCommandEnum.Undock)
            {
                success = ShipUndock(msg, sc);
            }
            else if (msg.Command.CommandType == ShipCommandEnum.SetDestination)
            {
                success = ShipSetDestination(msg, sc);
            }
            else if (msg.Command.CommandType == ShipCommandEnum.Dock)
            {
                success = ShipDock(msg, sc);
            }

            return success;
        }
コード例 #4
0
 private void receiveCommandForShip(MessageShipCommand msg)
 {
     bool success = _solarSystemC.ReceiveCommandForShip(msg);
     MessageShipResponse msr = new MessageShipResponse(success, msg, _curTick);
     Sender.Tell(msr);
 }
コード例 #5
0
 private object pilotingShip(MessageTick tick)
 {
     if (isPilotingShip())
     {
         if (_model.CurrentShipDestinationScId != _memory.CurrentDestinationScId)
         {
             IMessageShipCommandData msd = new MessageShipSetDestination(ShipCommandEnum.SetDestination, _memory.CurrentDestinationScId);
             MessageShipCommand msc = new MessageShipCommand(msd, tick.Tick, _model.CurrentShipId);
             ScPlanet curDest = StarChart.GetPlanet(_memory.CurrentDestinationScId);
             //_actorTextOutput.Tell("Agent Piloting Ship towards " + curDest.Name);
             return msc;
         }
     }
     return null;
 }
コード例 #6
0
 public MessageShipResponse(bool response, MessageShipCommand sentCommand, Int64 tickSent)
 {
     Response    = response;
     SentCommand = sentCommand;
     TickSent    = tickSent;
 }
コード例 #7
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;
 }
コード例 #8
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;
 }
コード例 #9
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;
 }
コード例 #10
0
 public MessageShipResponse(bool response, MessageShipCommand sentCommand, Int64 tickSent)
 {
     Response = response;
     SentCommand = sentCommand;
     TickSent = tickSent;
 }