///When we destroy this object we also have to unset the callbacks so we aren't shooting calls to a null object
 void OnDestroy()
 {
     if (MyControls == null)
     {
         //MyControls = new Controls2D();
         MyControls = GlobalVar.GlobalControls;
         //This is the C# Input Action -> Followed By An Action Set -> Followed by What the callbacks target
         MyControls.ActionInputs.SetCallbacks(null);
     }
     MyControls.ActionInputs.Disable();
 }
 ///When the client is enabled we set the controls.
 private void OnEnable()
 {
     if (MyControls == null)
     {
         //MyControls = new Controls2D();
         MyControls = GlobalVar.GlobalControls;
         //This is the C# Input Action -> Followed By An Action Set -> Followed by What the callbacks target
         MyControls.ActionInputs.SetCallbacks(this);
     }
     MyControls.ActionInputs.Enable();
     if (Anim == null)
     {
         Anim = GetComponent <PlayerAnimator>();
     }
 }
Esempio n. 3
0
 public void Setup(GameManager _GM)
 {
     GM = _GM;
     ES = GetComponent <EventSystem>();
     StartCoroutine(SetMainMenuFocus());
     GetBaseContext();
     if (MyControls == null)
     {
         //MyControls = new Controls2D();
         MyControls = GlobalVar.GlobalControls;
         //The convention for making it so this is the recieving object for the controls is
         //C# Input Action -> Followed By An Action Set -> Followed by What the callbacks target
         //So if you have a controller manager that has drop in you could have it assign it to a "controllable" character for a beat em up
         MyControls.UI.SetCallbacks(this);
     }
     MyControls.UI.Enable();
 }