feat: Add roomPlayer parameter to OnRoomServerCreateGamePlayer (#1317)

* Adds roomPlayer parameter to OnRoomServerCreateGamePlayer

* fixed template
This commit is contained in:
MrGadget 2019-12-17 04:16:14 -05:00 committed by vis2k
parent 2b5370f129
commit abf5cdcf36
2 changed files with 18 additions and 3 deletions

View File

@ -1,4 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using UnityEngine;
using UnityEngine.SceneManagement;
@ -145,7 +147,7 @@ void SceneLoadedForPlayer(NetworkConnection conn, GameObject roomPlayer)
return;
}
GameObject gamePlayer = OnRoomServerCreateGamePlayer(conn);
GameObject gamePlayer = OnRoomServerCreateGamePlayer(conn, roomPlayer);
if (gamePlayer == null)
{
// get start position from base class
@ -518,7 +520,19 @@ public virtual GameObject OnRoomServerCreateRoomPlayer(NetworkConnection conn)
/// <para>By default the gamePlayerPrefab is used to create the game-player, but this function allows that behaviour to be customized. The object returned from the function will be used to replace the room-player on the connection.</para>
/// </summary>
/// <param name="conn">The connection the player object is for.</param>
/// <param name="roomPlayer">The room player object for this connection.</param>
/// <returns>A new GamePlayer object.</returns>
public virtual GameObject OnRoomServerCreateGamePlayer(NetworkConnection conn, GameObject roomPlayer)
{
return null;
}
/// <summary>
/// Obsolete: Use <see cref="OnRoomServerCreateGamePlayer{NetworkConnection conn, GameObject roomPlayer}"/> instead.
/// </summary>
/// <param name="conn">The connection the player object is for.</param>
/// <returns>A new GamePlayer object.</returns>
[EditorBrowsable(EditorBrowsableState.Never), Obsolete("Use OnRoomServerCreateGamePlayer<NetworkConnection, GameObject> instead")]
public virtual GameObject OnRoomServerCreateGamePlayer(NetworkConnection conn)
{
return null;

View File

@ -69,10 +69,11 @@ public class #SCRIPTNAME# : NetworkRoomManager
/// <para>By default the gamePlayerPrefab is used to create the game-player, but this function allows that behaviour to be customized. The object returned from the function will be used to replace the room-player on the connection.</para>
/// </summary>
/// <param name="conn">The connection the player object is for.</param>
/// <param name="roomPlayer">The room player object for this connection.</param>
/// <returns>A new GamePlayer object.</returns>
public override GameObject OnRoomServerCreateGamePlayer(NetworkConnection conn)
public override GameObject OnRoomServerCreateGamePlayer(NetworkConnection conn, GameObject roomPlayer)
{
return base.OnRoomServerCreateGamePlayer(conn);
return base.OnRoomServerCreateGamePlayer(conn, roomPlayer);
}
/// <summary>