private void Awake()
 {
     Screen.set_orientation((ScreenOrientation)3);
     this.player = ReInput.get_players().GetPlayer(0);
     ReInput.add_InputSourceUpdateEvent(new Action(this.OnInputUpdate));
     this.controller = (CustomController)((Player.ControllerHelper) this.player.controllers).GetControllerWithTag((ControllerType)20, "TiltController");
 }
Example #2
0
 private void Initialize()
 {
     ReInput.add_InputSourceUpdateEvent(new Action(this.OnInputSourceUpdate));
     this.joysticks    = (TouchJoystickExample[])((Component)this).GetComponentsInChildren <TouchJoystickExample>();
     this.buttons      = (TouchButtonExample[])((Component)this).GetComponentsInChildren <TouchButtonExample>();
     this.axisCount    = this.joysticks.Length * 2;
     this.buttonCount  = this.buttons.Length;
     this.axisValues   = new float[this.axisCount];
     this.buttonValues = new bool[this.buttonCount];
     this.controller   = (CustomController)((Player.ControllerHelper)ReInput.get_players().GetPlayer(this.playerId).controllers).GetControllerWithTag <CustomController>(this.controllerTag);
     if (this.controller == null)
     {
         Debug.LogError((object)("A matching controller was not found for tag \"" + this.controllerTag + "\""));
     }
     if (((Controller)this.controller).get_buttonCount() != this.buttonValues.Length || ((ControllerWithAxes)this.controller).get_axisCount() != this.axisValues.Length)
     {
         Debug.LogError((object)"Controller has wrong number of elements!");
     }
     if (this.useUpdateCallbacks && this.controller != null)
     {
         this.controller.SetAxisUpdateCallback(new Func <int, float>(this.GetAxisValueCallback));
         this.controller.SetButtonUpdateCallback(new Func <int, bool>(this.GetButtonValueCallback));
     }
     this.initialized = true;
 }