Instagib!
This commit is contained in:
+1
-1
@@ -77,7 +77,7 @@ Game::Game(int argc, char* argv[])
|
||||
// All systems with orderlevel 0 will be updated first.
|
||||
unsigned int updateOrderLevel = 0;
|
||||
m_SystemPipeline->AddSystem<RaptorCopterSystem>(updateOrderLevel);
|
||||
//m_SystemPipeline->AddSystem<HealthSystem>(updateOrderLevel);
|
||||
m_SystemPipeline->AddSystem<HealthSystem>(updateOrderLevel);
|
||||
m_SystemPipeline->AddSystem<PlayerMovementSystem>(updateOrderLevel);
|
||||
m_SystemPipeline->AddSystem<InterpolationSystem>(updateOrderLevel);
|
||||
m_SystemPipeline->AddSystem<SpawnerSystem>(updateOrderLevel);
|
||||
|
||||
@@ -45,10 +45,16 @@ void HealthSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& comp
|
||||
}
|
||||
}
|
||||
|
||||
bool HealthSystem::OnPlayerDamaged(const Events::PlayerDamage& e)
|
||||
bool HealthSystem::OnPlayerDamaged(Events::PlayerDamage& e)
|
||||
{
|
||||
//save the changed HP to a vector. it will be taken care of in UpdateComponent
|
||||
//m_DeltaHealthVector.push_back(std::make_tuple(e.PlayerDamagedID, -e.DamageAmount));
|
||||
ComponentWrapper cHealth = e.Player["Health"];
|
||||
double& health = cHealth["Health"];
|
||||
health -= e.Damage;
|
||||
|
||||
if (health <= 0.0) {
|
||||
m_World->DeleteEntity(e.Player.ID);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,11 +25,6 @@ bool WeaponSystem::OnPlayerSpawned(const Events::PlayerSpawned& e)
|
||||
|
||||
bool WeaponSystem::OnInputCommand(const Events::InputCommand& e)
|
||||
{
|
||||
// Only shoot client-side!
|
||||
if (e.PlayerID != -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only shoot if the player is alive
|
||||
if (!m_LocalPlayer.Valid()) {
|
||||
return false;
|
||||
@@ -44,9 +39,17 @@ bool WeaponSystem::OnInputCommand(const Events::InputCommand& e)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WeaponSystem::OnShoot(const Events::Shoot& eShoot) {
|
||||
bool WeaponSystem::OnShoot(const Events::Shoot& eShoot)
|
||||
{
|
||||
// TODO: Weapon firing effects here
|
||||
|
||||
// Only run further picking code client-side!
|
||||
if (eShoot.Player != m_LocalPlayer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Screen center, based on current resolution!
|
||||
//TODO: check if player has enough ammo and if weapon has a cooldown or not
|
||||
// TODO: check if player has enough ammo and if weapon has a cooldown or not
|
||||
Rectangle screenResolution = m_Renderer->Resolution();
|
||||
glm::vec2 centerScreen = glm::vec2(screenResolution.Width / 2, screenResolution.Height / 2);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user