示例#1
0
        Transform getNewTarget()
        {
            int i = 0;

            foreach (ScannerLivingLetter ll in game.scannerLL)
            {
                if (ll.gotSuitcase == false)
                {
                    i++;
                    //Debug.LogWarning(ll.transform.position +" "+ll.transform+""+ ll.gotSuitcase);
                    currentLL = ll;
                    target    = currentLL.letterObjectView.transform;
                    return(target);
                }
            }

            if (i == 0)
            {
                Debug.Log("xxxx");
                target = null;
                return(null);
            }

            return(currentLL.transform);
        }
示例#2
0
        void OnTriggerEnter(Collider other)
        {
            if ((other.tag == ScannerGame.TAG_SCAN_START || other.tag == ScannerGame.TAG_SCAN_END) && isDragging)
            {
                if (timeDelta == 0 || lastTag == other.tag)
                {
                    timeDelta = Time.time;
                    lastTag   = other.tag;
                }
                else
                {
                    ScannerLivingLetter LL = other.transform.parent.GetComponent <ScannerLivingLetter>();
                    timeDelta = Time.time - timeDelta;
                    game.PlayWord(timeDelta, LL);
                    timeDelta = 0;
                    game.tut.setupTutorial(2, LL);
                }
            }
            //			else if (other.tag == ScannerGame.TAG_SCAN_END)
            //			{
            //
            //			}

            if (other.gameObject.name.Equals("Antura"))
            {
                ScannerAntura.SCARED_COUNTER++;
                //print(ScannerAntura.SCARED_COUNTER);
            }
        }
示例#3
0
        public void setupTutorial(int step = 1, ScannerLivingLetter targetLL = null)
        {
            if (!isTutRound)
            {
                return;
            }

            Debug.Log("Tutorial started");

            if (targetLL)
            {
                currentLL = targetLL;
            }
            else
            {
                currentLL = game.scannerLL[0];
                target    = currentLL.transform;
            }

            TUT_STEP = step;
            if (step == 1)
            {
                source = scannerDevice;
            }

            else if (step == 2)
            {
                matchLLToSS(targetLL);
            }
        }
        public void PlayWord(float deltaTime, ScannerLivingLetter LL)
        {
            Debug.Log("Play word: " + deltaTime);
            IAudioSource wordSound = Context.GetAudioManager().PlayLetterData(LL.letterObjectView.Data, true);

            wordSound.Pitch = Mathf.Abs(maxPlaySpeed - Mathf.Clamp(deltaTime, minPlaySpeed, maxPlaySpeed + minPlaySpeed));
        }
示例#5
0
        void OnMouseUp()
        {
            if (ScannerGame.disableInput || !isReady)
            {
                return;
            }

            if (overPlayermarker)
            {
                ScannerLivingLetter LL = player.transform.parent.GetComponent <ScannerLivingLetter>();
                if (isCorrectAnswer && LL.letterObjectView.Data.Id == wordId)
                {
                    LL.gotSuitcase          = true;
                    transform.parent        = player.transform;
                    transform.localPosition = new Vector3(5.5f, 1, -2);
                    onCorrectDrop(gameObject, LL);
                    transform.localScale = new Vector3(scale, scale, scale);
                    TutorialUI.Clear(true);
                    ScannerTutorial.TUT_STEP = 1;
                }
                else
                {
                    onWrongDrop(gameObject);
                }
            }
            else
            {
                Reset();
            }
            isDragging       = false;
            overPlayermarker = false;
        }
示例#6
0
 private void OnLetterPassedMidPoint(ScannerLivingLetter sender)
 {
     if (!game.trapDoor.GetBool("TrapDown") && !ScannerAntura.IS_IN_SCENE)
     {
         game.trapDoor.SetBool("TrapUp", false);
         game.trapDoor.SetBool("TrapDown", true);
     }
     // Decide if Antura will bark
     // Antura leaves
     // Trapdoor drops
 }
        IEnumerator llReset(ScannerLivingLetter ll, float slideTime)
        {
            //yield return new WaitForSeconds(delay);
            while (Time.time < slideTime)
            {
                yield return(null);
            }

            if (fallenLL.IndexOf(ll) >= 0 && ll.status == ScannerLivingLetter.LLStatus.None)
            {
                ll.Reset();
                ll.StartSliding();
                fallenLL[fallenLL.IndexOf(ll)] = null;
            }
        }
        void OnTriggerEnter(Collider coll)
        {
            ScannerLivingLetter ll = coll.transform.root.GetComponent <ScannerLivingLetter>();

            if (ll && !ll.gotSuitcase && ll.status == ScannerLivingLetter.LLStatus.StandingOnBelt)
            {
                if (!fallenLL.Contains(ll))
                {
                    ll.status = ScannerLivingLetter.LLStatus.None;
                    fallenLL.Add(ll);
                    AudioManager.I.PlaySfx(Sfx.LetterSad);
                    StartCoroutine(throwLL(ll, calculateDelay()));
                }
            }
        }
示例#9
0
        void matchLLToSS(ScannerLivingLetter targetLL)
        {
            currentLL = targetLL;

            foreach (ScannerSuitcase sc in game.suitcases)
            {
                if (targetLL.letterObjectView.Data.Id == sc.wordId)
                {
                    currentSuitcases = sc;
                    source           = sc.transform;
                    target           = targetLL.transform;
                    break;
                }
            }
        }
示例#10
0
        public void Initialize()
        {
            if (!initialized)
            {
                /*if (ScannerConfiguration.Instance.Variation == ScannerVariation.MultipleWords)
                 * {
                 *      numberOfRoundsPlayed = 0;
                 * }*/

                initialized = true;

                foreach (ScannerSuitcase ss in game.suitcases)
                {
                    ss.onCorrectDrop += CorrectMove;
                    ss.onWrongDrop   += WrongMove;
                }

                Debug.Log("[Scanner] Diffculty: " + ScannerConfiguration.Instance.Difficulty);

                int LLs = 0;

                if (ScannerConfiguration.Instance.Variation == ScannerVariation.OneWord)
                {
                    LLs = 1;
                }
                else if (ScannerConfiguration.Instance.Variation == ScannerVariation.MultipleWords)
                {
                    LLs = game.LLCount;
                }

                Debug.Log("[Scanner] LLs: " + LLs);


                for (int i = 0; i < LLs; i++)
                {
                    ScannerLivingLetter LL = GameObject.Instantiate(game.LLPrefab).GetComponent <ScannerLivingLetter>();
                    LL.facingCamera = ScannerConfiguration.Instance.facingCamera;
                    LL.gameObject.SetActive(true);
                    LL.onStartFallOff   += OnLetterStartFallOff;
                    LL.onFallOff        += OnLetterFallOff;
                    LL.onPassedMidPoint += OnLetterPassedMidPoint;
                    game.scannerLL.Add(LL);
                }

                StartRound();
            }
        }
示例#11
0
        public void CorrectMove(GameObject GO, ScannerLivingLetter livingLetter)
        {
            AudioManager.I.PlayDialog("Keeper_Good_" + UnityEngine.Random.Range(1, 12));
            livingLetter.RoundWon();
            if (game.scannerLL.All(ll => ll.gotSuitcase))
            {
                if (ScannerConfiguration.Instance.Variation == ScannerVariation.OneWord)
                {
                    game.StartCoroutine(PoofOthers(game.suitcases));
                }

                foreach (ScannerLivingLetter LL in game.scannerLL)
                {
                    LL.gotSuitcase = false;
                }
                game.StartCoroutine(RoundWon());
            }
        }
        IEnumerator throwLL(ScannerLivingLetter ll, float slideTime)
        {
            Rigidbody rb;

            rb             = ll.GetComponent <Rigidbody>();
            rb.isKinematic = false;
            rb.useGravity  = true;
            rb.AddForce(Vector3.forward * Random.Range(6, 10) + Vector3.up * Random.Range(12, 15), ForceMode.Impulse);
            ll.letterObjectView.OnJumpStart();
            ll.letterObjectView.OnJumpMaximumHeightReached();

            ll.slidingTime = slideTime;

            yield return(new WaitForSeconds(2));

            rb.isKinematic = true;
            rb.useGravity  = false;

            StartCoroutine(llReset(ll, slideTime));
        }
示例#13
0
 void OnLetterFlying(ScannerLivingLetter sender)
 {
     moveBack = true;
     StopAllCoroutines();
     StartCoroutine(co_Reset());
 }
示例#14
0
        private void OnLetterFallOff(ScannerLivingLetter sender)
        {
//			game.StartCoroutine(co_CheckNewRound());
            game.StartCoroutine(RoundLost());
        }
示例#15
0
        private void OnLetterStartFallOff(ScannerLivingLetter sender)
        {
//			AudioManager.I.PlaySfx(Sfx.Lose);
//			game.StartCoroutine(PoofOthers(game.suitcases));
//			game.StartCoroutine(RoundLost());
        }
示例#16
0
 void resetTut(GameObject g, ScannerLivingLetter sll)
 {
     llCounter++;
     setupTutorial(1);
 }