Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 4, 2009, 4:03:03 PM (15 years ago)
Author:
youngk
Message:

Implemented automatic ambient sound file path fetch according to current mood.
Valid moods are: default and dnb
BUG Loading of a second sound fails (independent of the file used). Probably an error in BaseSound::setSource().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/sound3/src/orxonox/MoodManager.cc

    r5956 r6031  
    4242    {
    4343        RegisterRootObject(MoodManager);
     44        moodOld_ = "default";
    4445        this->setConfigValues();
    4546                CommandExecutor::addConsoleCommandShortcut(createConsoleCommand(createFunctor(&MoodManager::setMood, this), "setMood"));
     
    5354    {
    5455        SetConfigValue(mood_, "default")
    55             .description("Sets the mood for the current level.");
     56            .description("Sets the mood for the current level.")
     57            .callback(this, &MoodManager::checkMoodValidity);
    5658    }
    5759
    58         // sets a new mood
     60        /**
     61     *  Sets the mood
     62     *  @note TODO: Inform dependent classes of mood change
     63     */
    5964        void MoodManager::setMood(const std::string& mood) {
    6065                ModifyConfigValue(mood_, set, mood);
     
    6570                return mood_;
    6671        }
     72
     73    void MoodManager::checkMoodValidity()
     74    {
     75        if(mood_ != "default" && mood_ != "dnb")        // Insert new moods here
     76        {
     77            ResetConfigValue(mood_);
     78        }
     79        COUT(0) << "MoodManager: Mood now set to " << mood_ << std::endl;
     80        return;
     81    }
    6782}
Note: See TracChangeset for help on using the changeset viewer.