Esempio n. 1
0
File: Ship.cs Progetto: 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();
        }
Esempio n. 3
0
File: Ship.cs Progetto: rNdm74/C-
        /// <summary>
        /// Event for ship refueling complete
        /// </summary>
        public void OnRefuelingCompleteEvent()
        {
            ShipEventArgs se = new ShipEventArgs(location);

            if (RefuelingCompleteEvent != null)
                RefuelingCompleteEvent(this, se);
        }
Esempio n. 4
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);
     }
 }
Esempio n. 5
0
        public void OutOfFuelEventHandler(object ship, ShipEventArgs shipArgs)
        {
            shipLocation = botShip.getShipLocation();

            botCurrentLocation = shipLocation;

            botShip.Refuel();
        }
Esempio n. 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);
     }
 }
Esempio n. 7
0
        public void OutOfFuelEventHandler(object ship, ShipEventArgs shipArgs)
        {
            shipLocation = botShip.getShipLocation();

            botCurrentLocation = shipLocation;

            botShip.Refuel();
        }
Esempio n. 8
0
        public void OnFullOfFuelEvent()
        {
            ShipEventArgs e = new ShipEventArgs(shipState);

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

            if (RefuelingCompleteEvent != null)
            {
                RefuelingCompleteEvent(this, se);
            }
        }
Esempio n. 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);
            }
        }
Esempio n. 11
0
        public void OnOutOfFuelEvent()
        {
            ShipEventArgs shipArgs = new ShipEventArgs(shipState);

            if (OutOfFuelEvent != null)
            {
                OutOfFuelEvent(this, shipArgs);
            }
        }
Esempio n. 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();
         }
     }
 }
Esempio n. 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);
            }
        }
Esempio n. 14
0
 public void FullOfFuelEventHandler(object ship, ShipEventArgs shipArgs)
 {
     botCurrentLocation = botStartingLocation;
 }
Esempio n. 15
0
 public void FullOfFuelEventHandler(object ship, ShipEventArgs shipArgs)
 {
     botCurrentLocation = botStartingLocation;
 }
Esempio n. 16
0
 public void OnOutOfFuelEvent()
 {
     ShipEventArgs shipEventArgs = new ShipEventArgs(xPos, yPos);
     if (OutOfFuelEvent != null)
     {
         OutOfFuelEvent(this, shipEventArgs);
     }
 }
Esempio n. 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;
 }
Esempio n. 18
0
        public void OnOutOfFuelEvent()
        {
            ShipEventArgs shipArgs = new ShipEventArgs(shipState);

            if (OutOfFuelEvent != null)
                OutOfFuelEvent(this, shipArgs);
        }
Esempio n. 19
0
 public void OutOfFuelEvent(object ship, ShipEventArgs e)
 {
     xPos = e.XPos;
     yPos = e.YPos;
     drawBot();
 }
Esempio n. 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;
 }
Esempio n. 22
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();
 }
Esempio n. 23
0
        public void OnOutOfFuelEvent(Point ShipCurrentlocation)
        {
            ShipEventArgs se = new ShipEventArgs(ShipCurrentlocation);

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