/// <summary> /// Return the first active SFXState in the given SimSet/SimGroup. /// </summary> /// <param name="group"></param> public static SFXState sfxGetActiveStateInGroup(SimGroup group) { for (uint i = 0; i < group.getCount(); i++) { SimObject obj = group.getObject(i); if (!obj.isMemberOfClass("SFXState")) { continue; } SFXState state = obj.As <SFXState>(); if (state.isActive()) { return(state); } } return(null); }
public override void onActivate() { base.onActivate(); SimGroup group = ParentGroup.As <SimGroup>(); for (uint i = 0; i < group.getCount(); i++) { SimObject obj = group.getObject(i); if (obj.getId() == getId() || !obj.isMemberOfClass("SFXState")) { continue; } SFXState state = obj.As <SFXState>(); if (state.isActive()) { state.deactivate(); } } }
public static void Init() { //----------------------------------------------------------------------------- // Special audio state that will always and only be active when no other // state is active. Useful for letting slots apply specifically when no // other slot in a list applies. AudioStateNone = new SFXState("AudioStateNone"); AudioStateNone.registerSingleton(); AudioStateNone.activate(); //----------------------------------------------------------------------------- // Location-dependent states. AudioLocation = new SimGroup("AudioLocation", true); // State when the listener is outside. AudioLocationOutside = new AudioStateExclusive("AudioLocationOutside") { ParentGroup = AudioLocation }; AudioLocationOutside.registerSingleton(); // State when the listener is submerged. AudioLocationUnderwater = new AudioStateExclusive("AudioLocationUnderwater") { ParentGroup = AudioLocation }; AudioLocationUnderwater.registerSingleton(); // State when the listener is indoors. AudioLocationInside = new AudioStateExclusive("AudioLocationInside") { ParentGroup = AudioLocation }; AudioLocationInside.registerSingleton(); //----------------------------------------------------------------------------- // Mood-dependent states. AudioMood = new SimGroup("AudioMood", true); AudioMoodNeutral = new AudioStateExclusive("AudioMoodNeutral") { ParentGroup = AudioMood }; AudioMoodNeutral.registerSingleton(); AudioMoodAggressive = new AudioStateExclusive("AudioMoodAggressive") { ParentGroup = AudioMood }; AudioMoodAggressive.registerSingleton(); AudioMoodTense = new AudioStateExclusive("AudioMoodTense") { ParentGroup = AudioMood }; AudioMoodTense.registerSingleton(); AudioMoodVictory = new AudioStateExclusive("AudioMoodVictory") { ParentGroup = AudioMood }; AudioMoodVictory.registerSingleton(); AudioMoodCalm = new AudioStateExclusive("AudioMoodCalm") { ParentGroup = AudioMood }; AudioMoodCalm.registerSingleton(); }