Example #1
0
void	PlayerStatusBars :: Update (GameData& GlobalGameData)
{
	PlayerDatabase* playerDb = GlobalGameData.GetPlayerDatabase();
	player = playerDb->GetCurrentPlayer ();
	
	if (player == NULL)
	{
		PlayerName.clear();
		NumberOfStationsBeingTracked = 0;
	}
	else
	{
		PlayerName = player->GetName();
		NumberOfStationsBeingTracked = player->GetNumStations();
		ShipArchetype* ship = player->GetShip ();
		PlayerShipTracking = static_cast<float>( ship->GetHealth () );
		PlayerShipShieldTracking = static_cast<float>( ship->GetShieldLevel () );
		
		for (int i=0; i<NumberOfStationsBeingTracked; i++)
		{
			SpaceStation* station = player->GetStation(i);
			StationTracking[i] = static_cast<float>( station->GetHealth () );
			StationShieldTracking[i] = static_cast<float>( station->GetShieldLevel () );
		}
	}
}