Fix duplicate init else player, duplicate model
This commit is contained in:
@@ -312,12 +312,23 @@ namespace PerfectWorld.Scripts.Managers
|
||||
|
||||
// Has player been in active player table ?
|
||||
EC_ElsePlayer pPlayer = GetElsePlayer(info.cid);
|
||||
if (pPlayer)
|
||||
if (pPlayer != null)
|
||||
{
|
||||
// This player has existed in player table, call special initial function
|
||||
// TODO: fix after pPlayer init
|
||||
pPlayer.Init(roleInfo, info);
|
||||
return pPlayer;
|
||||
// Check if the GameObject is still valid (not destroyed)
|
||||
if (pPlayer.gameObject != null)
|
||||
{
|
||||
// This player has existed in player table, call special initial function
|
||||
pPlayer.Init(roleInfo, info);
|
||||
return pPlayer;
|
||||
}
|
||||
else
|
||||
{
|
||||
// GameObject was destroyed but entry still exists in table - clean it up
|
||||
lock (m_csPlayerTab)
|
||||
{
|
||||
m_PlayerTab.Remove(info.cid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create a new player
|
||||
|
||||
Reference in New Issue
Block a user