Beispiel #1
0
        public void ShowWin(ILivingLetterData livingLetterData)
        {
            this.transform.position = offscreenPosition;
            LLPrefab.gameObject.SetActive(true);
            vfx.gameObject.SetActive(true);
            if (livingLetterData != null)
            {
                LLPrefab.Init(livingLetterData);
            }
            LLPrefab.DoHorray();
            vfx.Play();

            StartCoroutine(Move_Coroutine(offscreenPosition, onscreenPosition, moveDuration));
        }
Beispiel #2
0
        public EggLivingLetter(Transform parent, GameObject letterObjectViewPrefab, GameObject shadowPrefab, ILivingLetterData livingLetterData, Vector3 startPosition, Vector3 shadowPosition, Vector3 endPosition, float delay, Action endCallback)
        {
            livingLetter = UnityEngine.Object.Instantiate(letterObjectViewPrefab).GetComponent <LivingLetterController>();

            livingLetter.transform.SetParent(parent);
            livingLetter.transform.localPosition = startPosition;
            livingLetter.Init(livingLetterData);
            livingLetter.transform.localScale *= startScale;
            livingLetter.gameObject.SetActive(false);

            shadowTransform = UnityEngine.Object.Instantiate(shadowPrefab).transform;
            shadowTransform.SetParent(parent);
            shadowLocalPosition           = shadowPosition;
            shadowTransform.localPosition = shadowLocalPosition;
            shadowTransform.localScale   *= 0.7f;
            shadowTransform.gameObject.SetActive(false);

            this.startPosition = startPosition;
            this.endPosition   = endPosition;

            this.delay = delay;

            this.endCallback = endCallback;

            JumpToEnd();
        }
Beispiel #3
0
        public void Init(LL_WordData _data)
        {
            wordData = _data;
            LLPrefab.Init(_data);

            //var text = ArabicFixer.Fix(_data.Data.Arabic);
            //tmpText.text = text;
        }
Beispiel #4
0
        protected virtual LivingLetterController SpawnLetter()
        {
            // Spawn!
            LivingLetterController LLController = Instantiate(livingLetterPrefab);

            LLController.gameObject.SetActive(true);
            LLController.transform.SetParent(transform, true);

            Vector3 newPosition = walkableArea.GetFurthestSpawn(letterGOs); // Find isolated spawn point

            LLController.transform.position = newPosition;
            LLController.transform.rotation = Quaternion.Euler(0, UnityEngine.Random.value * 360, 0);
            LLController.Init(AppManager.I.Teacher.GetAllTestLetterDataLL().GetRandom());

            LLController.gameObject.AddComponent <Rigidbody>().isKinematic = true;

            foreach (var collider in LLController.gameObject.GetComponentsInChildren <Collider>())
            {
                collider.isTrigger = true;
            }

            var characterController = LLController.gameObject.AddComponent <CharacterController>();

            characterController.height = 6;
            characterController.center = Vector3.up * 3;
            characterController.radius = 1.5f;
            LLController.gameObject.AddComponent <LetterCharacterController>();

            var livingLetter = LLController.gameObject.AddComponent <IntroStrollingLetter>();

            livingLetter.factory = this;

            var pos = LLController.transform.position;

            pos.y = 10;
            LLController.transform.position = pos;

            letters.Add(livingLetter);
            letterGOs.Add(livingLetter.gameObject);

            livingLetter.onDropped += (result) =>
            {
                if (result)
                {
                    letters.Remove(livingLetter);
                    letterGOs.Remove(livingLetter.gameObject);
                    toDestroy.Enqueue(livingLetter);
                }

                if (onDropped != null)
                {
                    onDropped(LLController.Data, result);
                }
            };

            return(LLController);
        }
Beispiel #5
0
        void Start()
        {
            // By default, the letter shows a truly random letter
            LLInStage.Init(AppManager.I.Teacher.GetRandomTestLetterLL(useMaxJourneyData: true));

            Setup();

            btAddTween = BtAdd.transform.DORotate(new Vector3(0, 0, -45), 0.3f).SetAutoKill(false).Pause()
                         .SetEase(Ease.OutBack)
                         .OnRewind(() => {
                if (AppManager.I.PlayerProfileManager.GetPlayersIconData() == null ||
                    AppManager.I.PlayerProfileManager.GetPlayersIconData().Count == 0)
                {
                    BtAdd.Pulse();
                }
            });
            btPlayTween = DOTween.Sequence().SetAutoKill(false).Pause()
                          .Append(BtPlay.RectT.DOAnchorPosY(-210, 0.2f).From(true))
                          .OnPlay(() => BtPlay.gameObject.SetActive(true))
                          .OnRewind(() => BtPlay.gameObject.SetActive(false))
                          .OnComplete(() => BtPlay.Pulse());

            BtPlay.gameObject.SetActive(false);

            // Listeners
            BtAdd.Bt.onClick.AddListener(() => OnClick(BtAdd));
            BtPlay.Bt.onClick.AddListener(() => {
                AudioManager.I.PlaySound(Sfx.UIButtonClick);
                HomeScene.Play();
            });
            foreach (PlayerIcon pIcon in playerIcons)
            {
                PlayerIcon p = pIcon;
                p.UIButton.Bt.onClick.AddListener(() => OnSelectProfile(p));
            }
        }
Beispiel #6
0
        public void getNewLetterData()
        {
            ILivingLetterData newLetter = game.questionManager.getNewLetter();

            letterView.Init(newLetter);
            letterView.Label.GetComponent <TextRender>().SetLetterData(newLetter);


            //game.LLPrefab.dotlessLetter.text = newLetter.TextForLivingLetter;

            string letterWithoutDiac = removeDiacritics(newLetter.TextForLivingLetter);

            dotlessLetter.GetComponent <TextRender>().SetText(letterWithoutDiac, true);

            //Deal with dotless letters
            if (!game.LettersWithDots.Contains(letterWithoutDiac))
            {
                correctDot.text = "";
                correctDotCollider.GetComponent <BoxCollider>().enabled = false;
            }

            //Deal with letters with dots
            else
            {
                correctDot.text = letterWithoutDiac;
                correctDotCollider.GetComponent <BoxCollider>().enabled = true;
            }

            //Deal with Diacritics if any
            if (letterWithoutDiac != newLetter.TextForLivingLetter)
            {
                Debug.Log(newLetter.TextForLivingLetter + " " + letterWithoutDiac + " " + letterView.Label.mesh.vertexCount);

                StopCoroutine(processCorrectDiacPose());
                StartCoroutine(processCorrectDiacPose());

                //dotlessLetter.GetComponent<TextRender>().setText(letterWithoutDiac, true);

                correctDiacCollider.GetComponent <BoxCollider>().enabled = true;
            }
            else
            {
                correctDiacCollider.GetComponent <BoxCollider>().enabled = false;
            }
        }
Beispiel #7
0
        protected override void Start()
        {
            base.Start();
            GlobalUI.ShowPauseMenu(false, PauseMenuType.StartScreen);
            KeeperManager.I.PlayDialogue(LocalizationDataId.Game_Title_2, false, true, null, KeeperMode.LearningThenNativeNoSubtitles);

            AnturaAnimController.State = AnturaAnimation;
            LLAnimController.State     = LLAnimation;

            LLAnimController.Init(AppManager.I.Teacher.GetRandomTestLetterLL(useMaxJourneyData: true));

            AppManager.I.AppSettings.KioskMode              = true;
            AppManager.I.AppSettings.ShareAnalyticsEnabled  = true;
            AppManager.I.AppSettings.KeeperSubtitlesEnabled = true;
            updateUI();

            AppManager.I.Services.Analytics.TrackKioskEvent("kiosk_home");
        }
Beispiel #8
0
        public void getNewLetterData()
        {
            ILivingLetterData newLetter = game.questionManager.getNewLetter();

            letterView.Init(newLetter);
            letterView.LabelRender.SetLetterData(newLetter);

            string extractedDiacritic;
            string letterWithoutDiac;

            ExtractDiacritics(newLetter.TextForLivingLetter, out letterWithoutDiac, out extractedDiacritic);
            correctDiac.text = extractedDiacritic;

            // @note: TODO: this Text UI  uses a special font without dots
            dotlessLetter.GetComponent <TextRender>().SetText(letterWithoutDiac, LanguageUse.Learning);

            var letterData = (newLetter as LL_LetterData).Data;

            // Deal with Dots if any
            if (letterData.HasDot)
            {
                // @note: this Text UI uses a special font with dots only and no letters
                correctDot.text = letterWithoutDiac;
                correctDotCollider.GetComponent <BoxCollider>().enabled = true;
            }
            else
            {
                correctDot.text = "";
                correctDotCollider.GetComponent <BoxCollider>().enabled = false;
            }

            // Deal with Diacritics if any
            if (letterData.HasDiacritic)// letterWithoutDiac != newLetter.TextForLivingLetter)
            {
                StopCoroutine(processCorrectDiacPose());
                StartCoroutine(processCorrectDiacPose());
                correctDiacCollider.GetComponent <BoxCollider>().enabled = true;
            }
            else
            {
                correctDiacCollider.GetComponent <BoxCollider>().enabled = false;
            }
        }
Beispiel #9
0
        protected override void Start()
        {
            base.Start();
            GlobalUI.ShowPauseMenu(false, PauseMenuType.StartScreen);
            AudioManager.I.PlaySound(Sfx.GameTitle);

            AnturaAnimController.State = AnturaAnimation;
            LLAnimController.State     = LLAnimation;

            LLAnimController.Init(AppManager.I.Teacher.GetRandomTestLetterLL(useMaxJourneyData: true));

            AppManager.I.AppSettings.KioskMode             = true;
            AppManager.I.AppSettings.ShareAnalyticsEnabled = true;
            AppManager.I.AppSettings.SubtitlesEnabled      = true;
            AppManager.I.AppSettings.EnglishSubtitles      = true;
            updateUI();

            AppManager.I.Services.Analytics.TrackKioskEvent("kiosk_home");
        }
Beispiel #10
0
        //uses fast crowd letter management and dragging:
        public TakeMeHomeLL spawnLetter(ILivingLetterData data)
        {
            //

            LivingLetterController letterObjectView = Instantiate(LLPrefab);

            letterObjectView.gameObject.SetActive(true);
            letterObjectView.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
            letterObjectView.transform.SetParent(transform, true);
            Vector3 newPosition = GetComponent <TakeMeHomeGame> ().LLSpawnPosition.position;           // = walkableArea.GetFurthestSpawn(letters); // Find isolated spawn point

            letterObjectView.transform.position = newPosition;
            //letterObjectView.transform.rotation = Quaternion.identity
            letterObjectView.Init(data);

            var ll = letterObjectView.gameObject.AddComponent <TakeMeHomeLL>();

            ll.Initialize(plane.transform.position.y, letterObjectView, GetComponent <TakeMeHomeGame> ().spawnTube.transform.position);

            /*/var livingLetter = letterObjectView.gameObject.AddComponent<FastCrowdLivingLetter>();
             * //livingLetter.crowd = this;
             *
             * letterObjectView.gameObject.AddComponent<FastCrowdDraggableLetter>();*/
            letterObjectView.gameObject.AddComponent <Rigidbody>().isKinematic = true;

            foreach (var collider in letterObjectView.gameObject.GetComponentsInChildren <Collider>())
            {
                collider.isTrigger = true;
            }

            var characterController = letterObjectView.gameObject.AddComponent <CharacterController>();

            characterController.height = 6;
            characterController.center = Vector3.up * 3;
            characterController.radius = 1.5f;



            _letter = (ll);

            return(ll);
        }
Beispiel #11
0
        public EggLivingLetter(Transform parent, GameObject letterObjectViewPrefab, GameObject shadowPrefab, ILivingLetterData livingLetterData, Vector3 startPosition, Vector3 shadowPosition, Vector3 endPosition, float delay, Action endCallback)
        {
            livingLetter = UnityEngine.Object.Instantiate(letterObjectViewPrefab).GetComponent <LivingLetterController>();

            livingLetter.transform.SetParent(parent);
            livingLetter.transform.localPosition = startPosition;


            if (livingLetterData.DataType == LivingLetterDataType.Letter)
            {
                ((LL_LetterData)livingLetterData).ForceShowAccent = true;
            }
            livingLetter.Init(livingLetterData);


            livingLetter.transform.localScale *= startScale;
            livingLetter.gameObject.SetActive(false);

            if (EggConfiguration.Instance.Variation == EggVariation.Image)
            {
                livingLetter.TransformIntoImage();
            }

            shadowTransform = UnityEngine.Object.Instantiate(shadowPrefab).transform;
            shadowTransform.SetParent(parent);
            shadowLocalPosition           = shadowPosition;
            shadowTransform.localPosition = shadowLocalPosition;
            shadowTransform.localScale   *= 0.7f;
            shadowTransform.gameObject.SetActive(false);

            this.startPosition = startPosition;
            this.endPosition   = endPosition;

            this.delay = delay;

            this.endCallback = endCallback;

            JumpToEnd();
        }
Beispiel #12
0
        public EggRunLetter(GameObject letterObjectPrefab, GameObject shadowPrefab, ILivingLetterData letterData, Transform parent, Vector3 leftOutPosition, Vector3 rightOutPosition)
        {
            outPositions[0] = leftOutPosition;
            outPositions[1] = rightOutPosition;

            letterObject = UnityEngine.Object.Instantiate(letterObjectPrefab).GetComponent <LivingLetterController>();
            letterObject.transform.SetParent(parent);
            letterObject.Init(letterData);

            currentOutPosition = UnityEngine.Random.Range(0, 2);

            lerpPositionValue = currentOutPosition;

            letterObject.transform.position = outPositions[currentOutPosition];

            shadowTransform = UnityEngine.Object.Instantiate(shadowPrefab).transform;
            shadowTransform.SetParent(letterObject.transform);
            shadowTransform.localPosition = Vector3.zero;
            shadowTransform.localScale   *= 0.7f;

            letterObject.Poof();
        }
Beispiel #13
0
 public void SetData(ILivingLetterData _data)
 {
     letterData = _data;
     letterObjectView.Init(letterData);
 }
Beispiel #14
0
        private IEnumerator Flee_Coroutine()
        {
            yield return(new WaitForSeconds(0.25f));

            finishedRound = true;
            isFleeing     = true;

            List <Vector3> fleePathPoints = new List <Vector3>();

            var cameraPosition = Camera.main.transform.position;

            var frustumHeight = GetFrustumHeightAtDistance(FLEE_PATH_ENDPOINT_DISTANCE_FROM_CAMERA);
            var frustumWidth  = GetFrustumWidth(frustumHeight);

            Vector3 endPoint = new Vector3(cameraPosition.x + (frustumWidth / 2) * FLEE_PATH_ENDPOINT_X_ANCHOR,
                                           cameraPosition.y - FLEE_PATH_ENDPOINT_DISTANCE_FROM_CAMERA,
                                           cameraPosition.z + (frustumHeight / 2) * FLEE_PATH_ENDPOINT_Z_ANCHOR);

            Vector3 midPoint = transform.position + endPoint;

            midPoint *= 0.5f;

            frustumHeight = GetFrustumHeightAtDistance(cameraPosition.y - midPoint.y);
            frustumWidth  = GetFrustumWidth(frustumHeight);

            midPoint = new Vector3(cameraPosition.x + (frustumWidth / 2) * FLEE_PATH_MIDPOINT_X_ANCHOR,
                                   midPoint.y,
                                   cameraPosition.z + (frustumHeight / 2) * FLEE_PATH_MIDPOINT_Z_ANCHOR);


            fleePathPoints.Add(transform.position);
            fleePathPoints.Add(midPoint);
            fleePathPoints.Add(endPoint);

            LL.Init(MazeGame.instance.currentLL);

            var fleePathPointsArray = fleePathPoints.ToArray();

            transform.DOKill();

            transform.DOLookAt(fleePathPointsArray[1], 0.33f, AxisConstraint.None, Vector3.forward);

            transform.DOPath(fleePathPointsArray, FLEE_PATH_DURATION, PathType.Linear).OnWaypointChange((int index) => {
                if (index < fleePathPoints.Count - 1)
                {
                    transform.DOLookAt(fleePathPointsArray[index + 1], 0.33f, AxisConstraint.None, Vector3.forward);
                }
            }).OnComplete(() => {
                //wait then show cracks:
                StartCoroutine(waitAndPerformCallback(3.5f, () => {
                    MazeGame.instance.showAllCracks();
                    donotHandleBorderCollision = true;
                    characterIsMoving          = false;
                    transform.DOKill(false);

                    rocket.GetComponent <SphereCollider>().enabled = true;

                    var rocketRigidBody         = rocket.GetComponent <Rigidbody>();
                    rocketRigidBody.isKinematic = true;

                    State = LLState.Ragdolling;

                    ragdoll.deleteOnRagdollHit = false;

                    MazeGame.instance.ColorCurrentLinesAsIncorrect();

                    var tickPosition = transform.position;
                    tickPosition.z  -= 1f;
                    tickPosition.x  -= 2f;
                    tickPosition.y  -= 3f;
                    Tutorial.TutorialUI.MarkNo(tickPosition, Tutorial.TutorialUI.MarkSize.Normal);
                    MazeConfiguration.Instance.Context.GetAudioManager().PlaySound(Sfx.KO);

                    if (!MazeGame.instance.isTutorialMode)
                    {
                        MazeConfiguration.Instance.Context.GetAudioManager().PlaySound(Sfx.Lose);
                    }
                },
                                                      () => {
                    MazeGame.instance.lostCurrentLetter();
                }));
            });
        }
 void Start()
 {
     LL.Init(AppManager.I.Teacher.GetAllTestLetterDataLL().GetRandom());
     LL.SetState(LLAnimationStates.LL_rocketing);
     LL.Horraying = true;
 }
Beispiel #16
0
 public void SetQuestionText(ILivingLetterData livingLetterData)
 {
     letter.Init(livingLetterData);
 }
 public void SetLetter(LL_LetterData letterData)
 {
     this.letterData = letterData;
     letterObjectView.Init(letterData);
 }
 public void Init(ILivingLetterData _data)
 {
     letterData = _data;
     LLPrefab.Init(_data);
     ConfigureJointAnchors(_data);
 }
Beispiel #19
0
 /// <summary>
 /// refresh graphics text
 /// </summary>
 public void Refresh()
 {
     mLetter.Init(mLetterData);
 }