public void AlarmStateSwitch(GeneralVariables.ALARMSTATE alarmState) { if (owner.ActiveAlarmsCount > 0) { ChangeState <MoveToAlarmState>(); (GetCurrentState() as MoveToAlarmState).SetCurrentAbstractAlarm(owner.GetActiveAlarm(owner.ActiveAlarmsCount - 1)); return; } switch (alarmState) { case GeneralVariables.ALARMSTATE.NONE: ChangeState <GoingHomeState>(); break; case GeneralVariables.ALARMSTATE.LOW: ChangeState <ScanAreaState>(); break; case GeneralVariables.ALARMSTATE.HIGH: ChangeState <LookForPlayerState>(); break; case GeneralVariables.ALARMSTATE.FULL: ChangeState <LookForPlayerState>(); break; default: ChangeState <IdleState>(); break; } }
void onAlarmStateChanged(AlarmStateChanged stateChanged) { if (currentAlarmState != stateChanged.AlarmState) { switch (stateChanged.AlarmState) { case GeneralVariables.ALARMSTATE.NONE: StartCoroutine(crossFadeTracks(currentAudioSource, audioSources[0])); currentAlarmState = stateChanged.AlarmState; break; case GeneralVariables.ALARMSTATE.LOW: StartCoroutine(crossFadeTracks(currentAudioSource, audioSources[1])); currentAlarmState = stateChanged.AlarmState; break; case GeneralVariables.ALARMSTATE.HIGH: StartCoroutine(crossFadeTracks(currentAudioSource, audioSources[2])); currentAlarmState = stateChanged.AlarmState; break; case GeneralVariables.ALARMSTATE.FULL: StartCoroutine(crossFadeTracks(currentAudioSource, audioSources[3])); currentAlarmState = stateChanged.AlarmState; break; } } }
void checkAlarmLevel() { GeneralVariables.ALARMSTATE level; Color newColour; if (currentAlarmlevel >= gameoverThreshold) { level = GeneralVariables.ALARMSTATE.FULL; newColour = fullColour; } else if (currentAlarmlevel >= highTreshold) { level = GeneralVariables.ALARMSTATE.HIGH; newColour = highColour; } else if (currentAlarmlevel >= lowThreshold) { level = GeneralVariables.ALARMSTATE.LOW; newColour = lowColour; } else { level = GeneralVariables.ALARMSTATE.NONE; newColour = normalColour; } if (currentAlarmState != level) { currentAlarmState = level; EventQueue.EventManager.Queue(new AlarmStateChanged(currentAlarmState, newColour)); } }
public AlarmStateChanged(GeneralVariables.ALARMSTATE alarmState, Color stateColour) { AlarmState = alarmState; StateColour = stateColour; }