public void DoAction(SetComponentEnabledAction action, Transform actor)
 {
     if ((action != null) && (action.target != null))
     {
         Tools.SetComponentEnabled(action.target, action.state);
     }
 }
Esempio n. 2
0
 protected virtual void DoSetEnabledActions(Transform actor)
 {
     for (int i = 0; i < setEnabledActions.Length; i++)
     {
         var action = setEnabledActions[i];
         if (action != null && action.condition != null && action.condition.IsTrue(actor))
         {
             Tools.SetComponentEnabled(action.target, action.state);
         }
     }
 }
 /// <summary>
 /// Sets the targets active/inactive. Colliders and Renderers aren't MonoBehaviours, so we
 /// cast them separately to access their 'enabled' properties.
 /// </summary>
 /// <param name='value'>
 /// <c>true</c> for active, <c>false</c> for inactive.
 /// </param>
 private void SetTargets(bool value)
 {
     foreach (var go in gameObjects)
     {
         if (go != null)
         {
             go.SetActive(value);
         }
     }
     foreach (var component in components)
     {
         Tools.SetComponentEnabled(component, value ? Toggle.True : Toggle.False);
     }
     if (value == true)
     {
         onEnter.Invoke();
     }
     else
     {
         onExit.Invoke();
     }
 }