/// <summary> /// Start the quest complete event, /// Display the stats board /// Save new stats to JSON /// </summary> private void Complete() { QuestEvents.QuestComplete(); complete = true; StatsManager.instance.DisplayStats(stats[0]); SaveObjectives(); }
/// <summary> /// Checks the distance of the player to the destination /// Updates completion accordingly /// </summary> /// <param name="radius">The radius of the wheel</param> protected virtual void LocationObject(Vector3 playerPos) { distanceToTarget = Vector3.Distance(playerPos, GetObjectivePosition()); if (CheckCompleted()) { UpdateCompleted(); } QuestEvents.ObjectiveAdvance(); }
private void Tick() { if (CheckCompleted()) { UpdateCompleted(); } //calls the event, this will make it so the visual UI degrees you are compared to the turtle will update QuestEvents.ObjectiveAdvance(); }
void Update() { //call the players location event every few frames ticks += 1; if (ticks > ticksBetweenUpdate) { ticks = 0; QuestEvents.LocationChange(transform.position); } }
protected override void LocationObject(Vector3 playerPos) { if (UpdatedCompletion) { return; } //set up turtles speech QuestEvents.UpdateTurtle(Companion.CompanionState.MoveToPosition, GetObjectivePosition(), turtle_speech); base.LocationObject(playerPos + Vector3.forward); }
/// <summary> /// Load the next scene /// </summary> public void NextScene() { if (string.IsNullOrEmpty(load_scene)) { Debug.LogWarning("Assign scene to load next."); return; } QuestEvents.LoadNewScene(); SceneManager.LoadScene(load_scene); }
void Update() { //used in quests to fire a ray to detect what the user is looking at if (enableRay) { if (Physics.Raycast(transform.position, transform.forward, out RaycastHit hit, 20, layerMask)) { QuestEvents.LookAt(hit); } } }
/// <summary> /// Clear quest data and advance to the next stage once the objective is complete. /// </summary> protected virtual void UpdateCompleted() { if (UpdatedCompletion) { return; } UpdatedCompletion = true; DisableQuestMarkers(); QuestSystem.instance.UpdateQuests(); AudioManager.instance.PlayObjectiveComplete(); QuestEvents.ObjectiveAdvance(); }
/// <summary> /// Checks if the picked up item is the correct item. /// Plays audio and updates objective accordingly /// </summary> /// <param name="slug">The slug of the picked up object</param> private void ItemTaken(string slug) { for (int i = 0; i < collectionItems.Length; i++) { if (collectionItems[i].CollectItem(slug)) { AudioManager.instance.PlayObjectiveComplete(); break; } } if (CheckCompleted()) { UpdateCompleted(); } QuestEvents.ObjectiveAdvance(); }
/// <summary> /// Passes the name of the collided object to an event. /// An objective can then use this to detect if the correct item has been picked up /// </summary> protected virtual void Process(Collider col) { string colname = StaticCalculations.ProcessObjectName(col.name); if (acceptedItemSlugs.Length == 0) { QuestEvents.ItemCollected(colname); } else { for (int i = 0; i < acceptedItemSlugs.Length; i++) { if (colname.Equals(acceptedItemSlugs[i])) { QuestEvents.ItemCollected(colname); AudioManager.instance.PlayObjectiveComplete(); break; } } } }
//update the quest event tick every frame private void Update() { QuestEvents.Tick(); }
protected override void UpdateCompleted() { base.UpdateCompleted(); QuestEvents.UpdateTurtle(Companion.CompanionState.LookAtPlayer, GetObjectivePosition(), ""); }
protected override void Tick() { base.Tick(); //updates the companions speech bubble QuestEvents.UpdateTurtle(Companion.CompanionState.LookAtPlayer, GetObjectivePosition(), turtle_speech); }