Ejemplo n.º 1
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        instance = this;

        names = new string[Input.GetJoystickNames().Length];

        names = Input.GetJoystickNames();
        for (int x = 0; x < names.Length; x++)
        {
            //print(names[x].Length);
            //print(names[x]);
            if (names[x].Length == 19)
            {
                print("PS4 CONTROLLER IS CONNECTED");
                //ShowDebugsGame.Instance.AddText("Input: ", "Ps4 controller is connected");
                PS4_Controller      = 1;
                Xbox_One_Controller = 0;
            }
            if (names[x].Length == 33)
            {
                print("XBOX ONE CONTROLLER IS CONNECTED");
                //ShowDebugsGame.Instance.AddText("Input: ", "Xbox controller is connected");
                //set a controller bool to true
                PS4_Controller      = 0;
                Xbox_One_Controller = 1;
            }
        }

        if (Xbox_One_Controller == 1)
        {
            //do something
            xboxJoystickConnected = true;
            ps4JoystickConnected  = false;
        }
        else if (PS4_Controller == 1)
        {
            //do something
            xboxJoystickConnected = false;
            ps4JoystickConnected  = true;
        }
        else
        {
            // there is no controllers
            //ShowDebugsGame.Instance.AddText("Input: ", "keyboard");
            pcInputs = true;        //This only to show feedback about controls when there is not controllers
        }
    }
Ejemplo n.º 3
0
 private void Start()
 {
     detectionScript = FindObjectOfType <JoystickDetection>();
     view            = GetComponentInChildren <Image>();
     view.gameObject.SetActive(false);
 }