public void onCorrectMove(SickLettersDraggableDD dd) { if (goodCommentCounter == 3 || !lastMoveIsCorrect) { KeeperManager.I.PlayDialogue("Keeper_Good_" + UnityEngine.Random.Range(1, 13)); goodCommentCounter = 0; } scale.counter++; goodCommentCounter++; lastMoveIsCorrect = true; dd.deattached = true; if (!dd.touchedVase) { dd.boxCollider.isTrigger = false; } TutorialUI.MarkYes(scale.transform.position - Vector3.forward * 2 + Vector3.up, TutorialUI.MarkSize.Big); Context.GetAudioManager().PlaySound(Sfx.OK); Context.GetLogManager().OnAnswered(LLPrefab.letterView.Data, true); if (scale.counter > maxReachedCounter) { Context.GetOverlayWidget().SetStarsThresholds(STARS_1_THRESHOLD, STARS_2_THRESHOLD, STARS_3_THRESHOLD); CurrentScore = scale.counter; } dd.isInVase = true; dd.gameObject.tag = "Finish"; checkForNextRound(); }
void OnTriggerExit(Collider coll) { if (coll.tag == "Player") { dd = coll.gameObject.GetComponent <SickLettersDraggableDD>(); if (!dd || dd.isInVase) { return; } if (dd.isDragging) { dd.touchedVase = false; } } }
void checkDDsOverlapping(Collider coll) { SickLettersDraggableDD dd = coll.gameObject.GetComponent <SickLettersDraggableDD>(); if (dd && dd.checkDDCollision && !dd.isCorrect && !dd.isDragging && dd.transform.parent) { foreach (Transform t in game.safeDropZones) { if (t.childCount == 0) { dd.transform.parent = t; dd.transform.localPosition = Vector3.zero; break; } } } }
public void scatterWrongDDs(bool useLetter = true) { foundWrongDDCount = 0; thisLLWrongDDs.Clear(); Vector2[] emptyZones; if (useLetter) { var sideData = AppManager.I.AssetManager.GetSideLetterData(letterView.Data.Id); emptyZones = sideData.EmptyZones; } else { // Fallback emptyZones = new[] { new Vector2(-0.055f, 1.054f) }; } for (int iZone = 0; iZone < emptyZones.Length; iZone++) { if (foundWrongDDCount >= game.Draggables.Length) { continue; } if (game.Draggables[foundWrongDDCount].IsDiacritic && foundWrongDDCount >= game.numberOfWrongDDs) { foundWrongDDCount++; continue; } SickLettersDraggableDD newDragable = game.createNewDragable(game.Draggables[foundWrongDDCount].gameObject); newDragable.transform.parent = game.DropZonesGO.transform; newDragable.transform.localPosition = new Vector3(emptyZones[iZone].x, 0, emptyZones[iZone].y); newDragable.transform.localEulerAngles = new Vector3(0, -90, 0); newDragable.checkDDCollision = true; thisLLWrongDDs.Add(newDragable); game.allWrongDDs.Add(newDragable); foundWrongDDCount++; } if (foundWrongDDCount == 0) { scatterWrongDDs(false); } }
public void onCorrectMove(SickLettersDraggableDD dd) { //AudioManager.I.PlayDialog("Keeper_Good_" + UnityEngine.Random.Range(1, 13)); if (goodCommentCounter == 3 || !lastMoveIsCorrect) { AudioManager.I.PlayDialogue("Keeper_Good_" + UnityEngine.Random.Range(1, 13)); goodCommentCounter = 0; } scale.counter++; correctMoveSequence++; goodCommentCounter++; lastMoveIsCorrect = true; dd.deattached = true; if (!dd.touchedVase) { dd.boxCollider.isTrigger = false; } TutorialUI.MarkYes(scale.transform.position - Vector3.forward * 2 + Vector3.up, TutorialUI.MarkSize.Big); //game.Context.GetCheckmarkWidget().Show(true); Context.GetAudioManager().PlaySound(Sfx.OK); Context.GetLogManager().OnAnswered(LLPrefab.letterView.Data, true); //int prevStarNum = game.currentStars; if (scale.counter > maxWieght) { Context.GetOverlayWidget().SetStarsThresholds((targetScale / 3), (targetScale * 2 / 3), targetScale); currentStars = (scale.counter / 2) / (targetScale / 6); Context.GetOverlayWidget().SetStarsScore(scale.counter /*game.currentStars*/); } dd.isInVase = true; dd.gameObject.tag = "Finish"; checkForNextRound(); }
public void scatterDDs(bool isSimpleLetter = true) { i = 0; string letter = "x"; thisLLWrongDDs.Clear(); if (isSimpleLetter) { letter = game.LLPrefab.dotlessLetter.text; } foreach (SickLettersDropZone dz in game.DropZones) { if (dz.letters.Contains(letter)) { if (i < game.Draggables.Length) { if (game.Draggables[i].diacritic != Diacritic.None && i >= game.numerOfWringDDs /*!game.with7arakat*/) { i++; continue; } SickLettersDraggableDD newDragable = game.createNewDragable(game.Draggables[i].gameObject); newDragable.transform.parent = dz.transform; newDragable.transform.localPosition = Vector3.zero; newDragable.transform.localEulerAngles = new Vector3(0, -90, 0); //newDragable.setInitPos(newDragable.transform.localPosition); newDragable.checkDDCollision = true; //newDragable.isAttached = true; thisLLWrongDDs.Add(newDragable); game.allWrongDDs.Add(newDragable); i++; } } } if (i == 0) { scatterDDs(false); } }
/*void OnTriggerStay(Collider coll) * { * checkEntry(coll); * }*/ private void checkEntry(Collider coll) { if (coll.tag == "Player") { dd = coll.gameObject.GetComponent <SickLettersDraggableDD>(); if (dd.isDragging) { dd.touchedVase = true; } if (!dd || dd.isDragging || dd.isInVase || dd.collidedWithVase) { return; } dd.collidedWithVase = true; addNewDDToVas(dd); } }
public void addNewDDToVas(SickLettersDraggableDD dd) { if (dd.isCorrect) { game.Poof(dd.transform); dd.resetCorrectDD(); game.onWrongMove(dd.isCorrect); StartCoroutine(onDroppingCorrectDD()); } else if (!dd.isInVase) { //dd.deattached = true; game.onCorrectMove(dd); //game.checkForNextRound(); } StartCoroutine(bounceScale()); }