public static void RemoveEventReceiver(BuilderStateType builderState) { if(sharedInstance == null) { Debug.LogError("BuilderSetupHandler not properly setup!"); return; } if(sharedInstance.stateTable == null) { Debug.LogError("State table not properly initialized!"); return; } EventBroadcaster.Instance.RemoveObserver(sharedInstance.stateTable[builderState]); }
/// <summary> /// Convenience function that attaches an event receiver via event broadcaster system by specifying /// the corresponding build state. Does not accept parameters. /// </summary> /// <param name="builderState">Builder state.</param> /// <param name="action">Action.</param> public static void RegisterEventReceiver(BuilderStateType builderState, System.Action action) { if(sharedInstance == null) { Debug.LogError("BuilderSetupHandler not properly setup!"); return; } if(sharedInstance.stateTable == null) { Debug.LogError("State table not properly initialized!"); return; } EventBroadcaster.Instance.AddObserver(sharedInstance.stateTable[builderState], action); }
/// <summary> /// Convenience function that attaches an event receiver via event broadcaster system by specifying /// the corresponding build state. Does not accept parameters. /// </summary> /// <param name="builderState">Builder state.</param> /// <param name="action">Action.</param> public static void RegisterEventReceiver(BuilderStateType builderState, System.Action action) { if (sharedInstance == null) { Debug.LogError("BuilderSetupHandler not properly setup!"); return; } if (sharedInstance.stateTable == null) { Debug.LogError("State table not properly initialized!"); return; } EventBroadcaster.Instance.AddObserver(sharedInstance.stateTable[builderState], action); }
public static void RemoveEventReceiver(BuilderStateType builderState) { if (sharedInstance == null) { Debug.LogError("BuilderSetupHandler not properly setup!"); return; } if (sharedInstance.stateTable == null) { Debug.LogError("State table not properly initialized!"); return; } EventBroadcaster.Instance.RemoveObserver(sharedInstance.stateTable[builderState]); }
public void SetState(BuilderStateType stateType) { this.currentState = stateType; EventBroadcaster.Instance.PostEvent(this.stateTable[this.currentState]); }
void Awake() { sharedInstance = this; this.currentState = BuilderStateType.NONE; this.InitializeStateTable(); }