public override void OnEditorRefresh() { GameObject innerTriggerColliderGameObject = gameObject.FindOrCreateChild("InnerTrigger").gameObject; innerTriggerColliderGameObject.layer = Globals.LayerNumTrigger; InnerTriggerCollider = innerTriggerColliderGameObject.GetOrAdd <BoxCollider> (); InnerTriggerCollider.isTrigger = true; State.InnerTrigger.CopyFrom(InnerTriggerCollider.transform); InnerTrigger = innerTriggerColliderGameObject.GetOrAdd <PassThroughTriggerPair> (); InnerTrigger.TriggerType = PassThroughTriggerType.Inner; GameObject outerTriggerColliderGameObject = gameObject.FindOrCreateChild("OuterTrigger").gameObject; outerTriggerColliderGameObject.layer = Globals.LayerNumTrigger; OuterTriggerCollider = outerTriggerColliderGameObject.GetOrAdd <BoxCollider> (); OuterTriggerCollider.isTrigger = true; State.OuterTrigger.CopyFrom(OuterTriggerCollider.transform); OuterTrigger = outerTriggerColliderGameObject.GetOrAdd <PassThroughTriggerPair> (); OuterTrigger.TriggerType = PassThroughTriggerType.Outer; //InnerTrigger.Sibling = OuterTrigger; //OuterTrigger.Sibling = InnerTrigger; //InnerTrigger.TargetObject = gameObject; //OuterTrigger.TargetObject = gameObject; /* * InnerTrigger.EnterFunctionName = "OnPassThroughTrigger"; * InnerTrigger.ExitFunctionName = "OnPassThroughTrigger"; * OuterTrigger.EnterFunctionName = "OnPassThroughTrigger"; * OuterTrigger.ExitFunctionName = "OnPassThroughTrigger"; */ ParentTrigger = gameObject.GetOrAdd <PassThroughTrigger> (); ParentTrigger.TargetObject = gameObject; ParentTrigger.OuterTrigger = OuterTrigger; ParentTrigger.InnerTrigger = InnerTrigger; ParentTrigger.PassThroughFunctionName = "OnPassThroughTrigger"; CrucialColliderGizmo ccgInner = InnerTriggerCollider.gameObject.GetOrAdd <CrucialColliderGizmo> (); CrucialColliderGizmo ccgOuter = OuterTriggerCollider.gameObject.GetOrAdd <CrucialColliderGizmo> (); ccgInner.fillColor = Colors.Alpha(Color.red, 0.25f); ccgOuter.fillColor = Colors.Alpha(Color.cyan, 0.25f); //there are a few things we can assume about this trigger State.Targets = WorldTriggerTarget.None; State.Behavior = AvailabilityBehavior.Max; State.NumTimesTriggered = 1; State.ColliderType = WIColliderType.None; //we make our own }
public override void OnInitialized() { GameObject innerTriggerColliderGameObject = gameObject.FindOrCreateChild("InnerTrigger").gameObject; innerTriggerColliderGameObject.layer = Globals.LayerNumTrigger; InnerTriggerCollider = innerTriggerColliderGameObject.GetOrAdd <BoxCollider> (); InnerTriggerCollider.isTrigger = true; State.InnerTrigger.ApplyTo(InnerTriggerCollider.transform, true); InnerTrigger = innerTriggerColliderGameObject.GetOrAdd <PassThroughTriggerPair> (); InnerTrigger.TriggerType = PassThroughTriggerType.Inner; GameObject outerTriggerColliderGameObject = gameObject.FindOrCreateChild("OuterTrigger").gameObject; outerTriggerColliderGameObject.layer = Globals.LayerNumTrigger; OuterTriggerCollider = outerTriggerColliderGameObject.GetOrAdd <BoxCollider> (); OuterTriggerCollider.isTrigger = true; State.OuterTrigger.ApplyTo(OuterTriggerCollider.transform, true); OuterTrigger = outerTriggerColliderGameObject.GetOrAdd <PassThroughTriggerPair> (); OuterTrigger.TriggerType = PassThroughTriggerType.Outer; //InnerTrigger.Sibling = OuterTrigger; //OuterTrigger.Sibling = InnerTrigger; //InnerTrigger.TargetObject = gameObject; //OuterTrigger.TargetObject = gameObject; ParentTrigger = gameObject.GetOrAdd <PassThroughTrigger> (); ParentTrigger.TargetObject = gameObject; ParentTrigger.OuterTrigger = OuterTrigger; ParentTrigger.InnerTrigger = InnerTrigger; ParentTrigger.PassThroughFunctionName = "OnPassThroughTrigger"; State.Behavior = AvailabilityBehavior.Always; State.Targets |= WorldTriggerTarget.Player; State.TimeOfDayRequirement = TimeOfDay.a_None; State.MissionRequirement = MissionRequireType.None; State.ObjectiveRequirement = MissionRequireType.None; State.QuestItemRequirement = string.Empty; /* * InnerTrigger.EnterFunctionName = "OnPassThroughTrigger"; * InnerTrigger.ExitFunctionName = "OnPassThroughTrigger"; * OuterTrigger.EnterFunctionName = "OnPassThroughTrigger"; * OuterTrigger.ExitFunctionName = "OnPassThroughTrigger"; */ }