Пример #1
0
    protected override void OnEnter()
    {
        GameObject.Find("ReferenceBody").GetComponent <ReferenceBodyController>().ChangeSpeed(0f);

        selectionController = GameObject.Find("UI").transform.FindChild("CharacterSelection").GetComponent <CharacterSelectionController>();
        selectionController.gameObject.SetActive(true);

        selectedCharacters = new bool[] { false, false, false };
        characters         = new HeroController[3];



        string[] _joysticknames = Input.GetJoystickNames();
        activeJoysticks = new bool[] { false, false, false };

        /*foreach (string name in _joysticknames)
         * {
         *  Debug.Log("joystickname: " + name);
         * }*/

        for (int i = 0; i < 3; i++)
        {
            if (i < _joysticknames.Length && _joysticknames[i] != "")
            {
                //Debug.Log("active joystick recognized, index=" + i);
                activeJoysticks[i] = true;
            }
            else
            {
                break;
            }
        }

        characters[0] = GameObject.Find("ReferenceBody/Character1").GetComponent <HeroController>();
        characters[1] = GameObject.Find("ReferenceBody/Character2").GetComponent <HeroController>();
        characters[2] = GameObject.Find("ReferenceBody/Character3").GetComponent <HeroController>();

        currentJoystick  = 0;
        currentCharacter = 0;
        selectionController.HighlightCharacter(true, currentCharacter);
        selectionController.SetCurrentPlayerText("Player 1");

        selectionController.GoWhite(0);
        selectionController.GoWhite(1);
        selectionController.GoWhite(2);

        canChangeSelection = true;
    }