/// <summary>
    /// This remove a new target game object.
    /// </summary>
    /// <param name="gameObject">
    /// The game object to remove.
    /// </param>
    public void RemoveGameObject(GameObject gameObject)
    {
        //make sure this game object is not null and is already in the list
        if (gameObject != null && targetGameObjects.Contains(gameObject) == true)
        {
            //remove the game object
            targetGameObjects.Remove(gameObject);

            //get all MonoBehavior components on this target game object
            MonoBehaviour[] behaviours = gameObject.GetComponents <MonoBehaviour>();
            for (int j = 0; j < behaviours.Length; j++)
            {
                //make sure the found behavior is not this behavior, and it is a IVisTriggerTarget
                if (behaviours[j] != this && behaviours[j] is IVisTriggerTarget)
                {
                    //get the modifier target and remove from the Triggered event
                    IVisTriggerTarget triggerTarget = behaviours[j] as IVisTriggerTarget;
                    if (triggerTarget != null)
                    {
                        Triggered -= triggerTarget.OnTriggered;
                    }
                }
            }
        }
    }
 /// <summary>
 /// This creates all of the delegates for all current target game objects.
 /// </summary>
 public void CreateAllDelegates()
 {
     //loop through all game objects and add delegates
     for (int i = 0; i < targetGameObjects.Count; i++)
     {
         //make sure this game object is not null
         if (targetGameObjects[i] != null)
         {
             //get all MonoBehavior components on this target game object
             MonoBehaviour[] behaviours = targetGameObjects[i].GetComponents <MonoBehaviour>();
             for (int j = 0; j < behaviours.Length; j++)
             {
                 //make sure the found behavior is not this behavior, and it is a IVisTriggerTarget
                 if (behaviours[j] != this && behaviours[j] is IVisTriggerTarget)
                 {
                     //get the modifier target and add to the Triggered event
                     IVisTriggerTarget triggerTarget = behaviours[j] as IVisTriggerTarget;
                     if (triggerTarget != null)
                     {
                         Triggered += triggerTarget.OnTriggered;
                     }
                 }
             }
         }
     }
 }
    /// <summary>
    /// This adds a new target game object.
    /// </summary>
    /// <param name="gameObject">
    /// The game object to target.
    /// </param>
    public void AddGameObject(GameObject gameObject)
    {
        //make sure this game object is not null and is not already in the list
        if (gameObject != null && targetGameObjects.Contains(gameObject) == false)
        {
            //warn if the game object being added is the parent of this component
            if (gameObject == this)
            {
                Debug.LogWarning("You are adding a game object to a modifier that is the parent of this modifier.  This may have unexpected results.");
            }

            //add the game object
            targetGameObjects.Add(gameObject);

            //get all MonoBehavior components on this target game object
            MonoBehaviour[] behaviours = gameObject.GetComponents <MonoBehaviour>();
            for (int j = 0; j < behaviours.Length; j++)
            {
                //make sure the found behavior is not this behavior, and it is a IVisTriggerTarget
                if (behaviours[j] != this && behaviours[j] is IVisTriggerTarget)
                {
                    //get the modifier target and add to the Triggered event
                    IVisTriggerTarget triggerTarget = behaviours[j] as IVisTriggerTarget;
                    if (triggerTarget != null)
                    {
                        Triggered += triggerTarget.OnTriggered;
                    }
                }
            }
        }
    }