Coloring players depending on team and created a blue spawn in MovementTest
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity name="Spawner">
|
<Entity name="RedSpawn">
|
||||||
<Components>
|
<Components>
|
||||||
<c:PlayerSpawn/>
|
<c:PlayerSpawn/>
|
||||||
<c:Spawner>
|
<c:Spawner>
|
||||||
@@ -133,6 +133,51 @@
|
|||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
|
<Entity name="BlueSpawn">
|
||||||
|
<Components>
|
||||||
|
<c:PlayerSpawn/>
|
||||||
|
<c:Spawner>
|
||||||
|
<EntityFile>Schema/Entities/Player.xml</EntityFile>
|
||||||
|
</c:Spawner>
|
||||||
|
<c:Team>
|
||||||
|
<Team>
|
||||||
|
<Blue/>
|
||||||
|
</Team>
|
||||||
|
</c:Team>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.300000012" Y="0.0270000007" Z="6.67400026"/>
|
||||||
|
<Orientation X="0" Y="3.20700026" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:SpawnPoint/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Assault.obj</Resource>
|
||||||
|
<Color A="1" B="1" G="0.254901975" R="0"/>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.800000012" Y="0" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:SpawnPoint/>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Assault.obj</Resource>
|
||||||
|
<Color A="1" B="1" G="0.254901975" R="0"/>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.600000024" Y="0" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
|
|
||||||
</Entity>
|
</Entity>
|
||||||
|
|||||||
@@ -78,6 +78,9 @@ bool PlayerSpawnSystem::OnPlayerSpawned(Events::PlayerSpawned& e)
|
|||||||
m_World->DeleteEntity(m_PlayerEntities[e.PlayerID].ID);
|
m_World->DeleteEntity(m_PlayerEntities[e.PlayerID].ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Store the player for future reference
|
||||||
|
m_PlayerEntities[e.PlayerID] = e.Player;
|
||||||
|
|
||||||
// Set the camera to the correct entity
|
// Set the camera to the correct entity
|
||||||
EntityWrapper cameraEntity = e.Player.FirstChildByName("Camera");
|
EntityWrapper cameraEntity = e.Player.FirstChildByName("Camera");
|
||||||
if (cameraEntity.Valid()) {
|
if (cameraEntity.Valid()) {
|
||||||
@@ -86,8 +89,23 @@ bool PlayerSpawnSystem::OnPlayerSpawned(Events::PlayerSpawned& e)
|
|||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store the player for future reference
|
// HACK: Set the player model color to team color
|
||||||
m_PlayerEntities[e.PlayerID] = e.Player;
|
EntityWrapper playerModel = e.Player.FirstChildByName("PlayerModel");
|
||||||
|
if (playerModel.Valid() && e.Player.HasComponent("Team")) {
|
||||||
|
ComponentWrapper cTeam = e.Player["Team"];
|
||||||
|
ComponentWrapper cModel = playerModel["Model"];
|
||||||
|
if ((ComponentInfo::EnumType)cTeam["Team"] == cTeam["Team"].Enum("Red")) {
|
||||||
|
cModel["Color"] = glm::vec3(1.f, 0.f, 0.f);
|
||||||
|
} else if ((ComponentInfo::EnumType)cTeam["Team"] == cTeam["Team"].Enum("Blue")) {
|
||||||
|
cModel["Color"] = glm::vec3(0.f, 0.25f, 1.f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Set the player name to whatever
|
||||||
|
//EntityWrapper playerName = e.Player.FirstChildByName("PlayerName");
|
||||||
|
//if (playerName.Valid()) {
|
||||||
|
// playerName["Text"]["Content"] = ???;
|
||||||
|
//}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user