void CreateCharacterSelectPanels() { foreach (CharacterData data in characters) { CharacterSelectPanel newPanel = GameObject.Instantiate(characterSelectPanelPrefab); newPanel.transform.SetParent(this.transform); newPanel.Initialize(data); } }
void Start() { myMeshFilter = GetComponentInChildren <MeshFilter>(); myMeshRenderer = GetComponentInChildren <MeshRenderer>(); myMeshFilter.mesh = prefab.GetComponent <MeshFilter>().sharedMesh; myMeshRenderer.material = Instantiate(prefab.GetComponent <MeshRenderer>().sharedMaterial); CharacterSelectPanel panel = GetComponentInParent <CharacterSelectPanel>(); Color base_col = panel.colors[panel.id] * 2; myMeshRenderer.material.SetColor("_EmissionColor", base_col); }
public void SelectCharacter(CharacterSelectPanel panel) { panel.spriteAnimator.SetBool("WalkInPlace", true); selectedCharacter = panel.characterData; descriptionText.text = selectedCharacter.description; foreach (Transform child in transform) { CharacterSelectPanel p = child.GetComponent <CharacterSelectPanel>(); if (p && p != panel) { p.spriteAnimator.SetBool("WalkInPlace", false); } } uiToEnableWhenSelected.SetActive(true); }
private void UpdateNumberOfPlayersConnected(int numPlayers) { for (int iPanel = 0; iPanel < playerPanels.Length; ++iPanel) { playerPanels[iPanel].gameObject.SetActive(iPanel == numPlayers); } activePanel = playerPanels[numPlayers]; for (int iPlayer = 0; iPlayer < numPlayers; ++iPlayer) { playerCharacterSelects[iPlayer] = PlayerPrefs.GetInt("Player_" + iPlayer + "_Character", 0); if (playerCharacterSelects[iPlayer] >= charactersAvailable.Length) { playerCharacterSelects[iPlayer] = charactersAvailable.Length - 1; } SelectCharacterForPlayer(iPlayer, playerCharacterSelects[iPlayer], playerCharacterSelects[iPlayer]); } }
public void SelectedType(E_CHARACTER_TYPE type) { CharacterSelectPanel panel = GetPanel(UIPanelType.CharacterSelect) as CharacterSelectPanel; panel.SelectedType(type); }