// public function when player triggers objective tag public void OnObjectiveTriggered(GameObject obj) { Debug.Log("OBJ TRIGGERED: " + objectiveCount + " LEN: " + Objectives.Length); if (objectiveCount <= Objectives.Length && Objectives[objectiveCount - 1].objectiveObject == obj) { particles.ObjectivePlay(); _sinceLastObj = 0; // Pass the corresponding description to dialogmng dataPost.ObjectiveCompleted("Objective: " + Objectives[objectiveCount - 1].objectiveObject.name); //_phoneUI.SetNotifyMessage(Objectives[objectiveCount].ObjectiveDes); if (objectiveCount < Objectives.Length) { foreach (Message m in Objectives[objectiveCount].messages) { _phoneUI.SetNotifyMessage(m); } //ObjMarkerSingle.PlayAtObjective(Objectives[objectiveCount].ObjectiveObj); Objectives[objectiveCount - 1].objectiveObject.SetActive(false); if (Objectives[objectiveCount].objectiveObject != null) { Objectives[objectiveCount].objectiveObject.SetActive(true); } // // Debug.Log("OBJECT NAME: " + obj.name); if (Objectives[objectiveCount - 1].objectiveObject.GetComponent <ObjectiveStateChange>()) { Debug.Log("FIRED STATE CHANGE"); Objectives[objectiveCount - 1].objectiveObject.GetComponent <ObjectiveStateChange>().OnTriggered.Invoke(); } objectiveCount++; } else if (objectiveCount == Objectives.Length) { //endLevel = true; Objectives[objectiveCount - 1].objectiveObject.SetActive(false); Debug.Log("Ending Level"); Debug.Log("OBJECT NAME: " + obj.name); //Objectives[objectiveCount - 1].objectiveObject.SetActive(false); if (obj.GetComponent <ObjectiveStateChange>()) { obj.GetComponent <ObjectiveStateChange>().FireEvent(); } //GetComponent<GameController>().AdvanceLevel(); // this.GetComponent<BackgroundSoundController>().EndOfLevel(); GetComponent <ArrowIndicator>().SetHideArrow(); StartCoroutine(WaitForEnd()); } Debug.Log("OTHER: " + obj.name); } }