public void SetColor(ColorSelectorIndex csi) { List <int> takenColors = SceneStateManager.Instance.GetTakenColors(); if (!takenColors.Contains(csi.Idx)) { SceneStateManager.Instance.SetColor(PhotonNetwork.LocalPlayer, csi.Idx); } }
public void UpdateColors() { List <int> takenColors = SceneStateManager.Instance.GetTakenColors(); for (var index = 0; index < ImagesGameObjects.Count; index++) { var imagesGameObject = ImagesGameObjects[index]; ColorSelectorIndex colorIdx = imagesGameObject.GetComponent <ColorSelectorIndex>(); var taken = colorIdx.Taken; taken.SetActive(takenColors.Contains(colorIdx.Idx)); } }
void Start() { ImagesGameObjects = new List <GameObject>(); int idx = 0; foreach (var characterColor in CharacterColors.colors) { //Image img = this.gameObject.AddComponent<Image>(); GameObject createdGameObject = Instantiate(ImagePrefab, this.transform); createdGameObject.GetComponent <Image>().color = characterColor; ColorSelectorIndex csi = createdGameObject.GetComponent <ColorSelectorIndex>(); csi.Idx = idx++; List <int> takenColors = SceneStateManager.Instance.GetTakenColors(); csi.Taken.SetActive(takenColors.Contains(csi.Idx)); ImagesGameObjects.Add(createdGameObject); } ColorUpdated.Raise(); }