Player is now spawned as the correct class that they picked.

This commit is contained in:
2016-03-13 23:05:52 +01:00
parent fc7f57fd5d
commit 9d2ce5af8a
7 changed files with 2676 additions and 359 deletions
+11 -2
View File
@@ -83,15 +83,24 @@ void PlayerSpawnSystem::Update(double dt)
if (it->Team == cSpawnerTeam["Team"].Enum("Spectator")) {
++playersSpectating;
break;
} else {
continue;
}
continue;
}
}
// TODO: Choose a different spawner depending on class picked?
std::string playerEntityFile;
if (it->Class == PlayerClass::Assault) {
playerEntityFile = (const std::string&)cPlayerSpawn["AssaultFile"];
} else if (it->Class == PlayerClass::Defender) {
playerEntityFile = (const std::string&)cPlayerSpawn["DefenderFile"];
} else if (it->Class == PlayerClass::Sniper) {
playerEntityFile = (const std::string&)cPlayerSpawn["SniperFile"];
}
// Spawn the player!
EntityWrapper player = SpawnerSystem::Spawn(spawner, EntityWrapper::Invalid, "Player");
EntityWrapper player = SpawnerSystem::SpawnEntityFile(playerEntityFile, spawner, EntityWrapper::Invalid, "Player");
// Set the player team affiliation
player["Team"]["Team"] = it->Team;