public override void Fire() { //Debug.Log("Fire called in DETO"); myO.WasInteracted(); if (dEvent != null) { dEvent.Fire(); } }
void EventListener(GameEvent e) { if (e.GetType() == typeof(GE_PreLoadLevel)) { OnPreLoadLevel(); if (myInd != null) { Destroy(myInd); } } else if (e.GetType() == typeof(GameObjectiveEvent)) { GameObjectiveEvent GOE = (GameObjectiveEvent)e; if (optional_precedingObjective != null) { if (GOE.GObjv.iD == optional_precedingObjective._myObjv.iD) { if (GOE.GObjv.status == Status_GameObjective.Completed || GOE.GObjv.status == Status_GameObjective.CleanedUp) { if (_myObjv.status == Status_GameObjective.Initialized) { _myObjv.status = Status_GameObjective.Active; } } } } if (optional_handoffObjective != null) { if (GOE.GObjv.iD == optional_handoffObjective._myObjv.iD) { if (GOE.GObjv.status == Status_GameObjective.Active) { if (_myObjv.status == Status_GameObjective.Active) { _myObjv.status = Status_GameObjective.Triggered; } } } } if (GOE.GObjv.iD == _myObjv.iD) { myStatus = GOE.GObjv.status; if (GOE.GObjv.status == Status_GameObjective.Created) { onCreated.Invoke(); } else if (GOE.GObjv.status == Status_GameObjective.Initialized) { onInitialized.Invoke(); } else if (GOE.GObjv.status == Status_GameObjective.Active) { myInd = (GameObject)Instantiate(Resources.Load("OLI"), transform.position, Quaternion.identity); if (GetComponent <Deeper_InteractableObject>() != null) { myInd.GetComponent <ObjectiveLocationIndicator>().AssignWho(GetComponent <Deeper_InteractableObject>().whoCanInteract); } if (GetComponent <Deeper_IlluminableObject>() != null) { GetComponent <Deeper_IlluminableObject>().AssignWho(GetComponent <Deeper_InteractableObject>().whoCanInteract); } myInd.transform.parent = transform; if (optional_dialogueEventOnActive != null) { //Debug.Log("In onActive with a dialogue"); optional_dialogueEventOnActive.Fire(); } if (AffectSubOnActive) { //Debug.Log("Changing sub status"); GameObject.Find("Sub").GetComponent <SubControlScript>().canMove = CanMoveNow; GameObject.Find("Sub").GetComponent <SubControlScript>().canGetOut = CanGetOutNow; } onActivated.Invoke(); } else if (GOE.GObjv.status == Status_GameObjective.Triggered) { //DialogueManager myDM = GameObject.Find("DialogueManager").GetComponent<DialogueManager>(); if (optional_dialogueEventOnTriggered != null) { optional_dialogueEventOnTriggered.Fire(); } if (AffectSubOnTrigger) { //Debug.Log("Changing sub status"); GameObject.Find("Sub").GetComponent <SubControlScript>().canMove = CanMoveNowT; GameObject.Find("Sub").GetComponent <SubControlScript>().canGetOut = CanGetOutNowT; } if (CheckPointSound) { EventManager.instance.Fire(new GE_SFX(SFX.CheckPoint)); } onTriggered.Invoke(); _myObjv.status = Status_GameObjective.Completed; } else if (GOE.GObjv.status == Status_GameObjective.Completed) { if (myInd != null) { Destroy(myInd); } if (levelToLoad != 999) { EventManager.instance.Fire(new GE_LoadLevelRequest(levelToLoad)); } onCompleted.Invoke(); _myObjv.status = Status_GameObjective.CleanedUp; } else if (GOE.GObjv.status == Status_GameObjective.CleanedUp) { onCleanedUp.Invoke(); } } } if (e.GetType() == typeof(GE_DiaToObjv)) { GE_DiaToObjv d = (GE_DiaToObjv)e; if (optional_DialogueToActivate != null) { if (d.DialogueLineSerial == optional_DialogueToActivate.gameObject.name) { if (_myObjv.status == Status_GameObjective.Initialized) { Debug.Log("Message received"); _myObjv.status = Status_GameObjective.Active; } } } } }