コード例 #1
0
        void StartNewPlayer(object sender, PlayerConnectMessageArgs e)
        {
            ExampleSimpleGameSettings settings = ExampleSimpleGameSettings.settings();
            Vector3 position = new Vector3(m_rand.Next(settings.areaWidth), 0, m_rand.Next(settings.areaHeight));
            // Spawn a new player then add a script to it.
            GameObject gameObject = (GameObject)Instantiate(prefabToSpawnForPlayer, position, Quaternion.identity);
            // Add the ExampleSimplePlayer script to this object. Note: We could possible add this to the prefab.
            // Not sure which is best.
            ExampleSimplePlayer player = gameObject.AddComponent <ExampleSimplePlayer>();

            player.Init(e.netPlayer);
        }
コード例 #2
0
 void StartNewPlayer(PlayerConnectMessageArgs e)
 {
     StartPlayer(e.netPlayer, e.data);
 }