private IEnumerator Zap(GrayCircle circ) { StartCoroutine(LoseLife()); StartCoroutine(Audio.Zap()); yield return(Transition.TransitionColor(circ.gameObject, 0.4f, Color.white, Color.red)); StartCoroutine(Transition.TransitionColor(circ.gameObject, 0.3f, Color.red, Color.white)); yield return(null); }
public void IncorrectCircleClicked(GrayCircle circ) { if (TransitioningBackgrounds) { return; } Logger.Instance.LogAction("Incorrect Circle", stepsCompleted.ToString(), circ.name); Debug.Log("Incorrect circle clicked"); }
// Revise this function and move to vine controller private IEnumerator VineFakeout(GrayCircle circ) { // yield return Transition.Rotate(SupergirlArm.transform, swaptime / 2, 0f, 160f); SupergirlVineCurled.SetActive(false); SupergirlAnimator.SetTrigger("noteClicked"); // Trigger vine throwing animation yield return(vineController.ThrowVine(ThrowingVine, SupergirlVineCurled.transform.position, circ.transform.position, swaptime / 2)); StartCoroutine(Zap(circ)); yield return(vineController.RetractVine(ThrowingVine, SupergirlVineCurled.transform.position, circ.transform.position, swaptime / 5)); SupergirlVineCurled.SetActive(true); yield return(Transition.Rotate(SupergirlArm.transform, swaptime / 2, 160f, 0f)); }
public void CorrectCircleClicked(GrayCircle circ) { if (TransitioningBackgrounds) { return; } Logger.Instance.LogAction("Correct Circle", stepsCompleted.ToString(), ""); if (++stepsCompleted == LevelSteps.Length) { StartCoroutine(LevelComplete(circ)); } else { StartCoroutine(LoadNextStep(circ)); } }
public void CorrectCircleClicked(GrayCircle circ) { if (TransitioningBackgrounds) { return; } Logger.Instance.LogAction("Correct Circle", stepsCompleted.ToString(), ""); if (++stepsCompleted == LevelSteps.Length) { StartCoroutine(LevelComplete(circ)); } else { StartCoroutine(LoadNextStep(circ)); } }
public void CorrectCircleClicked(GrayCircle circ) { if (TransitioningBackgrounds) { Debug.Log("Failed click"); return; } Debug.Log("Successful click " + CurrentStep.name + " and transitionbackgrounds is " + TransitioningBackgrounds); TransitioningBackgrounds = true; // Logger.Instance.LogAction("Correct Circle", stepsCompleted.ToString(), ""); if (++stepsCompleted == LevelSteps.Length) { StartCoroutine(LevelComplete(circ)); } else { StartCoroutine(LoadNextStep(circ)); } }
private GameObject[] LoadGrayNotes(GameObject stepObj, AddressingStep step, out GrayCircle correct) { Bounds bounds = step.NotesBox.bounds; float yMin = bounds.center.y - bounds.extents.y; float yMax = bounds.center.y + bounds.extents.y; float xMin = bounds.center.x - bounds.extents.x; float xMax = bounds.center.x + bounds.extents.x; correct = null; GameObject[] circles = new GameObject[step.Notes.Length - 1]; int j = 0; for (int i = 0; i < step.Notes.Length; i++) { Vector3 position = new Vector3(xMin + (xMax - xMin) * (((float)i) / step.Notes.Length), yMin + (yMax - yMin) * GetYByAddress(step.Notes[i]), -2); GameObject gray = (GameObject)Instantiate(GrayCirclePrefab, position, Quaternion.identity); gray.name = step.Notes[i]; gray.transform.parent = stepObj.transform; gray.name = step.Notes[i]; GrayCircle circ = gray.GetComponent <GrayCircle>(); bool isCorrect = (i == step.CorrectIndex); if (isCorrect) { circ.IsCorrect = true; correct = circ; } else { circ.IsCorrect = false; circles[j++] = gray; } circ.controller = this; } return(circles); }
public void IncorrectCircleClicked(GrayCircle circ) { if (TransitioningBackgrounds) { return; } // Logger.Instance.LogAction("Incorrect Circle", stepsCompleted.ToString(), circ.name); // Debating on where to put this code // TransitioningBackgrounds = true; if (LivesCount == 0) { SuperdogDialogue.SetActive(false); GameOver.SetActive(true); } else { TransitioningBackgrounds = false; } // // StartCoroutine(VineFakeout(circ)); }
private IEnumerator LoadNextStep(GrayCircle circ) { Debug.Log("loading next step" + " and transitionbackgrounds is " + TransitioningBackgrounds); hintController.HideHint(); HintDisplayed = false; bool isLastLevel; GameObject[] nextIncorrect; AddressingStep OldStep = CurrentStep; GameObject OldStepObject = CurrentStepObject; GameObject NewStepObject = Instantiate(LevelSteps[stepsCompleted]); AddressingStep NextStep = NewStepObject.GetComponent <AddressingStep>(); GrayCircle NextCorrect = null; isLastLevel = NextStep.Notes.Length == 0; NewStepObject.transform.parent = this.transform; TransitioningBackgrounds = true; Debug.Log("transitioningBackgrounds set to True" + " and transitionbackgrounds is " + TransitioningBackgrounds); if (OldStep.TutorialObject != null) { Destroy(OldStep.TutorialObject); Debug.Log("Destroyed OldStep.TutorialObject" + " and transitionbackgrounds is " + TransitioningBackgrounds); } //PlaceInBox(NewStepObject); float currentNoteBoxHeight = OldStep.NotesBox.bounds.size.y; float newNoteBoxHeight = NextStep.NotesBox.bounds.size.y; NewStepObject.transform.localScale *= (currentNoteBoxHeight / newNoteBoxHeight); Vector3 positionDeltaY = Vector3.up * (OldStep.NotesBox.bounds.center.y - NextStep.NotesBox.bounds.center.y); NewStepObject.transform.position += positionDeltaY; if (!isLastLevel) { nextIncorrect = LoadGrayNotes(NewStepObject, NextStep, out NextCorrect); } else { nextIncorrect = new GameObject[0]; } Vector3 offset = Vector3.Scale(Vector3.right, circ.gameObject.transform.position - NextStep.FirstNoteCollider.bounds.center); Vector3 finalOffset = Vector3.Scale(Vector3.right, circ.gameObject.transform.position - OldStep.FirstNoteCollider.bounds.center); NewStepObject.transform.position += offset; OldStepObject.transform.position += Vector3.forward * 0.2f; SuperdogDialogue.SetActive(false); Debug.Log("Placed new object in box, deactivated Superdog" + " and transitionbackgrounds is " + TransitioningBackgrounds); // Stage 1: "Swap" StartCoroutine(Transition.FadeOut(IncorrectCircles, swaptime, Transition.FinishType.Destroy)); StartCoroutine(Transition.FadeOut(circ.gameObject, swaptime)); if (NextStep.TutorialAlpha != null) { NextStep.TutorialAlpha.SetActive(false); } StartCoroutine(Transition.FadeIn(NewStepObject, swaptime, exclude: NextStep.TutorialAlpha)); //yield return Transition.Rotate(SupergirlArm.transform, swaptime / 2, 0f, 160f); Debug.Log("Finished swap" + " and transitionbackgrounds is " + TransitioningBackgrounds); // Stage 1.5: Throw vine SupergirlVineCurled.SetActive(false); SupergirlAnimator.SetTrigger("noteClicked"); // Trigger vine throwing animation yield return(vineController.ThrowVine(ThrowingVine, SupergirlVineCurled.transform.position, circ.transform.position, swaptime / 2)); Audio.PlayNote(CurrentStep.Notes[CurrentStep.CorrectIndex]); Debug.Log("Vine thrown" + " and transitionbackgrounds is " + TransitioningBackgrounds); if (circ != null) { Destroy(circ.gameObject); } Debug.Log("circle destroyed" + " and transitionbackgrounds is " + TransitioningBackgrounds); CurrentStep = NextStep; CurrentStepObject = NewStepObject; IncorrectCircles = nextIncorrect; CorrectCircle = NextCorrect; Debug.Log("Switched all the variables" + " and transitionbackgrounds is " + TransitioningBackgrounds); if (!isLastLevel) { StartCoroutine(TransitionBackgrounds()); StartCoroutine(Transition.Translate(CurrentStepObject.transform, CurrentStepObject.transform.position - finalOffset, flytime)); StartCoroutine(superdogController.FlySuperdog(flytime)); } else { StartCoroutine(Transition.Translate(CurrentStepObject.transform, Vector3.Scale(CurrentStepObject.transform.position, new Vector3(0f, 1f, 1f)), flytime)); } StartCoroutine(Transition.FadeOut(OldStepObject, flytime)); StartCoroutine(Transition.Translate(OldStepObject.transform, OldStepObject.transform.position - finalOffset, flytime)); SupergirlVineCurled.SetActive(true); StartCoroutine(Transition.Rotate(SupergirlArm.transform, flytime, 160f, 0f)); yield return(new WaitForSeconds(flytime + 0.2f)); Debug.Log("Supergirl has flown" + " and transitionbackgrounds is " + TransitioningBackgrounds); TransitioningBackgrounds = false; Debug.Log("transitioningBackgrounds set to False" + " and transitionbackgrounds is " + TransitioningBackgrounds); if (!isLastLevel) { SuperdogDialogue.SetActive(true); dialogueController.updateDialogue(TutorialIndex++); Debug.Log("Superdog reactivated" + " and transitionbackgrounds is " + TransitioningBackgrounds); } Destroy(OldStepObject); Debug.Log("Old step object destroyed" + " and transitionbackgrounds is " + TransitioningBackgrounds); if (NextStep.TutorialAlpha != null) { NextStep.TutorialAlpha.SetActive(true); } if (isLastLevel) { yield return(CompleteLevel()); } else if (LevelSelection.IsAutoplaying()) { CorrectCircleClicked(CorrectCircle); Debug.Log("Called CorrectCircleClicked" + " and transitionbackgrounds is " + TransitioningBackgrounds); } }
private IEnumerator LevelComplete(GrayCircle circ) { Debug.Log("TODO"); yield return(null); }
private IEnumerator LoadNextStep(GrayCircle circ) { bool isLastLevel; GameObject[] nextIncorrect; AddressingStep OldStep = CurrentStep; GameObject OldStepObject = CurrentStepObject; GameObject NewStepObject = Instantiate(LevelSteps[stepsCompleted]); AddressingStep NextStep = NewStepObject.GetComponent <AddressingStep>(); GrayCircle NextCorrect = null; isLastLevel = NextStep.Notes.Length == 0; NewStepObject.transform.parent = this.transform; TransitioningBackgrounds = true; //PlaceInBox(NewStepObject); float currentNoteBoxHeight = OldStep.NotesBox.bounds.size.y; float newNoteBoxHeight = NextStep.NotesBox.bounds.size.y; NewStepObject.transform.localScale *= (currentNoteBoxHeight / newNoteBoxHeight); Vector3 positionDeltaY = Vector3.up * (OldStep.NotesBox.bounds.center.y - NextStep.NotesBox.bounds.center.y); NewStepObject.transform.position += positionDeltaY; if (!isLastLevel) { nextIncorrect = LoadGrayNotes(NewStepObject, NextStep, out NextCorrect); } else { nextIncorrect = new GameObject[0]; } Vector3 offset = Vector3.Scale(Vector3.right, circ.gameObject.transform.position - NextStep.FirstNoteCollider.bounds.center); Vector3 finalOffset = Vector3.Scale(Vector3.right, circ.gameObject.transform.position - OldStep.FirstNoteCollider.bounds.center); NewStepObject.transform.position += offset; OldStepObject.transform.position += Vector3.forward * 0.2f; SuperdogDialogue.SetActive(false); if (!isLastLevel) { SuperdogText.text = "Swing to the " + NextStep.Notes[NextStep.CorrectIndex] + "!"; } // Stage 1: "Swap" StartCoroutine(Transition.FadeOut(IncorrectCircles, swaptime, Transition.FinishType.Destroy)); StartCoroutine(Transition.FadeOut(circ.gameObject, swaptime, false)); StartCoroutine(Transition.FadeIn(NewStepObject, swaptime, false)); yield return(Transition.Rotate(SupergirlArm.transform, swaptime / 2, 0f, 160f)); // Stage 1.5: Throw vine SupergirlVineCurled.SetActive(false); yield return(ThrowVine(SupergirlVineCurled.transform.position, circ.transform.position, swaptime / 2)); Destroy(circ.gameObject); CurrentStep = NextStep; CurrentStepObject = NewStepObject; IncorrectCircles = nextIncorrect; CorrectCircle = NextCorrect; if (!isLastLevel) { StartCoroutine(TransitionBackgrounds()); StartCoroutine(Transition.Translate(CurrentStepObject.transform, CurrentStepObject.transform.position - finalOffset, flytime)); StartCoroutine(FlySuperdog(flytime)); } else { StartCoroutine(Transition.Translate(CurrentStepObject.transform, Vector3.Scale(CurrentStepObject.transform.position, new Vector3(0f, 1f, 1f)), flytime)); StartCoroutine(FlySuperdogAway(flytime)); } StartCoroutine(Transition.FadeOut(OldStepObject, flytime, false)); StartCoroutine(Transition.Translate(OldStepObject.transform, OldStepObject.transform.position - finalOffset, flytime)); SupergirlVineCurled.SetActive(true); StartCoroutine(Transition.Rotate(SupergirlArm.transform, flytime, 160f, 0f)); yield return(new WaitForSeconds(flytime + 0.2f)); TransitioningBackgrounds = false; if (!isLastLevel) { SuperdogDialogue.SetActive(true); } Destroy(OldStepObject); if (isLastLevel) { yield return(CompleteLevel()); } else if (LevelSelection.IsAutoplaying()) { CorrectCircleClicked(CorrectCircle); } }
void Start() { touch = GameObject.Find("Touch").GetComponent <Touch>(); circle = GameObject.Find("WhiteCircle").GetComponent <GrayCircle>(); arrow = GameObject.Find("Arrow").GetComponent <Arrow>(); }
public void IncorrectCircleClicked(GrayCircle circ) { if (TransitioningBackgrounds) { return; } Logger.Instance.LogAction("Incorrect Circle", stepsCompleted.ToString(), circ.name); Debug.Log("Incorrect circle clicked"); }
private IEnumerator LoadNextStep(GrayCircle circ) { bool isLastLevel; GameObject[] nextIncorrect; AddressingStep OldStep = CurrentStep; GameObject OldStepObject = CurrentStepObject; GameObject NewStepObject = Instantiate(LevelSteps[stepsCompleted]); AddressingStep NextStep = NewStepObject.GetComponent<AddressingStep>(); GrayCircle NextCorrect = null; isLastLevel = NextStep.Notes.Length == 0; NewStepObject.transform.parent = this.transform; TransitioningBackgrounds = true; //PlaceInBox(NewStepObject); float currentNoteBoxHeight = OldStep.NotesBox.bounds.size.y; float newNoteBoxHeight = NextStep.NotesBox.bounds.size.y; NewStepObject.transform.localScale *= (currentNoteBoxHeight / newNoteBoxHeight); Vector3 positionDeltaY = Vector3.up * (OldStep.NotesBox.bounds.center.y - NextStep.NotesBox.bounds.center.y); NewStepObject.transform.position += positionDeltaY; if (!isLastLevel) { nextIncorrect = LoadGrayNotes(NewStepObject, NextStep, out NextCorrect); } else { nextIncorrect = new GameObject[0]; } Vector3 offset = Vector3.Scale(Vector3.right, circ.gameObject.transform.position - NextStep.FirstNoteCollider.bounds.center); Vector3 finalOffset = Vector3.Scale(Vector3.right, circ.gameObject.transform.position - OldStep.FirstNoteCollider.bounds.center); NewStepObject.transform.position += offset; OldStepObject.transform.position += Vector3.forward * 0.2f; SuperdogDialogue.SetActive(false); if (!isLastLevel) { SuperdogText.text = "Swing to the " + NextStep.Notes[NextStep.CorrectIndex] + "!"; } // Stage 1: "Swap" StartCoroutine(Transition.FadeOut(IncorrectCircles, swaptime, Transition.FinishType.Destroy)); StartCoroutine(Transition.FadeOut(circ.gameObject, swaptime, false)); StartCoroutine(Transition.FadeIn(NewStepObject, swaptime, false)); yield return Transition.Rotate(SupergirlArm.transform, swaptime / 2, 0f, 160f); // Stage 1.5: Throw vine SupergirlVineCurled.SetActive(false); yield return ThrowVine(SupergirlVineCurled.transform.position, circ.transform.position, swaptime / 2); Destroy(circ.gameObject); CurrentStep = NextStep; CurrentStepObject = NewStepObject; IncorrectCircles = nextIncorrect; CorrectCircle = NextCorrect; if (!isLastLevel) { StartCoroutine(TransitionBackgrounds()); StartCoroutine(Transition.Translate(CurrentStepObject.transform, CurrentStepObject.transform.position - finalOffset, flytime)); StartCoroutine(FlySuperdog(flytime)); } else { StartCoroutine(Transition.Translate(CurrentStepObject.transform, Vector3.Scale(CurrentStepObject.transform.position, new Vector3(0f, 1f, 1f)), flytime)); StartCoroutine(FlySuperdogAway(flytime)); } StartCoroutine(Transition.FadeOut(OldStepObject, flytime, false)); StartCoroutine(Transition.Translate(OldStepObject.transform, OldStepObject.transform.position - finalOffset, flytime)); SupergirlVineCurled.SetActive(true); StartCoroutine(Transition.Rotate(SupergirlArm.transform, flytime, 160f, 0f)); yield return new WaitForSeconds(flytime + 0.2f); TransitioningBackgrounds = false; if (!isLastLevel) { SuperdogDialogue.SetActive(true); } Destroy(OldStepObject); if (isLastLevel) { yield return CompleteLevel(); } else if (LevelSelection.IsAutoplaying()) { CorrectCircleClicked(CorrectCircle); } }
private GameObject[] LoadGrayNotes(GameObject stepObj, AddressingStep step, out GrayCircle correct) { Bounds bounds = step.NotesBox.bounds; float yMin = bounds.center.y - bounds.extents.y; float yMax = bounds.center.y + bounds.extents.y; float xMin = bounds.center.x - bounds.extents.x; float xMax = bounds.center.x + bounds.extents.x; correct = null; GameObject[] circles = new GameObject[step.Notes.Length - 1]; int j = 0; for (int i = 0; i < step.Notes.Length; i++) { Vector3 position = new Vector3(xMin + (xMax - xMin) * (((float)i) / step.Notes.Length), yMin + (yMax - yMin) * GetYByAddress(step.Notes[i]), -2); GameObject gray = (GameObject)Instantiate(GrayCirclePrefab, position, Quaternion.identity); gray.name = step.Notes[i]; gray.transform.parent = stepObj.transform; gray.name = step.Notes[i]; GrayCircle circ = gray.GetComponent<GrayCircle>(); bool isCorrect = (i == step.CorrectIndex); if (isCorrect) { circ.IsCorrect = true; correct = circ; } else { circ.IsCorrect = false; circles[j++] = gray; } circ.controller = this; } return circles; }
private IEnumerator LevelComplete(GrayCircle circ) { Debug.Log("TODO"); yield return null; }