/// <summary>
        /// Transfers all of the specialists from this specialist manager to the target specialist manager.
        /// </summary>
        /// <param name="specialistManager"></param>
        public bool TransferSpecialistsTo(SpecialistManager specialistManager)
        {
            if (specialistManager.CanAddSpecialists(this._specialists.Count))
            {
                List <Specialist> toRemove = new List <Specialist>(_specialists);
                foreach (Specialist s in toRemove)
                {
                    RemoveSpecialist(s);
                    specialistManager.AddSpecialist(s);
                }

                return(true);
            }
            return(false);
        }
        /// <summary>
        /// Transfers all of the specialists from this specialist manager to the target specialist manager.
        /// </summary>
        /// <param name="destinationSpecialistManager">Specialist manager to transfer subs to</param>
        /// <param name="specialistIds">List of specialist Ids to transfer</param>
        public bool TransferSpecialistsById(SpecialistManager destinationSpecialistManager, List <string> specialistIds)
        {
            var specialistsMatchingId = _specialists.Where(it => specialistIds.Contains(it.GetId())).ToList();

            if (destinationSpecialistManager.CanAddSpecialists(specialistsMatchingId.Count))
            {
                foreach (Specialist s in specialistsMatchingId)
                {
                    RemoveSpecialist(s);
                    destinationSpecialistManager.AddSpecialist(s);
                }

                return(true);
            }

            return(false);
        }
Beispiel #3
0
 public SubLauncher(IEntity parent) : base(parent)
 {
     _drillerCarrier    = parent.GetComponent <DrillerCarrier>();
     _specialistManager = parent.GetComponent <SpecialistManager>();
 }