Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 28, 2011, 5:10:01 PM (13 years ago)
Author:
dafrick
Message:

Merging tutoriallevel3 branch into presentation branch.

Location:
code/branches/presentation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation

  • code/branches/presentation/src/orxonox/infos/GametypeInfo.h

    r7163 r8637  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
    25  *      ...
     25 *      Damian 'Mozork' Frick
    2626 *
    2727 */
     28
     29/**
     30    @file GametypeInfo.h
     31    @brief Definition of the GametypeInfo class
     32*/
    2833
    2934#ifndef _GametypeInfo_H__
     
    3338
    3439#include <string>
     40
    3541#include "Info.h"
    3642
    3743namespace orxonox
    3844{
     45
     46    /**
     47    @brief
     48        The GametypeInfo class keeps track of the state of the game and provides facilities to inform the player about it.
     49
     50    @author
     51        Fabian 'x3n' Landau
     52    @author
     53        Damian 'Mozork' Frick
     54    */
    3955    class _OrxonoxExport GametypeInfo : public Info
    4056    {
     
    4561            virtual ~GametypeInfo();
    4662
     63            /**
     64            @brief Get whether the game has started yet.
     65            @return Returns true if the game has started, false if not.
     66            */
    4767            inline bool hasStarted() const
    4868                { return this->bStarted_; }
     69            void changedStarted(void); // Is called when the game has changed to started.
     70           
     71            /**
     72            @brief Get whether the game has ended yet.
     73            @return Returns true if the game has ended, false if not.
     74            */
    4975            inline bool hasEnded() const
    5076                { return this->bEnded_; }
     77            void changedEnded(void); // Is called when the game has changed to ended.
    5178
     79            /**
     80            @brief Get whether the start countdown is currently running.
     81            @return Returns true if the countdown is running, false if not.
     82            */
    5283            inline bool isStartCountdownRunning() const
    5384                { return this->bStartCountdownRunning_; }
     85            void changedStartCountdownRunning(void); // Is called when the start countdown has been either started or stopped.
     86
     87            /**
     88            @brief Get the current value of the start countdown.
     89            @return Returns the current value of the start countdown.
     90            */
    5491            inline float getStartCountdown() const
    5592                { return this->startCountdown_; }
     93
     94            /**
     95            @brief Get the current start countdown counter.
     96                   The start countdown counter only has integer values that correspond to the actually displayed countdown.
     97            @return Returns the current integer countdown counter.
     98            */
     99            inline unsigned int getStartCountdownCounter() const
     100                { return this->counter_; }
     101            void changedCountdownCounter(void); // Is called when the start countdown counter has changed.
     102
     103            /**
     104            @brief Get whether the local player is ready to spawn.
     105            @return Returns true if the player is ready to spawn, false if not.
     106            */
     107            inline bool isReadyToSpawn() const
     108                { return this->readyToSpawn_; }
     109            void changedReadyToSpawn(bool ready); // Inform the GametypeInfo that the local player has changed its spawned status.
     110           
     111            /**
     112            @brief Get whether the local player is spawned.
     113            @return Returns true if the local player is currently spawned, false if not.
     114            */
     115            inline bool isSpawned() const
     116                { return this->spawned_; }
     117            void changedSpawned(bool spawned); // Inform the GametypeInfo that the local player has changed its spawned status.
    56118
    57119            inline const std::string& getHUDTemplate() const
     
    70132            void dispatchStaticMessage(const std::string& message,const ColourValue& colour);
    71133            void dispatchFadingMessage(const std::string& message);
     134           
     135        protected:
     136            void start(void); // Inform the GametypeInfo that the game has started.
     137            void end(void); // Inform the GametypeInfo that the game has ended.
     138            void setStartCountdown(float countdown); // Set the start countdown to the input value.
     139            void countdownStartCountdown(float countDown); // Count down the start countdown by the specified value.
     140            void countDown(); // Count down the start countdown counter.
     141            void startStartCountdown(void); // Inform the GametypeInfo about the start of the start countdown.
     142            void stopStartCountdown(void); // Inform the GametypeInfo about the stop of the start countdown.
     143            void playerReadyToSpawn(PlayerInfo* player); // Inform the GametypeInfo about a player that is ready to spawn.
     144            void pawnKilled(PlayerInfo* player); // Inform the GametypeInfo about a player whose Pawn has been killed.
     145            void playerSpawned(PlayerInfo* player); // Inform the GametypeInfo about a player that has spawned.
     146            void playerEntered(PlayerInfo* player); // Inform the GametypeInfo about a player that has entered,
     147
     148            inline void setHUDTemplate(const std::string& templateName)
     149                { this->hudtemplate_ = templateName; };
    72150
    73151        private:
    74152            void registerVariables();
     153            void setSpawnedHelper(PlayerInfo* player, bool spawned); // Helper method. Sends changedReadyToSpawn notifiers over the network.
     154            void setReadyToSpawnHelper(PlayerInfo* player, bool ready); // Helper method. Sends changedSpawned notifiers over the network.
    75155
    76             bool bStarted_;
    77             bool bEnded_;
    78             bool bStartCountdownRunning_;
    79             float startCountdown_;
     156            static const std::string NOTIFICATION_SENDER; //!< The name of the sender for the sending of notifications.
     157
     158            bool bStarted_; //!< Whether the game has started,
     159            bool bEnded_; //!< Whether the game has ended.
     160            bool bStartCountdownRunning_; //!< Whether the start countdown is running.
     161            float startCountdown_; //!< The current value of the start countdown.
     162            unsigned int counter_; //!< The current integer value of the start countdown, the start countdown counter.
    80163            std::string hudtemplate_;
     164           
     165            std::set<PlayerInfo*> spawnedPlayers_; //!< A set of players that are currently spawned.
     166            bool spawned_; //!< Whether the local Player is currently spawned.
     167            bool readyToSpawn_; //!< Whether the local Player is ready to spawn.
    81168    };
    82169}
Note: See TracChangeset for help on using the changeset viewer.