public virtual void Repaint(TriggerBase trigger)
        {
            _window.Show();

            Sprite icon       = null;
            string actionName = "";

            if (trigger != null)
            {
                var input = trigger.GetComponent <ITriggerInputHandler>();
                if (input != null)
                {
                    icon       = GetIcon(input, trigger);
                    actionName = input.ToString();
                }
            }

            if (imageIcon != null && imageIcon.sprite != icon)
            {
                imageIcon.sprite = icon;
            }

            if (shortcutText != null && shortcutText.text != actionName)
            {
                shortcutText.text = actionName;
            }
        }
Beispiel #2
0
        public void ChangeTriggerRadius(TriggerBase trigger, float newRadius)
        {
            if (newRadius < 0f)
            {
                throw new InvalidOperationException(String.Format("Radius can't be less then zero. ChangeTriggerRadius({0}, {1})", trigger, newRadius));
            }

            trigger.GetComponent <SphereCollider>().radius = newRadius;
            trigger.SendMessage("OnValidate", SendMessageOptions.DontRequireReceiver);
        }
 protected virtual void OnTriggerChanged(TriggerBase before, TriggerBase after)
 {
     if (after != null)
     {
         var info = after.GetComponent <ISelectableObjectInfo>();
         if (info != null)
         {
             currentSelectableObject = info;
         }
     }
     else
     {
         currentSelectableObject = null;
     }
 }
Beispiel #4
0
        private void Repaint(TriggerBase trigger)
        {
            _window.Show();

            Sprite icon       = null;
            string actionName = "";

            if (trigger != null)
            {
                var input = trigger.GetComponent <ITriggerInputHandler>();
                if (input != null)
                {
                    var binder = _binders.FirstOrDefault(o => o.actionName == input.actionInfo.actionName);
                    if (binder != null)
                    {
                        icon       = binder.icon;
                        actionName = binder.actionName;
                    }
                    else
                    {
                        icon       = input.actionInfo.icon;
                        actionName = input.actionInfo.actionName;
                    }
                }
            }

            if (imageIcon != null && imageIcon.sprite != icon)
            {
                imageIcon.sprite = icon;
            }

            if (shortcutText != null && shortcutText.text != actionName)
            {
                shortcutText.text = actionName;
            }
        }
Beispiel #5
0
        public void ChangeTriggerRadius(TriggerBase trigger, float newRadius)
        {
            if (newRadius < 0f)
                throw new InvalidOperationException(String.Format("Radius can't be less then zero. ChangeTriggerRadius({0}, {1})",
                                                                  trigger,
                                                                  newRadius));

            trigger.GetComponent<SphereCollider>().radius = newRadius;
            trigger.SendMessage("OnValidate", SendMessageOptions.DontRequireReceiver);
        }