Пример #1
0
    //  Untracks target; removes target from tracking list
    public static void UntrackTarget(GameObject target)
    {
        IndicatorTarget ITarget = target.GetComponent <IndicatorTarget>();

        ITarget.enabled = false;
        Targets.Remove(ITarget);
    }
Пример #2
0
 // Add the target to targets list if active is true.
 // If active is false deactivate the targets indicator,
 // set its reference null and remove it from the targets list.
 private void HandleTargetStateChanged(IndicatorTarget target, bool active)
 {
     if (active)
     {
         targets.Add(target);
     }
     else
     {
         target.indicator?.Activate(false);
         target.indicator = null;
         targets.Remove(target);
     }
 }
 public void setIndicatorTarget(IndicatorTarget target)
 {
     this.currentTarget = target;
     switch(target)
     {
         case IndicatorTarget.Drifter:
             targetObject = GameObject.Find("Drifter").transform.GetChild(0).gameObject;
             break;
         case IndicatorTarget.IndicatorSphere:
             targetObject = GameObject.Find("IndicatorSphere");
             break;
         default:
             break;
     }
 }
Пример #4
0
    //  Returns the IndicatorTarget component of the target
    public static IndicatorTarget GetIndicatorTarget(GameObject target)
    {
        IndicatorTarget ITarget = target.GetComponent <IndicatorTarget>();

        if (ITarget != null)
        {
            for (int i = 0; i < Targets.Count; i++)
            {
                if (ITarget = Targets[i])
                {
                    return(ITarget);
                }
            }
        }
        return(null);
    }
Пример #5
0
    //  Tracks target; add a IndicatorTarget component to the target if it doesn't already exist and add to tracking list.
    public static void TrackTarget(GameObject target)
    {
        IndicatorTarget ITarget = target.GetComponent <IndicatorTarget>();

        //  If the target doesn't have a indicator... Add one
        if (ITarget == null)
        {
            ITarget = target.AddComponent <IndicatorTarget>();
        }
        //  Else if the target already has an indicator, check if it just needs to be added to the tracking list if not already
        else if (!Targets.Contains(ITarget))
        {
            Targets.Add(ITarget);
        }
        else
        {
            Debug.Log("Target is already being tracked.");
        }
        ITarget.enabled = true;
    }
 void Awake()
 {
     //  Find and assin references
     ITarget = GetComponent <IndicatorTarget>();
 }
 void Awake()
 {
     //  Find & Assign references.
     ITarget = GetComponent <IndicatorTarget>();
 }