public void OnTriggerExit(Collider other) { if (!IsTypeAllowed(other)) { return; } CustomDispatcher component = other.gameObject.GetComponent <CustomDispatcher>(); if (!(component != null) || component.Dispatcher != Dispatcher) { return; } Prop componentInChildren = other.gameObject.GetComponentInChildren <Prop>(); if (componentInChildren != null) { InteractiveZonePropEventHandler component2 = componentInChildren.GetComponent <InteractiveZonePropEventHandler>(); if (component2 != null) { component2.UnEquipProp(); } } Dispatcher.DispatchEvent(new InteractionZoneEvents.InteractionZoneEvent(ZoneId, other, base.gameObject, ZoneInteractionStateChange.ExitZone)); UnityEngine.Object.Destroy(component); CollidersInZone.Remove(other); }
private EventDispatcher getDispatcher() { if (Dispatcher == null && prop != null && prop.PropUserRef != null) { CustomDispatcher component = prop.PropUserRef.GetComponent <CustomDispatcher>(); if (component != null) { Dispatcher = component.Dispatcher; } } return(Dispatcher); }
public void OnTriggerEnter(Collider other) { if (IsTypeAllowed(other)) { CustomDispatcher component = other.gameObject.GetComponent <CustomDispatcher>(); if (component == null && CollidersInZone.Add(other)) { component = other.gameObject.AddComponent <CustomDispatcher>(); component.Dispatcher = Dispatcher; Dispatcher.DispatchEvent(new InteractionZoneEvents.InteractionZoneEvent(ZoneId, other, base.gameObject, ZoneInteractionStateChange.EnterZone)); } } }
protected AbstractDispatchTestBase(Action <ICommandRegistry, CustomDispatcher> registrations) { var serviceCollection = new ServiceCollection(); var resolver = new CommandingDependencyResolverAdapter( (type, instance) => serviceCollection.AddSingleton(type, instance), (type, impl) => serviceCollection.AddTransient(type, impl), type => ServiceProvider.GetService(type) ); CommandingConfiguration = new CommandingRuntime(); var registry = CommandingConfiguration.AddCommanding(resolver); CommandTracer = new CommandTracer(); serviceCollection.AddSingleton(CommandTracer); CustomDispatcher = new CustomDispatcher(); CustomExecuter = new CustomExecuter(); registrations(registry, CustomDispatcher); ServiceProvider = serviceCollection.BuildServiceProvider(); Dispatcher = ServiceProvider.GetRequiredService <ICommandDispatcher>(); }