public void SetColor(ColorSelectorIndex csi)
    {
        List <int> takenColors = SceneStateManager.Instance.GetTakenColors();

        if (!takenColors.Contains(csi.Idx))
        {
            SceneStateManager.Instance.SetColor(PhotonNetwork.LocalPlayer, csi.Idx);
        }
    }
示例#2
0
        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));
            }
        }
示例#3
0
        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();
        }