public static void AddPlayer(GameObject newPlayer, bool bSetLevel = true) { if (newPlayer == null) { return; } newPlayer.ExcludeCloneName(); PalNPC component = newPlayer.GetComponent <PalNPC>(); if (component == null) { return; } if (!PlayersManager.ActivePlayers.Contains(newPlayer)) { newPlayer.transform.parent = null; if (newPlayer.GetComponent <SavePrefabTarget>() == null) { SavePrefabTarget savePrefabTarget = newPlayer.AddComponent <SavePrefabTarget>(); } if (component.model == null) { PalNPC palNPC = component; palNPC.OnLoadModelEnd = (PalNPC.void_fun_TF)Delegate.Combine(palNPC.OnLoadModelEnd, new PalNPC.void_fun_TF(PlayersManager.WaitLoadOverThanSetActiveFalse)); } else { AnimCtrlScript component3 = component.model.GetComponent <AnimCtrlScript>(); component3.ActiveAnimCrossFade("ZhanLi", false, 0f, true); if (component.Data.CharacterID == 2) { if (!component.animator.GetCurrentAnimatorStateInfo(0).IsName("yidongState.ZhanLi")) { //LateSetActive.Init(component.model, false, 0.01f); } else { UtilFun.SetActive(component.model, false); } } else { UtilFun.SetActive(component.model, false); } } if (bSetLevel) { PlayersManager.SetLevel(newPlayer); } PlayersManager.ActivePlayers.Add(newPlayer); if (component.Data != null) { FlagManager.SetBoolFlag((ulong)(34048L + (long)component.Data.CharacterID), true); } } else { Debug.Log("Log : PlayersManager.AddPlayer 已经存在 " + newPlayer.name); } }