//a method called to disable the faction entity related components public virtual void Disable(bool destroyed) { if (TaskLauncherComp != null) //if the unit has a task manager and there are pending tasks there { TaskLauncherComp.CancelAllInProgressTasks(); //cancel all the in progress tasks } if (APCComp != null) //if this unit has an APC component attached to it { APCComp.EjectAll(destroyed); //remove all the units stored in the APC } }
/// <summary> /// Disables the FactionEntity instance to prepare for it to be destroyed, upgraded or converted. /// </summary> /// <param name="destroyed">True if the faction entity is being disabled because it's getting destroyed, otherwise false.</param> public virtual void Disable(bool destroyed) { TaskLauncherComp?.CancelAllInProgressTasks(); //cancel all the in progress tasks APCComp?.EjectAll(destroyed); //remove all the units stored in the APC if (!free) { gameMgr.ResourceMgr.UpdateResource(factionID, disableResources); //add the disable resources to the entity's faction. } }