Beispiel #1
0
        /// <summary>
        /// Go to the Next shape.
        /// </summary>
        public void NextShape()
        {
            if (ShapesManager.Shape.selectedShapeID >= 0 && ShapesManager.Shape.selectedShapeID < ShapesManager.instance.shapes.Count - 1)
            {
                //Get the next shape and check if it's locked , then do not load the next shape
                if (ShapesManager.Shape.selectedShapeID + 1 < ShapesManager.instance.shapes.Count)
                {
                    if (AlphabetDataManager.IsShapeLocked(ShapesManager.Shape.selectedShapeID + 1))
                    {
                        //Play lock sound effectd
                        if (lockedSFX != null && effectsAudioSource != null)
                        {
                            CommonUtil.PlayOneShotClipAt(lockedSFX, Vector3.zero, effectsAudioSource.volume);
                        }
                        //Skip the next
                        return;
                    }
                }

                ShapesManager.Shape.selectedShapeID++;
                CreateShape();                //Create new shape
            }
            else
            {
                if (ShapesManager.Shape.selectedShapeID == ShapesManager.instance.shapes.Count - 1)
                {
                    UIEvents.instance.LoadAlbumScene();
                }
                else
                {
                    //Play lock sound effectd
                    if (lockedSFX != null && effectsAudioSource != null)
                    {
                        CommonUtil.PlayOneShotClipAt(lockedSFX, Vector3.zero, effectsAudioSource.volume);
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Settings up the table shape contents in the table.
        /// </summary>
        /// <param name="tableShape">Table shape reference.</param>
        /// <param name="ID">ID of the shape.</param>
        /// <param name="groupIndex">Index of the group.</param>
        private void SettingUpTableShape(ShapesManager.Shape shape, TableShape tableShape, int ID, int groupIndex)
        {
            if (tableShape == null)
            {
                return;
            }

            shape.isLocked    = AlphabetDataManager.IsShapeLocked(ID);
            shape.starsNumber = AlphabetDataManager.GetShapeStars(ID);

            if (tableShape.ID == 0)
            {
                shape.isLocked = false;
            }

            if (!shape.isLocked)
            {
                tableShape.transform.Find("Cover").gameObject.SetActive(false);
                tableShape.transform.Find("Lock").gameObject.SetActive(false);
            }
            else
            {
                tableShape.transform.Find("Stars").gameObject.SetActive(false);
            }

            //Set Last reached shape
            if (!shape.isLocked)
            {
                if (PlayerPrefs.HasKey(AlphabetDataManager.GetLockedStrKey(ID + 1)))
                {
                    if (AlphabetDataManager.IsShapeLocked(ID + 1))
                    {
                        SetSelectedGroup(groupIndex);
                    }
                }
                else if (!PlayerPrefs.HasKey(AlphabetDataManager.GetStarsStrKey(ID)))
                {
                    SetSelectedGroup(groupIndex);
                }
            }

            tempTransform = tableShape.transform.Find("Stars");

            //Apply the current Stars Rating
            if (shape.starsNumber == ShapesManager.Shape.StarsNumber.ONE)
            {                            //One Star
                tempTransform.Find("FirstStar").GetComponent <Image> ().sprite  = starOn;
                tempTransform.Find("SecondStar").GetComponent <Image> ().sprite = starOff;
                tempTransform.Find("ThirdStar").GetComponent <Image> ().sprite  = starOff;
                collectedStars += 1;
            }
            else if (shape.starsNumber == ShapesManager.Shape.StarsNumber.TWO)
            {                            //Two Stars
                tempTransform.Find("FirstStar").GetComponent <Image> ().sprite  = starOn;
                tempTransform.Find("SecondStar").GetComponent <Image> ().sprite = starOn;
                tempTransform.Find("ThirdStar").GetComponent <Image> ().sprite  = starOff;
                collectedStars += 2;
            }
            else if (shape.starsNumber == ShapesManager.Shape.StarsNumber.THREE)
            {                            //Three Stars
                tempTransform.Find("FirstStar").GetComponent <Image> ().sprite  = starOn;
                tempTransform.Find("SecondStar").GetComponent <Image> ().sprite = starOn;
                tempTransform.Find("ThirdStar").GetComponent <Image> ().sprite  = starOn;
                collectedStars += 3;
            }
            else                                //Zero Stars
            {
                tempTransform.Find("FirstStar").GetComponent <Image> ().sprite  = starOff;
                tempTransform.Find("SecondStar").GetComponent <Image> ().sprite = starOff;
                tempTransform.Find("ThirdStar").GetComponent <Image> ().sprite  = starOff;
            }
        }