Exemple #1
0
        /// <summary>
        /// Adds a drone to the port - starts working immediately
        /// </summary>
        /// <param name="drone"></param>
        /// <returns>id of drone</returns>
        public int AddDrone(IDrone drone)
        {
            drone.SetPort(this);
            var displayObject = Communicaiton.Instance.GetDisplayObjectAt(drone.CurrentX, drone.CurrentY);
            var insertedDrone = _drones.Add(new DroneWithPosition(drone, displayObject));

            var waitingOrder = GetWaitingOrder();

            if (waitingOrder != null)
            {
                drone.AddOrder(waitingOrder);
            }


            return(insertedDrone.Id);
        }