All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ThemeChangeController.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "IEnvironmentTexturesObserver.h"
7 #include "EnvironmentTextures.h"
8 #include "CityThemes.h"
9 #include "CityThemeState.h"
10 #include "ThemeStateTransitionController.h"
11 
12 namespace Eegeo
13 {
14  namespace Resources
15  {
16  namespace CityThemes
17  {
19  {
20  public:
21  ThemeChangeController(Rendering::EnvironmentTextures& environmentTextures, ThemeStateTransitionController& themeStateTransitionController)
22  : m_environmentTextures(environmentTextures)
23  , m_themeStateTransitionController(themeStateTransitionController)
24  {
25  environmentTextures.RegisterObserver(*this);
26  }
27 
29  {
30  m_environmentTextures.RemoveObserver(*this);
31  }
32 
33  void OnTexturesAddedForState(const Resources::CityThemes::CityThemeState& state, const Rendering::EnvironmentStateTextures& stateTextures)
34  {
35  if(state.Name == m_themeStateTransitionController.GetTargetStateName())
36  {
37  m_themeStateTransitionController.SetState(state, stateTextures);
38  }
39  }
40 
41  private:
42  Rendering::EnvironmentTextures& m_environmentTextures;
43  ThemeStateTransitionController& m_themeStateTransitionController;
44  };
45  }
46  }
47 }