private IEnumerator TriggerQuestComplete() { print("completing quest"); QuestComplete = true; yield return(new WaitWhile(() => References.playerScript.IsPossessing)); References.playerScript.LockMovement(); References.playerScript.lastMovementDir = transform.position - References.playerScript.transform.position; PossessableObject questPossessable = questItem.GetComponent <PossessableObject>(); LevelSceneManager.instance.TriggerDialogue(_questItemReturnedConvo); LevelSceneManager.instance._UIScript.QuestChecklist.GetComponent <UIQuestManager>().CheckOffQuest(this); yield return(new WaitWhile(() => DialogueManager.playingConversation)); References.playerScript.UnlockMovement(); questPossessable.ReturnPossessableToGhost(); grave.RaiseHappiness(100); Instantiate(QuestCompleteSFX); if (_questItemPrefab.tag == "FishermanGhostQuestItem") { LevelSceneManager.catGhostQuestItem.SetActive(true); print("spawning fish"); } }
private void PlaceDownOffering() { if (_gravesCollider.GravesInCollider.Count > 0) { List <Gravestone> nearGraves = _gravesCollider.GravesInCollider; float Distance = Vector2.Distance(playerRB.position, nearGraves[0].transform.position); Gravestone closestGrave = nearGraves[0]; foreach (Gravestone grave in nearGraves) { if (!grave.currentOffering) { if (Vector2.Distance(playerRB.position, grave.transform.position) < Distance) { Distance = Vector2.Distance(playerRB.position, grave.transform.position); closestGrave = grave; } } } if (!closestGrave.currentOffering) { Offering offering = collectedOfferings[0]; //take the first offering off our list offering.gameObject.SetActive(true); //reenable this offering offering.transform.position = closestGrave.OfferingPos.transform.position; //and move it our graves offering position _placeDownSound.Play(); closestGrave.RaiseHappiness(offering.HealAmount); //heal our grave offering.FadeAway(closestGrave); //slowly fade it away collectedOfferings.RemoveAt(0); //remove the offering from our list Events.current.PlaceDownOffering(offering); LevelSceneManager.instance.timeSinceLastMiscPrompt = 0f; } } }
//EVENT STUFF private IEnumerator StartTutorial() { print("starting tutorial"); _isPlayingTutorial = true; // Setup of Scene for the tutorial // UI _UIScript.StartTutorial(); Unpause(); SpawnPlayer(); SetPlayerReferencesInScene(); References.playerScript.HidePlayer(); References.playerScript.LockMovement(); References.playerScript.playerAnimator.SetBool("HatOn", false); //lock all our abilities References.playerScript._screamLocked = References.playerScript._dashLocked = References.playerScript._possessionLocked = References.playerScript._depossessionLocked = References.playerScript._interactionLocked = true; DayNightLighting.freezeDayNight = true; SetupDayAndNight(); DisableGraveghostFadein(); // First Scene; Zooms In and caretaker talks to you StartCoroutine(_UIScript.FadeFromBlack()); yield return(new WaitForSeconds(2f)); _cameraScript.Zoom(30, 0.75f); yield return(new WaitForSeconds(1f)); StartCoroutine(_tutorialGhost.FadeIn()); yield return(new WaitForSeconds(1f)); //Scene #1: The Wakeup TriggerDialogue(TutorialConversations[tutorialIndex]); tutorialIndex++; yield return(new WaitWhile(() => DialogueManager.playingConversation)); _UIScript.HidePlayerUI(); References.playerScript.ShowPlayer(); // Scene #2; Player looks around and then talks to the ghost yield return(new WaitForSeconds(1.5f)); //player looks around... References.playerScript.lastMovementDir = References.playerScript.movement = new Vector2(-1, -1); yield return(new WaitForSeconds(0.5f)); References.playerScript.lastMovementDir = References.playerScript.movement = new Vector2(0, -1); yield return(new WaitForSeconds(0.5f)); References.playerScript.lastMovementDir = References.playerScript.movement = new Vector2(1, -1); yield return(new WaitForSeconds(1f)); References.playerScript.lastMovementDir = References.playerScript.movement = new Vector2(0, -1); yield return(new WaitForSeconds(0.1f)); References.playerScript.lastMovementDir = References.playerScript.movement = new Vector2(-1, 0); yield return(new WaitForSeconds(0.1f)); References.playerScript.lastMovementDir = References.playerScript.movement = new Vector2(-1, 1); yield return(new WaitForSeconds(0.5f)); TriggerDialogue(TutorialConversations[tutorialIndex]); tutorialIndex++; yield return(new WaitWhile(() => DialogueManager.playingConversation)); //Scene #3: Move our ghosts to the new location, then give the backstory of our ghost _tutorialGhost.MoveToNextPos(); yield return(new WaitForSeconds(1.5f)); References.playerScript.MoveToNextPos(); yield return(new WaitWhile(() => !References.playerScript.reachedEndOfPath)); yield return(new WaitWhile(() => !_tutorialGhost.reachedEndOfPath)); References.playerScript.lastMovementDir = References.playerScript.movement = new Vector2(-1, 0); //player looks at tutorial ghost yield return(new WaitForSeconds(0.5f)); TriggerDialogue(TutorialConversations[tutorialIndex]); tutorialIndex++; yield return(new WaitWhile(() => DialogueManager.playingConversation)); yield return(new WaitForSeconds(1f)); // Scene #4: Tutorial ghost moves to our right to investigate, asks us to follow after _tutorialGhost.MoveToNextPos(); while (!_tutorialGhost.reachedEndOfPath) { References.playerScript.lastMovementDir = References.playerScript.movement = (_tutorialGhost.transform.position - References.playerScript.transform.position); yield return(new WaitForFixedUpdate()); } TriggerDialogue(TutorialConversations[tutorialIndex]); tutorialIndex++; yield return(new WaitWhile(() => DialogueManager.playingConversation)); _tutorialGhost.MoveToNextPos(); yield return(new WaitForSeconds(1f)); References.playerScript.MoveToNextPos(); yield return(new WaitWhile(() => !References.playerScript.reachedEndOfPath)); yield return(new WaitWhile(() => !_tutorialGhost.reachedEndOfPath)); //player look at ghost References.playerScript.lastMovementDir = References.playerScript.movement = new Vector2(1, 1); yield return(new WaitForSeconds(0.2f)); // Scene #5: Talk with Grandma and Grandpa about Incense, and the graverobbers _grandma.DistanceFromPlayerToActivate = 100; _grandpa.DistanceFromPlayerToActivate = 100; TriggerDialogue(TutorialConversations[tutorialIndex]); tutorialIndex++; yield return(new WaitWhile(() => DialogueManager.playingConversation)); _grandma.DistanceFromPlayerToActivate = 0; _grandpa.DistanceFromPlayerToActivate = 0; // Scene #6: Move Player and tutorial to the kitty, and fight the robber! _kitty.DistanceFromPlayerToActivate = 100; _kittyGrave.InitMaxHealth(100000); //make kitty grave unkillable for tutorial purposes _kittyGrave.TakeDamage(40000); //set at half health GraveRobber Robber = SpawnTutorialRobber(tutorialRobberPositions[0]); Robber.InitRobber(allGraves, _graveRobberEscapePos); _tutorialGhost.MoveToNextPos(); yield return(new WaitForSeconds(1f)); References.playerScript.MoveToNextPos(); yield return(new WaitWhile(() => !References.playerScript.reachedEndOfPath)); yield return(new WaitWhile(() => !_tutorialGhost.reachedEndOfPath)); TriggerDialogue(TutorialConversations[tutorialIndex]); tutorialIndex++; yield return(new WaitWhile(() => DialogueManager.playingConversation)); StartCoroutine(_UIScript.FadeInPrompts()); _UIScript.PromptScream(); Robber.fearLevel.InitMaxFear(40); References.playerScript._screamLocked = false; _UIScript.ScreamMeterHidden = false; _UIScript.portraitHidden = false; _UIScript.ShowPlayerUI(); yield return(new WaitWhile(() => !Robber.isTerrified)); StartCoroutine(_UIScript.FadeOutPrompts()); float timer = 0f; while (timer < 1.5f) { timer += Time.deltaTime; References.playerScript.lastMovementDir = References.playerScript.movement = (Robber.transform.position - References.playerScript.transform.position); yield return(new WaitForFixedUpdate()); } References.playerScript.lastMovementDir = References.playerScript.movement = new Vector2(0, 1); yield return(new WaitForSeconds(0.5f)); // Scene #7: Player defeated Robber, unlock possession, fix Cats Grave Destroy(Robber.gameObject); TriggerDialogue(TutorialConversations[tutorialIndex]); tutorialIndex++; yield return(new WaitWhile(() => DialogueManager.playingConversation)); References.playerScript.MoveToNextPos(); yield return(new WaitWhile(() => !References.playerScript.reachedEndOfPath)); _UIScript.PromptPossess(); StartCoroutine(_UIScript.FadeInPrompts()); References.playerScript._possessionLocked = false; _UIScript.ShowPlayerUI(); yield return(new WaitWhile(() => !References.playerScript.IsPossessing)); StartCoroutine(_UIScript.FadeOutPrompts()); yield return(new WaitForSeconds(2.5f)); _kittyGrave.InitMaxHealth(100f); _kittyGrave.RestoreGrave(1f); //plays the healing sound yield return(new WaitForSeconds(0.5f)); // Scene #8: Player is prompted to leave grave TriggerDialogue(TutorialConversations[tutorialIndex]); tutorialIndex++; yield return(new WaitWhile(() => DialogueManager.playingConversation)); StartCoroutine(_UIScript.FadeInPrompts()); _UIScript.PromptDepossess(); References.playerScript._depossessionLocked = false; yield return(new WaitWhile(() => References.playerScript.IsPossessing)); StartCoroutine(_UIScript.FadeOutPrompts()); References.playerScript.LockMovement(); References.playerScript._depossessionLocked = true; References.playerScript._possessionLocked = true; yield return(new WaitForSeconds(1f)); References.playerScript.lastMovementDir = References.playerScript.movement = new Vector2(-1, 0); print("left"); //Scene #9: Player has depossessed, but theres a new robber on our left TriggerDialogue(TutorialConversations[tutorialIndex]); tutorialIndex++; yield return(new WaitWhile(() => DialogueManager.playingConversation)); // Scene #10: Robber is stealing loot, cool ghost talks _coolGhost.DistanceFromPlayerToActivate = 100f; _coolGrave.InitMaxHealth(100000); _coolGrave.TakeDamage(50000); //get to last stage of damage GameObject coolGhostGraveItem = _coolGhost._graveItem; _coolGhost._graveItem = _coolGhost._questItemPrefab; Robber = SpawnTutorialRobber(tutorialRobberPositions[1]); Robber.InitRobber(allGraves, _graveRobberEscapePos); _tutorialGhost.MoveToNextPos(); yield return(new WaitForSeconds(1f)); References.playerScript.MoveToNextPos(); yield return(new WaitWhile(() => !References.playerScript.reachedEndOfPath)); yield return(new WaitWhile(() => !_tutorialGhost.reachedEndOfPath)); yield return(new WaitForSeconds(0.25f)); _kitty.DistanceFromPlayerToActivate = 0f; TriggerDialogue(TutorialConversations[tutorialIndex]); tutorialIndex++; yield return(new WaitWhile(() => DialogueManager.playingConversation)); yield return(new WaitForSeconds(1f)); _coolGrave.TakeDamage(100000); yield return(new WaitForSeconds(0.85f)); Robber.lockMovement = true; //Scene #11: Ghost tells you to dash TriggerDialogue(TutorialConversations[tutorialIndex]); tutorialIndex++; yield return(new WaitWhile(() => DialogueManager.playingConversation)); Robber.fearLevel.InitMaxFear(20); StartCoroutine(_UIScript.FadeInPrompts()); _UIScript.PromptDash(); References.playerScript.lastMovementDir = References.playerScript.movement = new Vector2(-1, 0); References.playerScript._dashLocked = false; _UIScript.DashMeterHidden = false; _UIScript.ShowPlayerUI(); yield return(new WaitWhile(() => !Robber.isTerrified)); StartCoroutine(_UIScript.FadeOutPrompts()); Robber.lockMovement = false; References.playerScript._dashLocked = true; References.playerScript.lastMovementDir = References.playerScript.movement = new Vector2(1, 1); //Scene #12: Move to cool ghost, Cool Ghost compliments you asks you to pick up his shades yield return(new WaitWhile(() => References.playerScript.TimeSinceLastDash < 1f)); _tutorialGhost.MoveToNextPos(); yield return(new WaitForSeconds(0.1f)); References.playerScript.MoveToNextPos(); yield return(new WaitWhile(() => !References.playerScript.reachedEndOfPath)); yield return(new WaitWhile(() => !_tutorialGhost.reachedEndOfPath)); yield return(new WaitForSeconds(0.25f)); TriggerDialogue(TutorialConversations[tutorialIndex]); tutorialIndex++; yield return(new WaitWhile(() => DialogueManager.playingConversation)); yield return(new WaitForSeconds(0.25f)); //Scene #13: Move to bag, press interact and carry shades over _tutorialGhost.MoveToNextPos(); yield return(new WaitForSeconds(0.1f)); References.playerScript.MoveToNextPos(); References.playerScript.lastMovementDir = References.playerScript.movement = new Vector2(0, 1); yield return(new WaitWhile(() => !References.playerScript.reachedEndOfPath)); yield return(new WaitWhile(() => !_tutorialGhost.reachedEndOfPath)); yield return(new WaitForSeconds(0.25f)); StartCoroutine(_UIScript.FadeInPrompts()); _UIScript.PromptPossessShades(); References.playerScript._possessionLocked = false; yield return(new WaitWhile(() => !References.playerScript.IsPossessing)); StartCoroutine(_UIScript.FadeOutPrompts()); References.playerScript.possessedObject.lockMovement = true; GameObject sunglasses = References.playerScript.possessedObject.gameObject; print(sunglasses); TriggerDialogue(TutorialConversations[tutorialIndex]); tutorialIndex++; yield return(new WaitWhile(() => DialogueManager.playingConversation)); References.playerScript.possessedObject.lockMovement = false; //Scene #14: Move and place down Sunglasses StartCoroutine(_UIScript.FadeInPrompts()); _UIScript.PromptMoveWithArrowKeys(); yield return(new WaitWhile(() => Vector2.Distance(References.playerScript.possessedObject.transform.position, _coolGrave.transform.position) > 0.5f)); StartCoroutine(_UIScript.FadeOutPrompts()); References.playerScript.possessedObject.lockMovement = true; TriggerDialogue(TutorialConversations[tutorialIndex]); tutorialIndex++; yield return(new WaitWhile(() => DialogueManager.playingConversation)); yield return(new WaitForSeconds(0.2f)); StartCoroutine(_UIScript.FadeInPrompts()); _UIScript.PromptDepossessShades(); References.playerScript._depossessionLocked = false; yield return(new WaitWhile(() => References.playerScript.IsPossessing)); StartCoroutine(_UIScript.FadeOutPrompts()); References.playerScript.LockMovement(); yield return(new WaitForSeconds(0.2f)); References.playerScript._depossessionLocked = true; References.playerScript._possessionLocked = true; References.playerScript.lastMovementDir = References.playerScript.movement = new Vector2(0, 1); //Scene #15: Cool ghost thanks you, move to the next location to talk more about possession TriggerDialogue(TutorialConversations[tutorialIndex]); tutorialIndex++; yield return(new WaitWhile(() => DialogueManager.playingConversation)); _coolGhost.TryCompleteQuest(sunglasses); _UIScript.QuestChecklist.GetComponent <UIQuestManager>().CheckOffQuest(_coolGhost); _UIScript.QuestChecklist.SetActive(true); _UIScript.QuestsHidden = true; _coolGhost.lootStolen = false; Instantiate(_allOfferingTypes[3], tutorialOffering.position, tutorialOffering.rotation); _tutorialGhost.MoveToNextPos(); yield return(new WaitForSeconds(0.1f)); References.playerScript.MoveToNextPos(); yield return(new WaitWhile(() => !References.playerScript.reachedEndOfPath)); yield return(new WaitWhile(() => !_tutorialGhost.reachedEndOfPath)); References.playerScript.lastMovementDir = References.playerScript.movement = new Vector2(1, 0); yield return(new WaitForSeconds(0.25f)); //Scene #16: Talk about possession and offerings, pick up offering TriggerDialogue(TutorialConversations[tutorialIndex]); tutorialIndex++; yield return(new WaitWhile(() => DialogueManager.playingConversation)); References.playerScript.MoveToNextPos(); yield return(new WaitWhile(() => !References.playerScript.reachedEndOfPath)); References.playerScript.lastMovementDir = References.playerScript.movement = new Vector2(0, 1); References.playerScript._interactionLocked = false; StartCoroutine(_UIScript.FadeInPrompts()); _UIScript.PromptPickUp(); yield return(new WaitWhile(() => References.playerScript.collectedOfferings.Count == 0)); StartCoroutine(_UIScript.FadeOutPrompts()); _UIScript.InventoryHidden = false; _UIScript.ShowPlayerUI(); _coolGrave.InitHappiness(250f); _coolGrave.RaiseHappiness(35f); _coolGhost.happiness.gameObject.SetActive(true); //Scene #17: Bring offering to cool ghost TriggerDialogue(TutorialConversations[tutorialIndex]); tutorialIndex++; yield return(new WaitWhile(() => DialogueManager.playingConversation)); _tutorialGhost.MoveToNextPos(); yield return(new WaitForSeconds(0.1f)); References.playerScript.MoveToNextPos(); yield return(new WaitWhile(() => !References.playerScript.reachedEndOfPath)); yield return(new WaitWhile(() => !_tutorialGhost.reachedEndOfPath)); References.playerScript.lastMovementDir = References.playerScript.movement = new Vector2(1, 0); yield return(new WaitForSeconds(0.25f)); StartCoroutine(_UIScript.FadeInPrompts()); _UIScript.PromptPlaceDown(); //Scene #18: Cool ghost thanks you for the meal yield return(new WaitWhile(() => References.playerScript.collectedOfferings.Count != 0)); StartCoroutine(_UIScript.FadeOutPrompts()); TriggerDialogue(TutorialConversations[tutorialIndex]); tutorialIndex++; yield return(new WaitWhile(() => DialogueManager.playingConversation)); yield return(new WaitForSeconds(0.25f)); //Scene #19: Move to Final Location, tutorial is effectively done, tutorial ghost moves up a bit to get emotional _tutorialGhost.MoveToNextPos(); yield return(new WaitForSeconds(0.1f)); References.playerScript.MoveToNextPos(); yield return(new WaitWhile(() => !References.playerScript.reachedEndOfPath)); yield return(new WaitWhile(() => !_tutorialGhost.reachedEndOfPath)); yield return(new WaitForSeconds(0.25f)); _coolGhost.DistanceFromPlayerToActivate = 0f; TriggerDialogue(TutorialConversations[tutorialIndex]); tutorialIndex++; yield return(new WaitWhile(() => DialogueManager.playingConversation)); yield return(new WaitForSeconds(0.25f)); _tutorialGhost.MoveToNextPos(); yield return(new WaitWhile(() => !_tutorialGhost.reachedEndOfPath)); References.playerScript.lastMovementDir = References.playerScript.movement = new Vector2(1, 1); // FINAL SCENE! Play final dialogue, relinquish the lock on the player and then finally start the game! TriggerDialogue(TutorialConversations[tutorialIndex]); tutorialIndex++; yield return(new WaitWhile(() => DialogueManager.playingConversation)); _tutorialGhost.animator.SetBool("HatOn", false); References.playerScript.playerAnimator.SetBool("HatOn", true); StartCoroutine(_tutorialGhost.FadeOut()); yield return(new WaitForSeconds(1f)); _isPlayingTutorial = false; _cameraScript.Zoom(15, 0.2f); References.playerScript.UnlockMovement(); //unlock all our abilities References.playerScript._screamLocked = References.playerScript._dashLocked = References.playerScript._possessionLocked = References.playerScript._depossessionLocked = References.playerScript._interactionLocked = false; DayNightLighting.freezeDayNight = false; // Reset UI _UIScript.proximityButtonsEnabled = true; _UIScript.portraitHidden = false; _UIScript.DashMeterHidden = false; _UIScript.ScreamMeterHidden = false; _UIScript.SundialHidden = false; _UIScript.TimeDisplayHidden = false; _UIScript.InventoryHidden = false; _UIScript.ShowPlayerUI(); // Reset graves to default values again EnableGraveghostFadein(); _kittyGrave.InitMaxHealth(100f); _coolGrave.InitMaxHealth(100f); _kittyGrave.InitHappiness(250f); _kittyGrave.GetComponent <PossessableObject>().isRestoring = false; _coolGrave.GetComponent <PossessableObject>().isRestoring = false; _coolGhost.timesGraveWasDestroyed = 0; _kitty.timesGraveWasDestroyed = 0; _UIScript.TutorialPromptsBackground.color = _UIScript.PromptText.color = new Color(1, 1, 1, 0); _coolGhost._graveItem = null; SpawnQuestItems(); SpawnOfferings(); HasTalkedToGhost = false; GameStart.Play(); }