예제 #1
0
        protected virtual LetterObjectView SpawnLetter()
        {
            // Spawn!
            LetterObjectView letterObjectView = Instantiate(livingLetterPrefab);

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

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

            letterObjectView.transform.position = newPosition;
            letterObjectView.transform.rotation = Quaternion.Euler(0, UnityEngine.Random.value * 360, 0);
            //letterObjectView.Init(toAdd.Dequeue());
            letterObjectView.Init(AppManager.I.Teacher.GetAllTestLetterDataLL().GetRandomElement());

            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;
            letterObjectView.gameObject.AddComponent <LetterCharacterController>();

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

            livingLetter.factory = this;

            var pos = letterObjectView.transform.position;

            pos.y = 10;
            letterObjectView.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(letterObjectView.Data, result);
                }
            };

            return(letterObjectView);
        }
예제 #2
0
        public void DetailLetter(LetterInfo info)
        {
            DetailPanel.SetActive(true);
            Debug.Log("Detail Letter :" + info.data.Id + " [" + info.data.GetAvailablePositions() + "]");
            AudioManager.I.PlayLetter(info.data.Id);
            MoreInfoPanel.SetActive(true);
            ArabicText.text = "";
            ScoreText.text  = "Score: " + info.score;

            var isolatedChar = info.data.GetCharFixedForDisplay(LetterPosition.Isolated);

            LL_Isolated.Init(new LL_LetterData(info.data));
            LL_Isolated.Label.text = isolatedChar;

            var InitialChar = info.data.GetCharFixedForDisplay(LetterPosition.Initial);

            if (InitialChar != "")
            {
                LL_Initial.gameObject.SetActive(true);
                LL_Initial.Init(new LL_LetterData(info.data));
                LL_Initial.Label.text = InitialChar;
            }
            else
            {
                LL_Initial.gameObject.SetActive(false);
            }

            var MedialChar = info.data.GetCharFixedForDisplay(LetterPosition.Medial);

            if (MedialChar != "")
            {
                LL_Medial.gameObject.SetActive(true);
                LL_Medial.Init(new LL_LetterData(info.data));
                LL_Medial.Label.text = MedialChar;
            }
            else
            {
                LL_Medial.gameObject.SetActive(false);
            }

            var FinalChar = info.data.GetCharFixedForDisplay(LetterPosition.Final);

            if (FinalChar != "")
            {
                LL_Final.gameObject.SetActive(true);
                LL_Final.Init(new LL_LetterData(info.data));
                LL_Final.Label.text = FinalChar;
            }
            else
            {
                LL_Final.gameObject.SetActive(false);
            }

            LetterTextIsolated.SetTextUnfiltered(isolatedChar);
            LetterTextInitial.SetTextUnfiltered(InitialChar);
            LetterTextMedial.SetTextUnfiltered(MedialChar);
            LetterTextFinal.SetTextUnfiltered(FinalChar);
        }
예제 #3
0
        public void DetailWord(WordInfo info)
        {
            DetailPanel.SetActive(true);
            Debug.Log("Detail Word :" + info.data.Id);
            AudioManager.I.PlayWord(info.data.Id);
            MoreInfoPanel.SetActive(false);
            ScoreText.text = "Score: " + info.score;

            var output = "";

            var splittedLetters = ArabicAlphabetHelper.SplitWordIntoLetters(info.data.Arabic);

            foreach (var letter in splittedLetters)
            {
                output += letter.GetChar() + " ";
            }
            output += "\n";
            output += info.data.Arabic;

            //output += "\n";

            //foreach (var letter in splittedLetters) {
            //    output += letter.GetChar();
            //}

            ArabicText.text = output;

            LL_Isolated.Init(new LL_WordData(info.data));
            LL_Initial.gameObject.SetActive(false);
            LL_Final.gameObject.SetActive(false);

            if (info.data.Drawing != "")
            {
                var drawingChar = AppManager.I.Teacher.wordHelper.GetWordDrawing(info.data);
                Drawing.text = drawingChar;
                //LL_Medial.gameObject.SetActive(true);
                LL_Medial.Init(new LL_ImageData(info.data));
                Debug.Log("Drawing: " + info.data.Drawing + " / " + ArabicAlphabetHelper.GetLetterFromUnicode(info.data.Drawing));
            }
            else
            {
                Drawing.text = "";
                LL_Medial.gameObject.SetActive(false);
            }
        }
 void Start()
 {
     LL.Init(AppManager.I.Teacher.GetAllTestLetterDataLL().GetRandomElement());
     LL.SetState(LLAnimationStates.LL_rocketing);
 }