AirControl  1.3.0
Open Source, Modular, and Extensible Flight Simulator For Deep Learning Research
AC_XboxAirplane_Input.cs
1 using System.Collections;
2 using System.Collections.Generic;
3 using UnityEngine;
4 
5 namespace AirControl
6 {
11  {
12  #region Variable
13 
14  #endregion
15 
16  #region Builtin Methods
17  #endregion
18 
19  #region Custom Methods
20 
29  protected override void HandleInputOld()
30  {
31  base.HandleInputOld();
32  base.ClampInputs();
33  // Process pitch, roll, yaw and throttle
34  pitch += Input.GetAxis("Vertical");
35  roll += Input.GetAxis("Horizontal");
36  yaw += Input.GetAxis("X_RH_Stick");
37 
38  throttle += Input.GetAxis("X_RV_Stick");
39  // Process brakes bool
40  brake = Input.GetAxis("Fire1");
41  // Process flaps
42  // get GetKeyDown is used because it fires only once when key pressed. GetKey constantly fire events
43  if(Input.GetButtonDown("X_R_Bumper")){
44  flaps+=1;
45  }
46  if(Input.GetButtonDown("X_L_Bumper")){
47  flaps-=1;
48  }
49  flaps = Mathf.Clamp(flaps, 0,maxFlapIncrements);
50 
51  // camera swith button
52  // camerSwitch = Input.GetButtonDown("X_Y_Button") || Input.GetKeyDown(cameraKey);
53 
54  }
55 
56  protected override void HandleInputNew()
57  {
58  // base.HandleInputNew();
59  // control.Airplane.Brake += ctx => brake = ctx.ReadValue<float>();
60  // Debug.Log("brake : " + brake);
61  }
62 
63  #endregion
64 
65  }
66 
67 }
AirControl.AC_BaseAirplane_Input
Base class to listen for keyboard Inputs
Definition: AC_BaseAirplane_Input.cs:12
AirControl.AC_XboxAirplane_Input
Child class listens to xbox Inputs
Definition: AC_XboxAirplane_Input.cs:10
AirControl
Definition: AirplaneSelector.cs:8
AirControl.AC_XboxAirplane_Input.HandleInputOld
override void HandleInputOld()
Handle Xbox input, override the keyboard behavior make sure you update input settings in Unity Then O...
Definition: AC_XboxAirplane_Input.cs:29