/// <summary> /// Remove a target from the target list /// </summary> /// <param name="value">the target you want to remove</param> public static void RemoveTarget(BaseAOITarget value) { if (targets.Contains(value)) { targets.Remove(value); } }
/// <summary> /// Add a target to the target list /// </summary> /// <param name="value">the target you want to add</param> public static void AddTarget(BaseAOITarget value) { if (!targets.Contains(value)) { value.aoiPosition = value.transform.position; targets.Add(value); } }
/// <summary> /// Handle the AOI. /// </summary> /// <param name="target">our target</param> /// <param name="finder">our finder</param> /// <param name="isUnityThread">is this executed from unity's thread.</param> private static void HandleAOI(BaseAOITarget target, BaseAOIFinder finder, bool isUnityThread) { bool inDistance = target.InZone(finder.aoiPosition, finder.radius); if (!target.calculateDuplicates || target.inRange != inDistance) // if we arent duplicating { if (isUnityThread) { target.HandleAOI(finder, inDistance); } else { ThreadManager.RunOnUnityThread(new ThreadTask <BaseAOITarget, BaseAOIFinder, bool>((BaseAOITarget _target, BaseAOIFinder _finder, bool _inDistance) => { _target.HandleAOI(_finder, _inDistance); }, target, finder, inDistance)); } } }