public void WrongMove(GameObject GO, ScannerLivingLetter livingLetter) { numberOfFailedMoves++; TutorialUI.MarkNo(GO.transform.position + Vector3.up * 2 + Vector3.right * 1.5f, TutorialUI.MarkSize.Normal); AudioManager.I.PlaySound(Sfx.KO); KeeperManager.I.PlayDialogue("Keeper_Bad_" + UnityEngine.Random.Range(1, 6)); game.LogAnswer(livingLetter.LLController.Data, false); game.CreatePoof(GO.transform.position, 2f, true); game.Context.GetOverlayWidget().SetLives(game.allowedFailedMoves - numberOfFailedMoves); if (game.tut.isTutRound) { GO.GetComponent <ScannerSuitcase>().Reset(); return; } GO.SetActive(false); if (numberOfFailedMoves >= game.allowedFailedMoves || ScannerConfiguration.Instance.Variation == ScannerVariation.MultipleWords) { game.StopAllCoroutines(); game.StartCoroutine(RoundLost()); } }
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.LLController.transform; return(target); } } if (i == 0) { Debug.Log("xxxx"); target = null; return(null); } return(currentLL.transform); }
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.LLController.OnJumpStart(); ll.LLController.OnJumpMaximumHeightReached(); ll.slidingTime = slideTime; yield return(new WaitForSeconds(0.45f)); ll.LLController.Poof(); ll.showLLMesh(false); yield return(new WaitForSeconds(1.55f)); rb.isKinematic = true; rb.useGravity = false; StartCoroutine(llReset(ll, slideTime)); }
void OnMouseUp() { if (game.disableInput || !isReady) { return; } if (overPlayermarker && lastDetectedLL && lastDetectedLL.status == ScannerLivingLetter.LLStatus.StandingOnBelt) { shadow.transform.localScale = Vector3.zero; ScannerLivingLetter LL = player.transform.parent.GetComponent <ScannerLivingLetter>(); if (isCorrectAnswer && LL.LLController.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); game.GetComponent <ScannerTutorial>().tutStep = 1; } else { onWrongDrop(gameObject, LL); } } else { Reset(false); } lastDetectedLL = null; isDragging = false; overPlayermarker = false; }
public void setupTutorial(int step = 0, ScannerLivingLetter targetLL = null) { if (!isTutRound) { return; } Debug.Log("Tutorial started"); if (targetLL) { currentLL = targetLL; } else { currentLL = game.scannerLL[0]; target = currentLL.transform; } tutStep = step; if (step <= 1) { source = scannerDevice; } else if (step == 2) { matchLLToSS(targetLL); } }
public void SetupLLs() { int LLs = 0; game.scannerLL.Clear(); if (ScannerConfiguration.Instance.Variation == ScannerVariation.OneWord) { LLs = 1; } else if (ScannerConfiguration.Instance.Variation == ScannerVariation.MultipleWords) { LLs = game.LLCount; } else { throw new ArgumentOutOfRangeException(); } Debug.Log("[Scanner] LLs: " + LLs); for (int i = 0; i < LLs; i++) { ScannerLivingLetter LL = GameObject.Instantiate(game.LLPrefab).GetComponent <ScannerLivingLetter>(); LL.facingCamera = game.facingCamera; LL.gameObject.SetActive(true); LL.onStartFallOff += OnLetterStartFallOff; LL.onFallOff += OnLetterFallOff; LL.onPassedMidPoint += OnLetterPassedMidPoint; LL.game = game; game.scannerLL.Add(LL); } }
public void PlayWord(float deltaTime, ScannerLivingLetter LL) { Debug.Log("Play word: " + deltaTime); IAudioSource wordSound = Context.GetAudioManager().PlayVocabularyData(LL.LLController.Data, true); //float scaledDelta = (maxPlaySpeed - minPlaySpeed) / (max - min) * (deltaTime - max) + maxPlaySpeed; wordSound.Pitch = Mathf.Clamp(scannerDevice.smoothedDraggingSpeed * 4f, minPlaySpeed, maxPlaySpeed); }
void OnTriggerStay(Collider other) { if (other.tag == "Player") { lastDetectedLL = other.transform.root.GetComponent <ScannerLivingLetter>(); overPlayermarker = true; player = other; } }
private void OnLetterPassedMidPoint(ScannerLivingLetter sender) { if (!game.trapDoor.GetBool("TrapDown") && !game.antura.GetComponent <ScannerAntura>().isInScene) { game.trapDoor.SetBool("TrapUp", false); game.trapDoor.SetBool("TrapDown", true); } // Decide if Antura will bark // Antura leaves // Trapdoor drops }
void OnTriggerStay(Collider other) { if ((other.tag == ScannerGame.TAG_SCAN_START || other.tag == ScannerGame.TAG_SCAN_END) && isDragging) { if (!willPronounce) { scanStartPos = transform.position; playTime = 0; willPronounce = true; if (LL) { LL.setColor(Color.white); } LL = other.transform.parent.GetComponent <ScannerLivingLetter>(); dataAudio = game.Context.GetAudioManager().PlayVocabularyData(LL.LLController.Data, true); LL.setColor(Color.green); if (game.tut.tutStep == 1) { game.tut.setupTutorial(2, LL); } } /*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; * * if(game.tut.tutStep == 1) * game.tut.setupTutorial(2, LL); * }*/ } if (other.gameObject.name.Equals("Antura") && isDragging) { game.antura.GetComponent <ScannerAntura>().beScared(); } }
void matchLLToSS(ScannerLivingLetter targetLL) { currentLL = targetLL; foreach (ScannerSuitcase sc in game.suitcases) { if (targetLL.LLController.Data.Id == sc.wordId) { currentSuitcases = sc; source = sc.transform; target = targetLL.transform; break; } } }
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.PlaySound(Sfx.LetterSad); StartCoroutine(throwLL(ll, calculateDelay())); } } }
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; } }
public void CorrectMove(GameObject GO, ScannerLivingLetter livingLetter) { TutorialUI.MarkYes(GO.transform.position + Vector3.up * 3 + Vector3.right, TutorialUI.MarkSize.Normal); AudioManager.I.PlaySound(Sfx.StampOK); KeeperManager.I.PlayDialogue("Keeper_Good_" + UnityEngine.Random.Range(1, 12)); game.LogAnswer(livingLetter.LLController.Data, true); game.tut.playTut = false; livingLetter.RoundWon(); if (game.scannerLL.All(ll => ll.gotSuitcase) || game.tut.isTutRound) { if (ScannerConfiguration.Instance.Variation == ScannerVariation.OneWord || game.tut.isTutRound) { game.StartCoroutine(PoofOthers(game.suitcases)); } foreach (ScannerLivingLetter LL in game.scannerLL) { LL.gotSuitcase = false; } game.StartCoroutine(RoundWon()); } }
void resetTut(GameObject g, ScannerLivingLetter sll) { llCounter++; setupTutorial(); }
private void OnLetterFallOff(ScannerLivingLetter sender) { // game.StartCoroutine(co_CheckNewRound()); game.StartCoroutine(RoundLost()); }
private void OnLetterStartFallOff(ScannerLivingLetter sender) { // AudioManager.I.PlaySound(Sfx.Lose); // game.StartCoroutine(PoofOthers(game.suitcases)); // game.StartCoroutine(RoundLost()); }
void OnLetterFlying(ScannerLivingLetter sender) { moveBack = true; StopAllCoroutines(); StartCoroutine(co_Reset()); }