void SubscribeToEvents() { EventManager.Subscribe <GameFSMStates>(GameFSM.EVT_ON_CHANGE_GAME_STATE, (CurrentState) => { ToggleInGameUI(CurrentState == GameFSMStates.MAINMENU); }); EventManager.Subscribe <GameFSMStates>(GameFSM.EVT_ON_CHANGE_GAME_STATE, (CurrentState) => { ToggleInGameUI(CurrentState == GameFSMStates.GAMEOVER); }); EventManager.Subscribe <GameFSMStates>(GameFSM.EVT_ON_CHANGE_GAME_STATE, (CurrentState) => { ToggleInGameUI(CurrentState != GameFSMStates.MAINMENU || CurrentState != GameFSMStates.GAMEOVER); }); //0 for player ID EventManager.Subscribe <ObjectStats>(EventConst.GetUpdatePlayerStats(0), (currentStats) => ShowStats(currentStats)); EventManager.Subscribe <float>(EventConst.GetUpdatePlayerHealth(0), (health) => healthBar.UpdateFill(health)); EventManager.Subscribe <float>(EventConst.GetUpdatePlayerFuel(0), (fuel) => fuelBar.UpdateFill(fuel)); EventManager.Subscribe <Vector2>(EventConst.GetUpdateUIPosAim(0), (mPos) => UpdateCursorPosition(mPos)); EventManager.Subscribe <bool>(EventConst.GetUpdateAimTargetInSight(0), (isInSight) => UpdateTargetInSight(isInSight)); }
void InvokeFuelEvent() { EventManager.Invoke <float>(EventConst.GetUpdatePlayerFuel(player.ID), CurrentFuel / maxFuel); }