Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 22, 2010, 4:19:40 PM (14 years ago)
Author:
jo
Message:

Jetzt auch mit einfachem HUD.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.cc

    r7556 r7579  
    3434#include "worldentities/pawns/Pawn.h"
    3535#include "core/ConfigValueIncludes.h"
     36#include "util/Convert.h"
    3637
    3738namespace orxonox
     
    4647        this->playersAlive=0;
    4748        this->timeRemaining=20.0f;
     49        this->setHUDTemplate("LastmanstandingHUD");
    4850    }
    4951
     
    128130        COUT(0) << message << std::endl;
    129131        Host::Broadcast(message);
     132        //Update: EachPlayer's "Players in Game"-HUD
     133        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
     134        {
     135            if (it->first->getClientID() == CLIENTID_UNKNOWN)
     136                continue;
     137            const std::string& message1 = "Remaining Players: "+ multi_cast<std::string>(playersAlive);
     138            this->gtinfo_->sendStaticMessage(message1,it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
     139        }
     140       
    130141    }
    131142
     
    142153            COUT(0) << message << std::endl;
    143154            Host::Broadcast(message);
     155            //Update: EachPlayer's "Players in Game"-HUD
     156            for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
     157            {
     158                if (it->first->getClientID() == CLIENTID_UNKNOWN)
     159                    continue;
     160                const std::string& message1 = "Remaining Players: "+ multi_cast<std::string>(playersAlive);
     161                this->gtinfo_->sendStaticMessage(message1,it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
     162            }
    144163        }
    145164
     
    159178
    160179        return valid_player;
     180    }
     181
     182    void LastManStanding::playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn)
     183    {
     184        if (!player)
     185            return;
     186        //Update: Individual Players "lifes"-HUD
     187        std::map<PlayerInfo*, Player>::iterator it2 = this->players_.find(player);
     188        if (it2 != this->players_.end())
     189        {
     190            const std::string& message = "Your Lives: " +multi_cast<std::string>(playerLives_[player]);
     191            this->gtinfo_->sendFadingMessage(message,it2->first->getClientID());
     192
     193        }
     194    }
     195
     196    void LastManStanding::playerStopsControllingPawn(PlayerInfo* player, Pawn* pawn)
     197    {
     198        //Update: EachPlayer's "Players in Game"-HUD
     199        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
     200        {
     201            if (it->first->getClientID() == CLIENTID_UNKNOWN)
     202                continue;
     203            const std::string& message1 = "Remaining Players : "+ multi_cast<std::string>(playersAlive);
     204            this->gtinfo_->sendStaticMessage(message1,it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));
     205        }
     206   
    161207    }
    162208
     
    224270                this->timeToAct_[player]=timeRemaining+3.0f;//reset timer
    225271            }
     272
    226273        }
    227274    }
    228275   
    229 
    230276    void LastManStanding::tick(float dt)
    231277    {
Note: See TracChangeset for help on using the changeset viewer.