Robot Devastation
DeadState.hpp
1 // Authors: see AUTHORS.md at project root.
2 // CopyPolicy: released under the terms of the LGPLv2.1, see LICENSE at project root.
3 // URL: https://github.com/asrob-uc3m/robotDevastation
4 
5 #ifndef __RD_DEAD_STATE_HPP__
6 #define __RD_DEAD_STATE_HPP__
7 
8 #include "State.hpp"
9 #include "ManagerHub.hpp"
10 #include "InputEventListener.hpp"
11 #include "NetworkManager.hpp"
12 #include "ImageManager.hpp"
13 #include "InputManager.hpp"
14 #include "MentalMap.hpp"
15 #include "IRobotManager.hpp"
16 #include "AudioManager.hpp"
17 #include "ScreenManager.hpp"
18 #include "DeadScreen.hpp"
19 #include "Key.hpp"
20 #include "WindowEvent.hpp"
21 
22 namespace rd{
23 
35 class DeadState : public State, public ManagerHub, public InputEventListener
36 {
37 public:
38  DeadState(NetworkManager * networkManager, ImageManager * imageManager,
39  InputManager * inputManager, MentalMap * mentalMap,
40  asrob::IRobotManager * robotManager, AudioManager * audioManager,
41  ScreenManager * screenManager);
42  virtual ~DeadState();
43  virtual bool setup();
44  virtual bool loop();
45  virtual bool cleanup();
46  virtual int evaluateConditions();
47 
48  //enum DeadStateOption {RESPAWN_SELECTED, EXIT_SELECTED};
49  static const int RESPAWN_SELECTED;
50  static const int EXIT_SELECTED;
51 
52  //-- InputEventListener interface:
53  virtual bool onKeyDown(const Key & k);
54  virtual bool onKeyUp(const Key & k);
55  virtual bool onWindowEvent(const WindowEvent & event);
56 
57  static const int DEFAULT_RATE_MS;
58  static const int MAX_HEALTH;
59 
60 protected:
61  DeadScreen screen;
62  bool received_respawn;
63  bool received_exit;
64  int elapsed_time; //-- Time elapsed in ms
65  int timer; //-- Countdown timer in s
66 };
67 }
68 #endif // __RD_DEAD_STATE_HPP__
rd::MentalMap
Mental map is a repository for information about the players, targets and weapons.
Definition: MentalMap.hpp:38
rd::AudioManager
Music and sound effects manager.
Definition: AudioManager.hpp:28
rd::DeadScreen
A User Interface.
Definition: DeadScreen.hpp:23
rd
The main, catch-all namespace for Robot Devastation.
Definition: groups.dox:4
rd::DeadState::onWindowEvent
virtual bool onWindowEvent(const WindowEvent &event)
This function will be called whenever a window event is raised.
Definition: DeadState.cpp:173
rd::DeadState::cleanup
virtual bool cleanup()
Function excuted when this state is going to be stopped (due to an error or a transition)
Definition: DeadState.cpp:101
rd::DeadState::evaluateConditions
virtual int evaluateConditions()
This function is called after each call to loop() in order to know the transition to make.
Definition: DeadState.cpp:135
rd::DeadState::setup
virtual bool setup()
Function executed just before the loop function, when the state is enabled.
Definition: DeadState.cpp:35
rd::InputEventListener
Interface for objects that can be notified of input events by the InputManager.
Definition: InputEventListener.hpp:20
rd::Key
Class that represents a keyboard key.
Definition: Key.hpp:23
rd::State
Base class for each of the states of a FiniteStateMachine.
Definition: State.hpp:18
rd::InputManager
User input manager (keyboard, mouse, joysticks, etc)
Definition: InputManager.hpp:35
rd::DeadState::onKeyDown
virtual bool onKeyDown(const Key &k)
This function will be called whenever a key is pressed on the keyboard.
Definition: DeadState.cpp:146
rd::ManagerHub
A classs to interface all the robotDevastation managers. As some classes, such as the game states,...
Definition: ManagerHub.hpp:28
rd::ScreenManager
Manage game screens.
Definition: ScreenManager.hpp:35
rd::WindowEvent
Class that represents a window event.
Definition: WindowEvent.hpp:19
rd::DeadState::onKeyUp
virtual bool onKeyUp(const Key &k)
This function will be called whenever a key is released on the keyboard.
Definition: DeadState.cpp:151
rd::NetworkManager
Manages the communications between the user and the RobotDevastation network.
Definition: NetworkManager.hpp:37
rd::ImageManager
Generic image input manager.
Definition: ImageManager.hpp:39
rd::DeadState
Game Dead State.
Definition: DeadState.hpp:35
rd::DeadState::loop
virtual bool loop()
Function executed periodically when the state is active.
Definition: DeadState.cpp:68