Peoplemon  0.1.0
Peoplemon 3 game source documentation
Weather.hpp
Go to the documentation of this file.
1 #ifndef CORE_MAPS_WEATHER_HPP
2 #define CORE_MAPS_WEATHER_HPP
3 
4 #include <BLIB/Engine/Engine.hpp>
5 #include <SFML/Graphics.hpp>
6 #include <cstdint>
7 #include <memory>
8 
9 namespace core
10 {
11 namespace system
12 {
13 class Systems;
14 }
15 
16 namespace map
17 {
18 class Map;
19 
20 namespace weather
21 {
22 struct Base;
23 }
24 
32 class Weather {
33 public:
38  enum Type : std::uint8_t {
40  None = 0,
41 
43  AllRandom = 1,
44 
46  LightRain = 2,
47 
50 
52  HardRain = 4,
53 
56 
58  LightSnow = 6,
59 
62 
64  HardSnow = 8,
65 
68 
70  ThinFog = 10,
71 
73  ThickFog = 11,
74 
76  Sunny = 12,
77 
79  SandStorm = 13,
80 
83 
85  SnowRandom = 15,
86 
88  DesertRandom = 16
89  };
90 
95  Weather();
96 
101  ~Weather();
102 
109  void activate(system::Systems& systems, Map& map);
110 
117  void set(Type type, bool immediate = false);
118 
123  Type getType() const;
124 
130  void update(float dt);
131 
132 private:
133  enum State { Continuous, WaitingWeather, Stopping, WaitingStopped };
134 
135  Type type;
136  std::unique_ptr<weather::Base> weather;
137  State state;
138  float stateTime;
139  system::Systems* systems;
140  Map* owner;
141 
142  void makeWeather();
143 };
144 
145 } // namespace map
146 } // namespace core
147 
148 #endif
Core classes and functionality for both the editor and game.
The primary map class that represents a usable map in the game.
Definition: Map.hpp:49
Parent weather system for maps. Manages active weather.
Definition: Weather.hpp:32
Type
The type of weather.
Definition: Weather.hpp:38
@ HardSnowThunder
Hard snow with thunder.
Definition: Weather.hpp:67
@ Sunny
A very sunny day with pulsating light.
Definition: Weather.hpp:76
@ ThinFog
Thin fog covers the area.
Definition: Weather.hpp:70
@ SandStorm
A sandstorm ravages you.
Definition: Weather.hpp:79
@ HardRain
Hard rain with no thunder.
Definition: Weather.hpp:52
@ HardRainThunder
Hard rain with thunder.
Definition: Weather.hpp:55
@ LightRainThunder
Light rain with thunder.
Definition: Weather.hpp:49
@ None
No weather will occur.
Definition: Weather.hpp:40
@ WaterRandom
Periodically triggers one of LightRain, HardRain, LightRainThunder, HardRainThunder.
Definition: Weather.hpp:82
@ LightSnowThunder
Light snow with thunder.
Definition: Weather.hpp:61
@ LightRain
Light rain with no thunder.
Definition: Weather.hpp:46
@ SnowRandom
Periodically triggers one of LightSnow, HardSnow, LightSnowThunder, HardSnowThunder.
Definition: Weather.hpp:85
@ ThickFog
Thick fog obscures everything.
Definition: Weather.hpp:73
@ LightSnow
Light snow with no thunder.
Definition: Weather.hpp:58
@ DesertRandom
Periodically triggers one of Sunny, Sandstorm.
Definition: Weather.hpp:88
@ HardSnow
Hard snow with no thunder.
Definition: Weather.hpp:64
@ AllRandom
All types of weather may occur over time.
Definition: Weather.hpp:43
Weather()
Initializes the weather system with None.
Definition: Weather.cpp:40
void update(float dt)
Updates the current weather.
Definition: Weather.cpp:68
void activate(system::Systems &systems, Map &map)
Activates the weather system.
Definition: Weather.cpp:49
~Weather()
Terminates active weather.
Definition: Weather.cpp:47
Type getType() const
Returns the current type of weather.
Definition: Weather.cpp:66
void set(Type type, bool immediate=false)
Sets the current weather type.
Definition: Weather.cpp:54
Owns all primary systems and a reference to the engine.
Definition: Systems.hpp:47
Base class for all weather types.
Definition: Base.hpp:28