Merge branch 'Movement' of github.com:teamfisk/TacticalZ into Movement

# Conflicts:
#	resources/Schema/Entities/RayAssaultBlue.xml
This commit is contained in:
viktorljung
2016-03-13 16:45:57 +01:00
14 changed files with 1290 additions and 129 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ void FadeSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cFade,
return;
}
if (!(bool)cFade["Out"]) {
if ((bool)cFade["Out"]) {
dTime *= -1;
}
@@ -354,7 +354,16 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi
void DefenderWeaponBehaviour::spawnTracers(ComponentWrapper cWeapon, WeaponInfo& wi, std::vector<glm::vec2> pattern)
{
EntityWrapper muzzle = getRelevantWeaponEntity(wi).FirstChildByName("WeaponMuzzle");
EntityWrapper flashSpawner = getRelevantWeaponEntity(wi).FirstChildByName("WeaponMuzzleFlash");
if (flashSpawner.Valid()) {
std::uniform_real_distribution<float> randomSpreadAngle(0.f, 3.1415f*2);
EntityWrapper flash = SpawnerSystem::Spawn(flashSpawner, flashSpawner);
if (flash.Valid()) {
((Field<glm::vec3>)flash["Transform"]["Orientation"]).z(randomSpreadAngle(m_RandomEngine));
}
}
EntityWrapper muzzle = getRelevantWeaponEntity(wi).FirstChildByName("WeaponMuzzleRay");
if (!muzzle.Valid()) {
return;
}
@@ -189,18 +189,29 @@ void SidearmWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi
return;
}
// Tracer
EntityWrapper tracerSpawner = weaponModelEntity.FirstChildByName("WeaponMuzzle");
//Tracer
EntityWrapper tracerSpawner = weaponModelEntity.FirstChildByName("WeaponMuzzleRay");
if (tracerSpawner.Valid()) {
glm::vec3 origin = TransformSystem::AbsolutePosition(tracerSpawner);
glm::vec3 direction = TransformSystem::AbsoluteOrientation(tracerSpawner) * glm::vec3(0, 0, -1);
float distance = traceRayDistance(origin, direction);
EntityWrapper ray = SpawnerSystem::Spawn(tracerSpawner);
EntityWrapper ray = SpawnerSystem::Spawn(tracerSpawner, tracerSpawner);
if (ray.Valid()) {
((Field<glm::vec3>)ray["Transform"]["Scale"]).z(distance);
}
}
//Flash
EntityWrapper flashSpawner = weaponModelEntity.FirstChildByName("WeaponMuzzleFlash");
if (flashSpawner.Valid()) {
std::uniform_real_distribution<float> randomSpreadAngle(0.f, 3.1415f*2);
EntityWrapper flash = SpawnerSystem::Spawn(flashSpawner, flashSpawner);
if(flash.Valid()){
((Field<glm::vec3>)flash["Transform"]["Orientation"]).z(randomSpreadAngle(m_RandomEngine));
}
}
// Deal damage
if (dealDamage(cWeapon, wi)) {
// Show hit marker