public void QueryControllers()
    {
        int queriedNumberOfCtrlrs = XCI.GetNumPluggedCtrlrs();

        if (queriedNumberOfCtrlrs == 1)
        {
            Debug.Log("Only " + queriedNumberOfCtrlrs + " Xbox controller plugged in.");
        }
        else if (queriedNumberOfCtrlrs == 0)
        {
            Debug.Log("No Xbox controllers plugged in!");
        }
        else
        {
            Debug.Log(queriedNumberOfCtrlrs + " Xbox controllers plugged in.");
        }

        XCI.DEBUG_LogControllerNames();

        // This code only works on Windows
        if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor)
        {
            Debug.Log("Windows Only:: Any Controller Plugged in: " + XCI.IsPluggedIn(XboxController.Any).ToString());

            Debug.Log("Windows Only:: Controller 1 Plugged in: " + XCI.IsPluggedIn(XboxController.First).ToString());
            Debug.Log("Windows Only:: Controller 2 Plugged in: " + XCI.IsPluggedIn(XboxController.Second).ToString());
            Debug.Log("Windows Only:: Controller 3 Plugged in: " + XCI.IsPluggedIn(XboxController.Third).ToString());
            Debug.Log("Windows Only:: Controller 4 Plugged in: " + XCI.IsPluggedIn(XboxController.Fourth).ToString());
        }
    }
 private void Awake()
 {
     XCI.DEBUG_LogControllerNames();
     character = new[]
     {
         new menuCharacterInfo
         {
             index = -1,
             id    = XboxController.First
         },
         new menuCharacterInfo
         {
             index = -1,
             id    = XboxController.Second
         },
         new menuCharacterInfo
         {
             index = -1,
             id    = XboxController.Third
         },
         new menuCharacterInfo
         {
             index = -1,
             id    = XboxController.Fourth
         },
     };
 }
Exemple #3
0
        private void Start()
        {
            camTransform = transform;
            cam          = Camera.main;

            if (!didQueryNumOfCtrlrs)
            {
                didQueryNumOfCtrlrs = true;

                int queriedNumberOfCtrlrs = XCI.GetNumPluggedCtrlrs();
                if (queriedNumberOfCtrlrs == 1)
                {
                    Debug.Log("Only " + queriedNumberOfCtrlrs + " Xbox controller plugged in.");
                }
                else if (queriedNumberOfCtrlrs == 0)
                {
                    Debug.Log("No Xbox controllers plugged in!");
                }
                else
                {
                    Debug.Log(queriedNumberOfCtrlrs + " Xbox controllers plugged in.");
                }

                XCI.DEBUG_LogControllerNames();
            }
        }
Exemple #4
0
    void Start()
    {
        controller = GetComponent <Controller2D> ();
        anim       = GetComponent <Animator> ();

        if (!didQueryNumOfCtrlrs)
        {
            didQueryNumOfCtrlrs = true;
            int queriedNumberOfCtrlrs = XCI.GetNumPluggedCtrlrs();

            if (queriedNumberOfCtrlrs == 1)
            {
                Debug.Log("Only " + queriedNumberOfCtrlrs + " Xbox controller plugged in.");
            }
            else if (queriedNumberOfCtrlrs == 0)
            {
                Debug.Log("No Xbox controllers plugged in!");
            }
            else
            {
                Debug.Log(queriedNumberOfCtrlrs + " Xbox controllers plugged in.");
            }

            XCI.DEBUG_LogControllerNames();
        }


        gravity         = -(2 * maxJumpHeight) / Mathf.Pow(timeToJumpApex, 2);
        maxJumpVelocity = Mathf.Abs(gravity) * timeToJumpApex;
        minJumpVelocity = Mathf.Sqrt(2 * Mathf.Abs(gravity) * minJumpHeight);
    }
Exemple #5
0
 void Start()
 {
     hero          = FindObjectOfType <Hero>();
     heroRigid     = hero.GetComponent <Rigidbody2D>();
     hand          = FindObjectOfType <Hand>();
     playerManager = FindObjectOfType <PlayerManager>();
     XCI.DEBUG_LogControllerNames();
     health = MAX_HEALTH;
 }
    // Start is called before the first frame update
    void Start()
    {
        // Search for controllers:
        if (!hasSearchedForControllers && !toggleDebugMode.startInDebugMode)
        {
            hasSearchedForControllers = true;

            connectedControllers = XCI.GetNumPluggedCtrlrs();
            if (connectedControllers == 1)
            {
                Debug.Log("Only " + connectedControllers + " Xbox controller plugged in.");
                controllerFound = true;
            }
            else if (connectedControllers == 0)
            {
                Debug.Log("No Xbox controllers plugged in!");
            }
            else
            {
                Debug.Log(connectedControllers + " Xbox controllers plugged in.");
                controllerFound = true;
            }

            XCI.DEBUG_LogControllerNames();
        }

        // Adding the player containers to a list.
        for (int i = 0; i < playerContainersGroup.transform.childCount; ++i)
        {
            playerContainers.Add(playerContainersGroup.transform.GetChild(i).transform.gameObject.GetComponent <PlayerContainer>());
        }

        // Adding to the yet to bed added list
        for (int c = 1; c < connectedControllers + 1; ++c)
        {
            XboxController xboxController = ((XboxController)c);

            if (xboxController == XboxController.All)
            {
                continue;
            }

            connectedControllerList.Add(xboxController);
        }

        // Getting the fade panel.
        panel = fadePanel.GetComponent <FadePanel>();

        // Setting up the timer.
        gameStartTimer     = maxGameStartTimer;
        gameStartText.text = startingGameInText + gameStartTimer.ToString("0.00");
    }
Exemple #7
0
    // Start
    void Start()
    {
        switch (controller)
        {
        case XboxCtrlrInput.XboxController.First: GetComponent <Renderer>().material = matRed; break;

        case XboxCtrlrInput.XboxController.Second: GetComponent <Renderer>().material = matGreen; break;

        case XboxCtrlrInput.XboxController.Third: GetComponent <Renderer>().material = matBlue; break;

        case XboxCtrlrInput.XboxController.Fourth: GetComponent <Renderer>().material = matYellow; break;
        }


        newPosition = transform.position;


        // Call for the number of connected controllers once
        if (!didQueryNumOfCtrlrs)
        {
            didQueryNumOfCtrlrs = true;

            int queriedNumberOfCtrlrs = XCI.GetNumPluggedCtrlrs();

            if (queriedNumberOfCtrlrs == 1)
            {
                Debug.Log("Only " + queriedNumberOfCtrlrs + " Xbox controller plugged in.");
            }
            else if (queriedNumberOfCtrlrs == 0)
            {
                Debug.Log("No Xbox controllers plugged in!");
            }
            else
            {
                Debug.Log(queriedNumberOfCtrlrs + " Xbox controllers plugged in.");
            }

            XCI.DEBUG_LogControllerNames();

            // This code only works on Windows
            if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor)
            {
                Debug.Log("Windows Only:: Any Controller Plugged in: " + XCI.IsPluggedIn(XboxCtrlrInput.XboxController.Any).ToString());

                Debug.Log("Windows Only:: Controller 1 Plugged in: " + XCI.IsPluggedIn(XboxCtrlrInput.XboxController.First).ToString());
                Debug.Log("Windows Only:: Controller 2 Plugged in: " + XCI.IsPluggedIn(XboxCtrlrInput.XboxController.Second).ToString());
                Debug.Log("Windows Only:: Controller 3 Plugged in: " + XCI.IsPluggedIn(XboxCtrlrInput.XboxController.Third).ToString());
                Debug.Log("Windows Only:: Controller 4 Plugged in: " + XCI.IsPluggedIn(XboxCtrlrInput.XboxController.Fourth).ToString());
            }
        }
    }
    void Start()
    {
        timeToShoot = 0;
        rb          = GetComponent <Rigidbody>();

        timeToBomb = 0;

        if (!didQueryNumOfCtrlrs)
        {
            didQueryNumOfCtrlrs = true;

            int queriedNumberOfCtrlrs = XCI.GetNumPluggedCtrlrs();

            if (queriedNumberOfCtrlrs == 1)
            {
                Debug.Log("Só um controle Xbox conectado.");
            }
            else if (queriedNumberOfCtrlrs == 0)
            {
                Debug.Log("Não há controles Xbox conectados");
            }
            else
            {
                Debug.Log(queriedNumberOfCtrlrs + " controles Xbox conectados.");
            }

            XCI.DEBUG_LogControllerNames();

            // This code only works on Windows
            if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor)
            {
                Debug.Log("Apenas em Windows:: Algum controle conectado: " + XCI.IsPluggedIn(XboxController.Any).ToString());

                Debug.Log("Apenas em Windows:: Controle 1 conectado: " + XCI.IsPluggedIn(XboxController.First).ToString());
                Debug.Log("Apenas em Windows:: Controle 2 conectado: " + XCI.IsPluggedIn(XboxController.Second).ToString());
                Debug.Log("Apenas em Windows:: Controle 3 conectado: " + XCI.IsPluggedIn(XboxController.Third).ToString());
                Debug.Log("Apenas em Windows:: Controle 4 conectado: " + XCI.IsPluggedIn(XboxController.Fourth).ToString());
            }
        }
        sangle = Mathf.Sin(angle * Mathf.PI / 180);
        cangle = Mathf.Cos(angle * Mathf.PI / 180);

        anim = GetComponentInChildren <Animator>();
        stat = GetComponent <PlayerStatus>();
    }
Exemple #9
0
#pragma warning restore IDE0044 // Add readonly modifier

    // Start is called before the first frame update
    void Start()
    {
        playerHeight = GetComponent <CapsuleCollider>().bounds.size.y;

        tongueHitPoints = new List <Vector3>
        {
            Vector3.zero
        };

        // Only draws tongue if there is a line renderer on the game object
        line = GetComponent <LineRenderer>();
        line.positionCount = 0;;

        rb = gameObject.GetComponent <Rigidbody>();

        if (!didQueryNumOfCtrlrs)
        {
            didQueryNumOfCtrlrs = true;

            int queriedNumberOfCtrlrs = XCI.GetNumPluggedCtrlrs();
            if (queriedNumberOfCtrlrs == 1)
            {
                Debug.Log("Only " + queriedNumberOfCtrlrs + " Xbox controller plugged in.");
            }
            else if (queriedNumberOfCtrlrs == 0)
            {
                Debug.Log("No Xbox controllers plugged in!");
            }
            else
            {
                Debug.Log(queriedNumberOfCtrlrs + " Xbox controllers plugged in.");
            }

            XCI.DEBUG_LogControllerNames();
        }
        // getting component for animation and sound
        anim        = GetComponent <Animator>();
        audiosource = GetComponent <AudioSource>();
        TongueCoolDownSoundPlayed = true;
        // Set variables on spawn point
        SpawnPos = transform.position;
        SpawnRot = transform.rotation;

        playernumber = (XInputDotNetPure.PlayerIndex)controller - 1;
    }
    // Start
    void Start()
    {
        playerNumber = Mathf.Clamp(playerNumber, 1, 4);

        switch (playerNumber)
        {
        case 1: GetComponent <Renderer>().material = matRed; break;

        case 2: GetComponent <Renderer>().material = matGreen; break;

        case 3: GetComponent <Renderer>().material = matBlue; break;

        case 4: GetComponent <Renderer>().material = matYellow; break;
        }

        newPosition = transform.position;

        if (!didQueryNumOfCtrlrs)
        {
            didQueryNumOfCtrlrs = true;

            int queriedNumberOfCtrlrs = XCI.GetNumPluggedCtrlrs();
            if (queriedNumberOfCtrlrs == 1)
            {
                Debug.Log("Only " + queriedNumberOfCtrlrs + " Xbox controller plugged in.");
            }
            else if (queriedNumberOfCtrlrs == 0)
            {
                Debug.Log("No Xbox controllers plugged in!");
            }
            else
            {
                Debug.Log(queriedNumberOfCtrlrs + " Xbox controllers plugged in.");
            }

            XCI.DEBUG_LogControllerNames();
        }
    }
Exemple #11
0
    // @brief Runs at the start of the games launch
    //		  Querys how many controllers are plugged into the system and outputs the amount
    private void Start()
    {
        if (!didQueryNumOfCtrlrs)
        {
            didQueryNumOfCtrlrs = true;

            int queriedNumOfCtrls = XCI.GetNumPluggedCtrlrs();
            if (queriedNumOfCtrls == 1)
            {
                Debug.Log("Only " + queriedNumOfCtrls + " Xbox Controller plugged in.");
            }
            else if (queriedNumOfCtrls == 0)
            {
                Debug.Log("No Xbox Controllers plugged in!");
            }
            else
            {
                Debug.Log(queriedNumOfCtrls + " Xbox Controllers plugged in.");
            }

            XCI.DEBUG_LogControllerNames();
        }
    }
    // Start
    void Start()
    {
        switch (controller)
        {
        case XboxController.First: GetComponent <Renderer>().material = matRed; break;

        case XboxController.Second: GetComponent <Renderer>().material = matGreen; break;

        case XboxController.Third: GetComponent <Renderer>().material = matBlue; break;

        case XboxController.Fourth: GetComponent <Renderer>().material = matYellow; break;
        }


        newPosition = transform.position;

        if (!didQueryNumOfCtrlrs)
        {
            didQueryNumOfCtrlrs = true;

            int queriedNumberOfCtrlrs = XCI.GetNumPluggedCtrlrs();
            if (queriedNumberOfCtrlrs == 1)
            {
                Debug.Log("Only " + queriedNumberOfCtrlrs + " Xbox controller plugged in.");
            }
            else if (queriedNumberOfCtrlrs == 0)
            {
                Debug.Log("No Xbox controllers plugged in!");
            }
            else
            {
                Debug.Log(queriedNumberOfCtrlrs + " Xbox controllers plugged in.");
            }

            XCI.DEBUG_LogControllerNames();
        }
    }
Exemple #13
0
 // Use this for initialization
 void Start()
 {
     Debug.developerConsoleVisible = true;
     XCI.DEBUG_LogControllerNames();
 }
 // Start is called before the first frame update
 void Start()
 {
     XCI.DEBUG_LogControllerNames();
     Debug.Log(XCI.GetNumPluggedCtrlrs());
 }