Beispiel #1
0
        public override void OnEnable()
        {
            base.OnEnable();

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

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

            //Subscribing to the control events
            control.EndTurnButtonHoverOffEvent        += OnHoverOff;
            control.EndTurnButtonHoverOnEvent         += OnHoverOn;
            control.EndTurnButtonMouseDownEvent       += OnPrimaryMouseDown;
            control.EndTurnButtonMouseDownRevertEvent += OnPrimaryMouseDownRevert;
            control.EndTurnButtonMouseUpEvent         += OnPrimaryMouseUp;
            //Subscribing to the model events
            model.EndTurnButtonActivateEvent   += OnActivate;
            model.EndTurnButtonDeactivateEvent += OnDeactivate;
        }
Beispiel #2
0
 void OnEnable()
 {
     control = GetComponent <EndTurnButtonControl>();
     //Null Test
     if (control == null)
     {
         Debug.LogError("Could not find an IObjectControl on " + gameObject);
         return;
     }
     //Subscribe to Control OnMouseUp/Down events
     control.EndTurnButtonMouseUpEvent += OnPrimaryMouseUp;
 }