Пример #1
0
    /*
     * Checks all input sources for a player pressing "Start" and binds them when they join.
     */
    void PollForNewPlayer()
    {
        int nextPlayerIndex = NumPlayers;

        foreach (InputDevice device in InputDevices.GetAllInputDevices())
        {
            if (!boundDevices.ContainsKey(device) || (IsCheatingEnabled && cheats.BIND_MANY_TO_ONE_DEVICE))
            {
                if (RBInput.GetButtonDownForPlayer(InputStrings.PAUSE, nextPlayerIndex, device))
                {
                    BindNextPlayer(device);

                    // Deactivate the splash screen once a player is bound. This is NOT ideal, but
                    // neither is putting a splash screen into every scene. It should be it's own scene.
                    WorldTime worldTime  = (WorldTime)GetComponent <WorldTime> ();
                    Transform startPoint = worldTime.startPointP2;
                    if (NumPlayers == 1)
                    {
                        HideSplashScreen();
                        worldTime.Reset();
                    }
                    else
                    {
                        players [nextPlayerIndex].GetComponent <PlayerController> ().SnapToPoint(startPoint);
                    }
                }
            }
        }
    }