예제 #1
0
    static public GameObject FindChild(GameObject obj, string name)
    {
        GameObject go = FindChildNoWarning(obj, name);

        if (go == null)
        {
            OVRDebugUtils.Print("child " + name + " was not found!");
        }

        return(go);
    }
예제 #2
0
 /// <summary>
 /// Outputs debug spam for any depressed button.
 /// This is only used for finding which buttons are which with new controllers.
 /// </summary>
 private static void ShowButtonValues()
 {
     for (int i = 0; i < 6; ++i)
     {
         string buttonName = "Test Button " + i;
         if (Input.GetButton(buttonName))
         {
             OVRDebugUtils.Print("Test Button " + i + " is down.");
         }
     }
 }
예제 #3
0
 /// <summary>
 /// Outputs debug spam for any non-zero axis.
 /// This is only used for finding which axes are which with new controllers.
 /// </summary>
 private static void ShowAxisValues()
 {
     for (int i = 1; i <= 20; ++i)
     {
         string axisName = "Test Axis " + i;
         float  v        = Input.GetAxis(axisName);
         if (Mathf.Abs(v) > 0.2f)
         {
             OVRDebugUtils.Print("Test Axis " + i + ": v = " + v);
         }
     }
 }
예제 #4
0
    /// <summary>
    /// Static contructor for the OVRInputControl class.
    /// </summary>
    static OVRInputControl()
    {
#if UNITY_ANDROID && !UNITY_EDITOR
        OVRGamepadController.SetReadAxisDelegate(ReadJoystickAxis);
        OVRGamepadController.SetReadButtonDelegate(ReadJoystickButton);
#endif
        switch (Application.platform)
        {
        case RuntimePlatform.WindowsPlayer:
            Init_Windows();
            break;

        case RuntimePlatform.WindowsEditor:
            Init_Windows_Editor();
            break;

        case RuntimePlatform.Android:
            Init_Android();
            break;

        case RuntimePlatform.OSXPlayer:
            Init_OSX();
            break;

        case RuntimePlatform.OSXEditor:
            Init_OSX_Editor();
            break;

        case RuntimePlatform.IPhonePlayer:
            Init_iPhone();
            break;
        }

        string[] joystickNames = Input.GetJoystickNames();
        for (int i = 0; i < joystickNames.Length; ++i)
        {
            OVRDebugUtils.Print("Found joystick '" + joystickNames[i] + "'...");
        }
    }
예제 #5
0
 /// <summary>
 /// Initializes the input system for iPhone.
 /// </summary>
 private static void Init_iPhone()
 {
     OVRDebugUtils.Print("Initializing input for iPhone.");
     allowKeyControls = false;
     platformPrefix   = "iPhone:";
 }
예제 #6
0
 /// <summary>
 /// Initializes the input system for OSX when running from the Unity editor.
 /// </summary>
 private static void Init_OSX_Editor()
 {
     OVRDebugUtils.Print("Initializing input for OSX Editor.");
     allowKeyControls = true;
     platformPrefix   = "OSX:";
 }
예제 #7
0
 /// <summary>
 /// Initializes the input system for OSX.
 /// </summary>
 private static void Init_OSX()
 {
     OVRDebugUtils.Print("Initializing input for OSX.");
     allowKeyControls = false;
     platformPrefix   = "OSX:";
 }
예제 #8
0
 /// <summary>
 /// Initializes the input system for Android.
 /// </summary>
 private static void Init_Android()
 {
     OVRDebugUtils.Print("Initializing input for Android.");
     allowKeyControls = true;
     platformPrefix   = "Android:";
 }
예제 #9
0
 /// <summary>
 /// Initializes the input system for Windows when running from the Unity editor.
 /// </summary>
 private static void Init_Windows_Editor()
 {
     OVRDebugUtils.Print("Initializing input for Windows Editor.");
     allowKeyControls = true;
     platformPrefix   = "Win:";
 }
예제 #10
0
 /// <summary>
 /// Initializes the input system for OSX.
 /// </summary>
 private static void Init_Windows()
 {
     OVRDebugUtils.Print("Initializing input for Windows.");
     allowKeyControls = false;
     platformPrefix   = "Win:";
 }