コード例 #1
0
    void Update()
    {
        if (singleControls && playerCount < MAX_PLAYER_COUNT)
        {
            if (JoinButtonWasPressedOnListener(gamepadListener))
            {
                InputDevice inputDevice = InputManager.ActiveDevice;
                gamepadListener.ExcludeDevices.Add(inputDevice);
                if (ThereIsNoPlayerUsingThisGamePad(inputDevice))
                {
                    AssignInputDevice(inputDevice);
                }
            }

            if (BackButtonWasPressedOnListener(gamepadListener))
            {
                Application.LoadLevel(previousLevelName);
            }
        }

        if (globalControls)
        {
            if (specificGamepadListener.Join.WasPressed)
            {
                SaveSelectionInformationToContainer();
                DontDestroyOnLoad(SoundManager.SoundManagerInstance.Play(finishedSound, Vector3.zero, AudioGroup.MenuSounds));
                ChangeScene();
            }

            if (specificGamepadListener.Back.WasPressed)
            {
                SlotContainer slot = FindSlotContainer(InputManager.ActiveDevice);
                if (slot != null)
                {
                    slot.Deselect();
                }
            }
        }
    }