예제 #1
0
 void Start()
 {
     //used to read if we have controllers connected through unity interface
     string[] Connected = Input.GetJoystickNames();
     if (Connected.Length > 0)
     {
         isController = true;
     }
     //init basic info needed to spawn the players
     m_PlayerSpawnerBeh.InitPlayerInfo();
     //spawn the players
     m_PlayerSpawnerBeh.SpawnPlayers();
     //init the camera, along with what obj the camera will follow
     m_CamBeh.Init(m_PlayerSpawnerBeh.GetPlayer);
     //set the game type and controlls need to be distrubted to the players
     m_InputManagerBeh.InitGame(InputManager.GameType.BallGame);
     // if there is one player in the game, and he doesn't want to use the keyboard
     //SinglePlayerController = isController && m_NumPlayers == 1 && SinglePlayerController ? true : false;
     //used cuz singleplayer controller isn't set up and i dont care about doing it at this moment
     //SinglePlayerController = false;
     //assign input to the players that are connected
     m_InputManagerBeh.AssignInput(m_PlayerSpawnerBeh, m_NumPlayers, SinglePlayerController, m_HowToPlay);
     //set the user
     m_User = m_PlayerSpawnerBeh.GetPlayer.GetComponent <Ball>();
 }