/* * Invoked by a game object to mark itself as target. * By doing this, as soon as it satisfies the "show target tracker" condition, * the tracker is displayed in the UI canvas. * The simplest way to have objects invoking this method is be assigning the * "UITargetTrackerTarget" behaviour, ie. adding the script as component. */ public void RegisterAsTarget(UITargetTrackerTarget target) { TargetDescriptor td = new TargetDescriptor(); td.target = target; td.tracker = null; // tracker gets assigned when conditions are met, see UpdateTargetStates() targetObjectRegistry.Add(td); }
public void UnregisterAsTarget(UITargetTrackerTarget target) { foreach (TargetDescriptor descr in targetObjectRegistry) { if (descr.target == target) { targetObjectRegistry.Remove(descr); return; } } }