Ejemplo n.º 1
0
        public override void OnEnable()
        {
            base.OnEnable();

            control = GetComponent <ActionButtonControl>();
            if (control == null)
            {
                Debug.LogWarning("Could not find an IObjectControl componenet on " + gameObject);
                return;
            }

            model = GetComponent <ActionButtonModel>();
            if (model == null)
            {
                Debug.LogWarning("Could not find an IObjectModel componenet on " + gameObject);
                return;
            }

            //Subscribing to the control events
            control.ActionButtonHoverOffEvent        += OnHoverOff;
            control.ActionButtonHoverOnEvent         += OnHoverOn;
            control.ActionButtonMouseDownEvent       += OnPrimaryMouseDown;
            control.ActionButtonMouseDownRevertEvent += OnPrimaryMouseDownRevert;
            control.ActionButtonMouseUpEvent         += OnPrimaryMouseUp;
            //Subscribing to the model events
            model.ActionButtonActivateEvent   += OnActivate;
            model.ActionButtonDeactivateEvent += OnDeactivate;
        }
Ejemplo n.º 2
0
 void OnEnable()
 {
     control = GetComponent <ActionButtonControl>();
     //Null Test
     if (control == null)
     {
         Debug.LogError("Could not find an IObjectControl on " + gameObject);
         return;
     }
     //Subscribe to Control OnMouseUp/Down events
     control.ActionButtonMouseUpEvent += OnPrimaryMouseUp;
 }