public virtual void setCustomColorsPlayer(GameObject go, GameProfileCustomItem customItem) { GameCustomPlayer player = go.GetComponent <GameCustomPlayer>(); if (player == null) { GameCustomPlayer[] players = go.GetComponentsInChildren <GameCustomPlayer>(true); foreach (GameCustomPlayer playerTo in players) { player = playerTo; break; } } if (player != null) { GameCustomController.SetMaterialColors(go, customItem); } }
public void LoadPlayer(string characterCodeTo, bool isProfileCharacter = false) { isProfileCharacterCode = isProfileCharacter; if (string.IsNullOrEmpty(characterCodeTo)) { return; } if (customCharacterData.characterCode == characterCodeTo && initialized) { return; } customCharacterData.characterCode = characterCodeTo; if (containerPlayerDisplay == null) { return; } string gameCharacterCode = customCharacterData.characterCode; if (isProfileCharacterCode) { // If this is a profile code or profile uuid character code // look it up in teh profile and get the model name there. gameProfileCharacterItem = GameProfileCharacters.Current.GetCharacter( customCharacterData.characterCode); if (gameProfileCharacterItem == null) { return; } // TODO REMOVE and make sure initial sets correctly. if (gameProfileCharacterItem.code == BaseDataObjectKeys.defaultKey) { gameCharacterCode = ProfileConfigs.defaultProfileCharacterCode; } else { gameCharacterCode = gameProfileCharacterItem.characterCode; } } GameCharacter gameCharacter = GameCharacters.Instance.GetById(gameCharacterCode); if (gameCharacter == null) { return; } containerPlayerDisplay.DestroyChildren(); GameObject go = gameCharacter.Load(); if (go == null) { return; } go.transform.parent = containerPlayerDisplay.transform; go.transform.position = Vector3.zero; go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; go.transform.localRotation = Quaternion.identity;//.Euler(Vector3.zero.WithY(133)); //GameController.CurrentGamePlayerController.LoadCharacter(gameCharacter.data.GetModel().code); go.SetLayerRecursively(gameObject.layer); // LOAD UP PASSED IN VALUES customPlayerObject = go.GetOrSet <GameCustomPlayer>(); if (customPlayerObject != null) { customPlayerObject.Change(customCharacterData); } GameCustomController.BroadcastCustomSync(); if (containerRotator != null) { containerRotator.ResetObject(); } initialized = true; }
public void LoadPlayer(string characterCodeTo) { if (string.IsNullOrEmpty(characterCodeTo)) { return; } customCharacterData.characterCode = characterCodeTo; if (containerPlayerDisplay == null) { return; } string gameCharacterCode = customCharacterData.characterCode; if (isProfileCharacterCode) { GameProfileCharacterItem gameProfileCharacterItem = GameProfileCharacters.Current.GetCharacter( customCharacterData.characterCode); if (gameProfileCharacterItem == null) { return; } gameCharacterCode = gameProfileCharacterItem.characterCode; } GameCharacter gameCharacter = GameCharacters.Instance.GetById(gameCharacterCode); if (gameCharacter == null) { return; } containerPlayerDisplay.DestroyChildren(); GameObject go = gameCharacter.Load(); if (go == null) { return; } go.transform.parent = containerPlayerDisplay.transform; go.transform.position = Vector3.zero; go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; go.transform.localRotation = Quaternion.identity;//.Euler(Vector3.zero.WithY(133)); //GameController.CurrentGamePlayerController.LoadCharacter(gameCharacter.data.GetModel().code); go.SetLayerRecursively(gameObject.layer); // LOAD UP PASSED IN VALUES customPlayerObject = go.GetOrSet <GameCustomPlayer>(); if (customPlayerObject != null) { customPlayerObject.Change(customCharacterData); } GameCustomController.BroadcastCustomSync(); if (containerRotator != null) { containerRotator.ResetObject(); } }
public void Fill(GameObject go) { gameCustomPlayer = go.Get <GameCustomPlayer>(); }