示例#1
0
文件: Ship.cs 项目: rNdm74/C-
        /// <summary>
        /// Event for when a ship needs fuel
        /// </summary>
        public void OnNeedsFuelEvent()
        {
            ShipEventArgs se = new ShipEventArgs(location);

            if (NeedsFuelEvent != null)
                NeedsFuelEvent(this, se);
        }
        public void OutOfFuelEventHandler(object sender, ShipEventArgs e)
        {
            // Set the refueler lcoation to be the same as the current ship location
            botCurrentLocation = botShip.ShipLocation;

            botShip.Refuel();
        }
示例#3
0
文件: Ship.cs 项目: rNdm74/C-
        /// <summary>
        /// Event for ship refueling complete
        /// </summary>
        public void OnRefuelingCompleteEvent()
        {
            ShipEventArgs se = new ShipEventArgs(location);

            if (RefuelingCompleteEvent != null)
                RefuelingCompleteEvent(this, se);
        }
示例#4
0
文件: EventManager.cs 项目: rNdm74/C-
 /// <summary>
 /// Event raised when a ship needs fuel, will select a waiting bot and dispatch them to the ship
 /// </summary>
 /// <param name="sender">Ship</param>
 /// <param name="se">fuel, ID</param>
 private void needFuelHandler(object sender, ShipEventArgs se)
 {
     if (isBotsReadyForRefueling())
     {
         Bot botForRefueling = selectBotForRefueling();
         botForRefueling.Dispatch((Ship)sender, se.Location);
     }
 }
示例#5
0
        public void OutOfFuelEventHandler(object ship, ShipEventArgs shipArgs)
        {
            shipLocation = botShip.getShipLocation();

            botCurrentLocation = shipLocation;

            botShip.Refuel();
        }
示例#6
0
 /// <summary>
 /// Event raised when a ship needs fuel, will select a waiting bot and dispatch them to the ship
 /// </summary>
 /// <param name="sender">Ship</param>
 /// <param name="se">fuel, ID</param>
 private void needFuelHandler(object sender, ShipEventArgs se)
 {
     if (isBotsReadyForRefueling())
     {
         Bot botForRefueling = selectBotForRefueling();
         botForRefueling.Dispatch((Ship)sender, se.Location);
     }
 }
示例#7
0
        public void OutOfFuelEventHandler(object ship, ShipEventArgs shipArgs)
        {
            shipLocation = botShip.getShipLocation();

            botCurrentLocation = shipLocation;

            botShip.Refuel();
        }
示例#8
0
        public void OnFullOfFuelEvent()
        {
            ShipEventArgs e = new ShipEventArgs(shipState);

            if (FullOfFuelEvent != null)
            {
                FullOfFuelEvent(this, e);
            }
        }
示例#9
0
        /// <summary>
        /// Event for ship refueling complete
        /// </summary>
        public void OnRefuelingCompleteEvent()
        {
            ShipEventArgs se = new ShipEventArgs(location);

            if (RefuelingCompleteEvent != null)
            {
                RefuelingCompleteEvent(this, se);
            }
        }
示例#10
0
        /// <summary>
        /// Event for when a ship needs fuel
        /// </summary>
        public void OnNeedsFuelEvent()
        {
            ShipEventArgs se = new ShipEventArgs(location);

            if (NeedsFuelEvent != null)
            {
                NeedsFuelEvent(this, se);
            }
        }
示例#11
0
        public void OnOutOfFuelEvent()
        {
            ShipEventArgs shipArgs = new ShipEventArgs(shipState);

            if (OutOfFuelEvent != null)
            {
                OutOfFuelEvent(this, shipArgs);
            }
        }
示例#12
0
 /// <summary>
 /// Find the bot that serviced the ship that rasied the event and send home
 /// </summary>
 /// <param name="sender">Ship</param>
 /// <param name="se">fuel, ID</param>
 private void refuelingCompleteHandler(object sender, ShipEventArgs se)
 {
     foreach (Bot bot in bots)
     {
         if (bot.refuelingShip != null && bot.refuelingShip.Equals((Ship)sender))
         {
             bot.SendHome();
         }
     }
 }
示例#13
0
        public void OnOutOfFuelEvent()
        {
            // Instantiate the custom event
            ShipEventArgs e = new ShipEventArgs(shipState);

            // Is null if no methods have been registered
            if (OutOfFuelEvent != null)
            {
                // Raises the event
                OutOfFuelEvent(this, e);
            }
        }
示例#14
0
 public void FullOfFuelEventHandler(object ship, ShipEventArgs shipArgs)
 {
     botCurrentLocation = botStartingLocation;
 }
示例#15
0
 public void FullOfFuelEventHandler(object ship, ShipEventArgs shipArgs)
 {
     botCurrentLocation = botStartingLocation;
 }
示例#16
0
 public void OnOutOfFuelEvent()
 {
     ShipEventArgs shipEventArgs = new ShipEventArgs(xPos, yPos);
     if (OutOfFuelEvent != null)
     {
         OutOfFuelEvent(this, shipEventArgs);
     }
 }
示例#17
0
 // This method is run when the  assigned\subject ship signals it is out of fuel
 public void OutOfFuelEventHandler(object o, ShipEventArgs e)
 {
     //The local ship location variable is updated with the jubject slocation from the passed in data bucket.
        shipLocation = e.ShipLocation;
        //and the bot starts sailing.
        botState = BotState.SailingtoShip;
 }
示例#18
0
        public void OnOutOfFuelEvent()
        {
            ShipEventArgs shipArgs = new ShipEventArgs(shipState);

            if (OutOfFuelEvent != null)
                OutOfFuelEvent(this, shipArgs);
        }
示例#19
0
 public void OutOfFuelEvent(object ship, ShipEventArgs e)
 {
     xPos = e.XPos;
     yPos = e.YPos;
     drawBot();
 }
示例#20
0
 public void FullOfFuelEvent(object ship, ShipEventArgs e)
 {
     xPos = startXPos;
     yPos = startYPos;
     drawBot();
 }
 public void FullOfFuelEventHandler(object ship, ShipEventArgs shipArgs)
 {
     // Reset petrolBots to initital position
     botCurrentLocation = botStartingLocation;
 }
示例#22
0
文件: EventManager.cs 项目: rNdm74/C-
 /// <summary>
 /// Find the bot that serviced the ship that rasied the event and send home
 /// </summary>
 /// <param name="sender">Ship</param>
 /// <param name="se">fuel, ID</param>
 private void refuelingCompleteHandler(object sender, ShipEventArgs se)
 {
     foreach (Bot bot in bots)
         if (bot.refuelingShip != null && bot.refuelingShip.Equals((Ship)sender))
             bot.SendHome();
 }
示例#23
0
        public void OnOutOfFuelEvent(Point ShipCurrentlocation)
        {
            ShipEventArgs se = new ShipEventArgs(ShipCurrentlocation);

            if (OutOfFuelEvent != null)
            {
                OutOfFuelEvent(this, se);
            }
        }
示例#24
0
 public void OutOfFuelEventHandler(object o, ShipEventArgs e)
 {
     botCurrentlocation = e.ShipLocation;
 }