private void OnTriggerEnter(Collider other) { StaticStuff.FlowDebug(this.name + " OnTriggerEnter() other: " + other.name); ArticyReference colliderArtRef = other.gameObject.GetComponent <ArticyReference>(); if (colliderArtRef == null) { //Debug.LogWarning("null ArticyReference on the thing we collided with."); StaticStuff.FlowDebugWarning("null ArticyReference on the thing we collided with."); } else { //Debug.Log("we connected with something that has an ArticyRef. Now lets see if it's an NPC."); StaticStuff.FlowDebug("we connected with something that has an ArticyRef. Now lets see what it is."); Dialogue dialogue = colliderArtRef.reference.GetObject() as Dialogue; if (dialogue != null) { StaticStuff.FlowDebug("we have a dialogue, so set the FlowPlayer to start on it"); SceneRoot.SetFlowPlayerStartOn(dialogue); NavMeshAgent.SetDestination(this.transform.position); } else { StaticStuff.FlowDebugWarning("not sure what to do with this type yet: " + colliderArtRef.reference.GetObject().GetType()); } } }
// iFlowObject vs Branch // Branch.Target is an iFlowObjects protected override void DoOnBranchesUpdated(IList <Branch> aBranches) { //Debug.Log("**********DoOnBranchesUpdated()"); //Debug.Log("Num branches: " + aBranches.Count); StaticStuff.FlowDebug("**********DoOnBranchesUpdated()"); StaticStuff.FlowDebug("Num branches: " + aBranches.Count); List <Branch> validBranches = new List <Branch>(); CurBranches.Clear(); string s = ""; foreach (Branch b in aBranches) { base.PrintBranchInfo(b, "branch loop"); Dialogue_Fragment d = b.Target as Dialogue_Fragment; if (d != null) { s += "Branch " + b.BranchId + ": "; s += d.InputPins[0].Text.RawScript + "\n"; } //if (s != "") DebugText.text = s; CurBranches.Add(b); if (b.IsValid == true) { validBranches.Add(b); } } if (aBranches.Count == 1 && aBranches[0].IsValid && aBranches[0].Target.GetType().Equals(typeof(Hub))) { StaticStuff.FlowDebug("only one valid branch and it's a hub called: " + aBranches[0].DefaultDescription + " so Play() it"); NextBranch = aBranches[0]; base.PrintBranchInfo(NextBranch, "move to hub"); //inventorySystem.RemoveItem(heldItem); //inventorySystem.RemoveItem(thisRepresentedItem); } else { if (validBranches.Count == 1 && CurPauseObject.GetType().Equals(typeof(Hub))) { s = "1 valid branch on a hub pause object...check what it is: "; s += base.ReturnBranchInfo(validBranches[0], "checking 1 branch on hub"); StaticStuff.FlowDebug(s); if (validBranches[0].Target.GetType().Equals(typeof(OutputPin))) { StaticStuff.FlowDebug("only valid output is an OutputPin...which means that we're not linked to any other flow fragments so just sit tight and wait for something" + "like the player colliding with an NPC or something else to trigger the next StartOn"); } else { StaticStuff.FlowDebug("only valid output is something else that an OutputPin...so ROCK IT via Play(NextBranch)"); NextBranch = validBranches[0]; } } else { StaticStuff.FlowDebug("--------------------------NOT in a situation where we have 1 valid Hub branch, so find out what to do."); if (CurPauseObject.GetType().Equals(typeof(Dialogue_Fragment))) { StaticStuff.FlowDebug("We're on a dialogue fragment, so set up the dialogue via the CaptainsChairSceneRoot"); base.ShowDialogueFragment(CurPauseObject as Dialogue_Fragment, validBranches); } else { StaticStuff.FlowDebug("on something other than a dialogue fragment, so find out what to do"); if (validBranches.Count == 1 && CurPauseObject.GetType().Equals(typeof(Jump)) && validBranches[0].Target.GetType().Equals(typeof(MiniGameFragment))) { StaticStuff.FlowDebug("we have 1 valid branch that's a Jump to a MiniGame so go to that mini game"); base.GoToMiniGame(validBranches[0]); } else { StaticStuff.FlowDebugWarning("not a 1 valid brach that's a Jump to a MiniGame so figure out what to do"); } } } } StaticStuff.FlowDebug("************************************************************DoOnBranchesUpdated() END"); }