diff --git a/assets b/assets index 4205e927..819f9d1c 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 4205e92755aa67c90db6d272047cd92037ae9f11 +Subproject commit 819f9d1c8f62e8ebb07dafbb39f6dff1fd4d5a05 diff --git a/include/Game/Systems/Weapon/WeaponBehaviour.h b/include/Game/Systems/Weapon/WeaponBehaviour.h index 3cda172e..b00dd2e0 100644 --- a/include/Game/Systems/Weapon/WeaponBehaviour.h +++ b/include/Game/Systems/Weapon/WeaponBehaviour.h @@ -9,6 +9,7 @@ #include "Systems/SpawnerSystem.h" #include "Rendering/ESetCamera.h" #include "Core/ConfigFile.h" +#include "Rendering/EAutoAnimationBlend.h" template class WeaponBehaviour : public PureSystem @@ -94,6 +95,31 @@ protected: } } + void playAnimation(EntityWrapper weaponModelEntity, const std::string& subTreeName, const std::string& animationNodeName) + { + EntityWrapper root = weaponModelEntity.FirstParentWithComponent("Model"); + if (!root.Valid()) { + return; + } + + EntityWrapper subTree = root.FirstChildByName(subTreeName); + if (!subTree.Valid()) { + return; + } + + EntityWrapper animationNode = subTree.FirstChildByName(animationNodeName); + if (!animationNode.Valid()) { + return; + } + + Events::AutoAnimationBlend eFireBlend; + eFireBlend.RootNode = root; + eFireBlend.NodeName = animationNodeName; + eFireBlend.Restart = true; + eFireBlend.Start = true; + m_EventBroker->Publish(eFireBlend); + } + void playAnimationAndReturn(EntityWrapper weaponModelEntity, const std::string& subTreeName, const std::string& animationNodeName) { EntityWrapper root = weaponModelEntity.FirstParentWithComponent("Model"); diff --git a/resources/Schema/Entities/DefenderShield.xml b/resources/Schema/Entities/DefenderShield.xml index da760e72..5cb72116 100755 --- a/resources/Schema/Entities/DefenderShield.xml +++ b/resources/Schema/Entities/DefenderShield.xml @@ -2,36 +2,36 @@ + + Deploy + Idle + 0 + + + Models/Characters/Defender/DefenderShield.mesh + - + - - Models/Core/UnitPlane.mesh - - - - - - + + ActivateDeactiveShieldF + + 1 + + - + - - - Models/Core/UnitHexagon.mesh - - true - - - - - - + + ShieldFrontF + 1 + + diff --git a/resources/Schema/Entities/MovementTest.xml b/resources/Schema/Entities/MovementTest.xml index 90c943ef..8202bff3 100644 --- a/resources/Schema/Entities/MovementTest.xml +++ b/resources/Schema/Entities/MovementTest.xml @@ -15,7 +15,7 @@ - Schema/Entities/PlayerAssaultFallbackRed.xml + Schema/Entities/PlayerDefenderBlue.xml @@ -98,7 +98,7 @@ - + @@ -111,7 +111,7 @@ - + diff --git a/resources/Schema/Entities/Player.xml b/resources/Schema/Entities/Player.xml index dfcf40a3..70b387bb 100644 --- a/resources/Schema/Entities/Player.xml +++ b/resources/Schema/Entities/Player.xml @@ -485,11 +485,11 @@ - Run + MovementBlend FinalBlend - Models/Characters/Defender/FirstPersonDefenderBlue.mesh + Models/Characters/Assault/FirstPersonAssaultBlue.mesh @@ -506,8 +506,8 @@ Schema/Entities/WeaponAssaultBlueView.xml - - + + @@ -524,8 +524,8 @@ Schema/Entities/SidearmWeaponView.xml - - + + @@ -544,55 +544,31 @@ - Idle - WeaponAction + Fire + Reload 0 true - - - - Fire - Reload - 0 - - - - - - - - ShootShotgunF - 1 - false - - - - - - - - - ReloadSwitchF - 1 - false - - - - - - - - + - IdleF - + ShootRifleF 1 - true + false + + + + + + + + + ReloadSwitchF + 1 + false @@ -608,17 +584,42 @@ - + - - RunF - - 1 - true - + + Idle + Run + 0 + true + - + + + + + RunF + 1 + true + true + + + + + + + + + IdleF + 1 + true + true + + + + + + @@ -672,8 +673,8 @@ Schema/Entities/WeaponAssaultBlueWorld.xml - - + + @@ -693,8 +694,8 @@ Schema/Entities/SidearmWeaponWorld.xml - - + + @@ -801,7 +802,7 @@ CrouchStrafeLeftF - + 1 true @@ -813,7 +814,7 @@ CrouchStrafeRightF - + 1 true @@ -827,7 +828,7 @@ CrouchWalkF - + 1 true @@ -870,42 +871,6 @@ - - - - Walk - Run - 1.2938206818383024e-24 - - - - - - - - WalkF - - 1 - true - - - - - - - - - RunF - - 1 - true - - - - - - - @@ -920,7 +885,7 @@ StrafeRightF - + 1 true @@ -932,7 +897,43 @@ StrafeLeftF - + + 1 + true + + + + + + + + + + + Walk + Run + 1.2938206818383024e-24 + + + + + + + + WalkF + + 1 + true + + + + + + + + + RunF + 1 true @@ -948,7 +949,7 @@ IdleF - + 1 true @@ -1117,7 +1118,7 @@ IdleAssaultRifleU - + 1 true @@ -1129,7 +1130,7 @@ IdleSecWepU - + 1 true diff --git a/resources/Schema/Entities/PlayerAssaultBlue.xml b/resources/Schema/Entities/PlayerAssaultBlue.xml new file mode 100644 index 00000000..bcf4b5e5 --- /dev/null +++ b/resources/Schema/Entities/PlayerAssaultBlue.xml @@ -0,0 +1,1258 @@ + + + + + + + + + + + + + + + + + + + + + + + 5 + + + + + + + + + + + + + 0.10000000149011612 + 300 + + + + + + + + + + Models/Widgets/Camera.mesh + false + + + + + + + + + + + + + + + + + + + Textures/Weapons/Crosshair/SmallThickHoleDot.png + + false + + + + + + + + + + + + Schema/Entities/HitMarker.xml + + + + + + + + + + + + + + 1 + + + + + Textures/HealthHUD3.png + + + + + + + + + + + + + + + + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + + + + + + + + + Textures/Core/White.png + + false + + + + + + + + + + + 0.0 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + 1 + + + + 100/100 + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + 2 + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + 3 + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 1 + + + + 4 + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + + + + 1 + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + Textures/Core/UnitHexagon.png + + + + + + + + + + + + 1 + + + + + Textures/Core/UnitHexagon_Rotated.png + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + Fonts/DroidSans.ttf,64 + + + + + + + + + + + + + + + + + + + + + + Models/Widgets/Arrows/Arrow5.mesh + + + + + + + + + + + + + + + MovementBlend + FinalBlend + + + Models/Characters/Assault/FirstPersonAssaultBlue.mesh + + + + + + + + R_Arm_Weapon_Joint + + + AssaultWeapon + + + Schema/Entities/WeaponAssaultBlueView.xml + + + + + + + + + + + + R_Arm_Weapon_Joint + + + SidearmWeapon + + + Schema/Entities/SidearmWeaponView.xml + + + + + + + + + + + + BlendTreeAssaultWeapon + BlendTreeSecondaryWeapon + 0 + true + + + + + + + + Fire + Reload + 0 + true + + + + + + + + ShootRifleF + 1 + false + + + + + + + + + ReloadSwitchF + 1 + false + + + + + + + + + + + + + + + + + + + Idle + Run + 0 + true + + + + + + + + RunF + 1 + true + true + + + + + + + + + IdleF + 1 + true + true + + + + + + + + + + + + + + + 0.10000000149011612 + 300 + + + Models/Widgets/Camera.mesh + false + + + + + + + + + + + + BlendTreeAim + BlendTreeAssault + + + + + Models/Characters/Assault/AssaultBlue.mesh + + + + + + + + + R_Arm_Weapon_Joint + + + AssaultWeapon + + + + + + Schema/Entities/WeaponAssaultBlueWorld.xml + + + + + + + + + + + + R_Arm_Weapon_Joint + + + SidearmWeapon + + + + + + Schema/Entities/SidearmWeaponWorld.xml + + + + + + + + + + + + AimPrimary + AimSecondary + 0 + true + + + + + + + + AimSecWepA + + false + true + + + + + + + + + AimRifleA + + false + true + + + + + + + + + + + ReloadSwitchBlend + MovementBlend + + + + + + + + StandCrouchBlend + JumpDashBlend + 2.5146881298480398e-63 + true + + + + + + + + StandMovement + CrouchMovement + 0 + true + + + + + + + + MovementBlend + Idle + 1 + + + + + + + + Walk + StrafeLRBlend + 0 + + + + + + + + Left + Right + 0.033793529385008014 + + + + + + + + CrouchStrafeLeftF + + 1 + true + + + + + + + + + CrouchStrafeRightF + + 1 + true + + + + + + + + + + + CrouchWalkF + + 1 + true + + + + + + + + + + + CrouchF + + 1 + + + + + + + + + + + MovementBlend + Idle + 1 + + + + + + + + RunWalkBlend + StrafeLRBlend + 2.4565650245976452e-16 + + + + + + + + Walk + Run + 1.2938206818383024e-24 + + + + + + + + WalkF + + 1 + true + + + + + + + + + RunF + + 1 + true + + + + + + + + + + + Left + Right + 0.033793529385008014 + + + + + + + + StrafeRightF + + 1 + true + + + + + + + + + StrafeLeftF + + 1 + true + + + + + + + + + + + + + IdleF + + 1 + true + + + + + + + + + + + + + Jump + DashBlend + 1 + true + + + + + + + + JumpF + + 1 + false + + + + + + + + + DashFBBlend + DashLRBlend + 0.014621149736541383 + + + + + + + + DashForward + DashBackward + 0.014363533804961248 + + + + + + + + DashForwardF + + 1 + false + + + + + + + + + DashBackwardF + + 1 + false + + + + + + + + + + + DashLeft + DashRight + 4.3244885367500671e-16 + + + + + + + + DashLeftF + + 1 + false + + + + + + + + + DashRightF + + 1 + false + + + + + + + + + + + + + + + + + ReloadSwitch + WeaponActionBlend + 1 + true + + + + + + + + ReloadSwitchU + + 1 + + + + + + + + + IdleBlend + ShootBlend + 0 + + + + + + + + IdlePrimary + IdleSecondary + 0 + + + + + + + + IdleAssaultRifleU + + 1 + true + + + + + + + + + IdleSecWepU + + 1 + true + + + + + + + + + + + ShootPrimary + ShootSecondary + 0 + + + + + + + + ShootFastRifleU + + 1 + + + + + + + + + ShootSecWepFastU + + + + + + + + + + + + + + + + + + + Models/Core/UnitCube.mesh + + false + + + + + + + + + + + + Models/Core/UnitCube.mesh + + false + + + + + + + + + + + Insert name here + Fonts/DroidSans.ttf,100 + + + + + + + + + + + + + + Textures/Icons/Arrow.png + + false + + + + + 50 + true + + + + + + + + + + + + Schema/Entities/DefenderShield.xml + + + + + + + + + + diff --git a/resources/Schema/Entities/PlayerDefenderBlue.xml b/resources/Schema/Entities/PlayerDefenderBlue.xml index aef660a3..c3bfc074 100644 --- a/resources/Schema/Entities/PlayerDefenderBlue.xml +++ b/resources/Schema/Entities/PlayerDefenderBlue.xml @@ -1,31 +1,38 @@ - + - - + - - - - + + 4 + 52 + + + + 150 + 150 + + - + + true 5 - + + @@ -38,6 +45,7 @@ + @@ -213,7 +221,7 @@ - 100/100 + 150/150 Fonts/DroidSans.ttf,64 @@ -422,6 +430,7 @@ Fonts/DroidSans.ttf,64 + @@ -485,12 +494,10 @@ - - BlendTreeAssaultWeapon - BlendTreeSecondaryWeapon - 0 - true - + + MovementBlend + FinalBlend + Models/Characters/Defender/FirstPersonDefenderBlue.mesh @@ -501,7 +508,6 @@ R_Arm_Weapon_Joint - true DefenderWeapon @@ -510,9 +516,8 @@ Schema/Entities/WeaponDefenderBlueView.xml - - - + + @@ -529,38 +534,39 @@ Schema/Entities/SidearmWeaponView.xml - - + + - + - Idle - WeaponAction + BlendTreeDefenderWeapon + BlendTreeSecondaryWeapon 0 true - + - Fire - Reload - 1 + ActionBlend + Shield + 0 + true - + - ShootShotgunF - + ActivateDeactiveShieldF + 1 false @@ -568,39 +574,112 @@ - + - - ReloadSwitchF - - 1 - true - + + Idle + ActionBlend2 + 0 + true + - + + + + + IdleF + + + + + + + + + Fire + Reload + 0 + + + + + + + + ShootShotgunF + + 1 + false + + + + + + + + + ShotgunReloadTwoF + + 1 + false + + + + + + + + - + - - IdleF - - 1 - true - - + + + Idle + Run + 0 + true + - + + + + + RunF + + 1 + true + true + + + + + + + + + IdleF + + 1 + true + true + + + + + + @@ -632,9 +711,8 @@ - Models/Characters/Assault/AssaultBlue.mesh - - false + Models/Characters/Defender/DefenderBlue.mesh + @@ -651,11 +729,11 @@ - Schema/Entities/WeaponAssaultBlueWorld.xml + Schema/Entities/WeaponDefenderBlueWorld.xml - - + + @@ -675,8 +753,8 @@ Schema/Entities/SidearmWeaponWorld.xml - - + + @@ -779,11 +857,11 @@ - + - CrouchStrafeLeftF - + CrouchStrafeRightF + 1 true @@ -791,11 +869,11 @@ - + - CrouchStrafeRightF - + CrouchStrafeLeftF + 1 true @@ -809,7 +887,7 @@ CrouchWalkF - + 1 true @@ -852,42 +930,6 @@ - - - - Walk - Run - 1.2938206818383024e-24 - - - - - - - - WalkF - - 1 - true - - - - - - - - - RunF - - 1 - true - - - - - - - @@ -902,7 +944,7 @@ StrafeRightF - + 1 true @@ -914,7 +956,43 @@ StrafeLeftF - + + 1 + true + + + + + + + + + + + Walk + Run + 1.2938206818383024e-24 + + + + + + + + WalkF + + 1 + true + + + + + + + + + RunF + 1 true @@ -930,7 +1008,7 @@ IdleF - + 1 true @@ -1099,7 +1177,7 @@ IdleAssaultRifleU - + 1 true @@ -1111,7 +1189,7 @@ IdleSecWepU - + 1 true @@ -1159,6 +1237,50 @@ + + + + + + + + + + + Deploy + Idle + 0 + + + Models/Characters/Defender/DefenderShield.mesh + + + + + + + + ActivateDeactiveShieldF + 1 + + + + + + + + + ShieldFrontF + 1 + + + + + + + + + @@ -1191,7 +1313,7 @@ - Insert name here + Fonts/DroidSans.ttf,100 diff --git a/resources/Schema/Entities/WeaponDefenderBlueView.xml b/resources/Schema/Entities/WeaponDefenderBlueView.xml index 6ec4b452..24b18f68 100644 --- a/resources/Schema/Entities/WeaponDefenderBlueView.xml +++ b/resources/Schema/Entities/WeaponDefenderBlueView.xml @@ -3,11 +3,9 @@ - Models/Weapons/Blue/DefenderGunBlue.mesh + Models/Weapons/Blue/DefenderWeaponBlue.mesh - - - + @@ -34,7 +32,7 @@ - + diff --git a/resources/Schema/Entities/WeaponDefenderBlueWorld.xml b/resources/Schema/Entities/WeaponDefenderBlueWorld.xml index 826301b4..6c750964 100644 --- a/resources/Schema/Entities/WeaponDefenderBlueWorld.xml +++ b/resources/Schema/Entities/WeaponDefenderBlueWorld.xml @@ -2,17 +2,10 @@ - - R_Arm_Weapon_Joint - - - Models/Weapons/Blue/DefenderGunBlue.mesh + Models/Weapons/Blue/DefenderWeaponBlue.mesh - - - - + diff --git a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp index cdb0a563..0fd987ae 100644 --- a/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/AssaultWeaponBehaviour.cpp @@ -39,6 +39,8 @@ void AssaultWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& ammo = glm::max(0, ammo - (magSize - magAmmo)); magAmmo = glm::min(magSize, ammo); isReloading = false; + wi.FirstPersonEntity["Model"]["Visible"] = true; + wi.ThirdPersonEntity["Model"]["Visible"] = true; } // Restore view angle @@ -57,19 +59,18 @@ void AssaultWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& } // Update first person run animation - /*ComponentWrapper cPlayer = wi.Player["Player"]; + ComponentWrapper cPlayer = wi.Player["Player"]; ComponentWrapper cPhysics = wi.Player["Physics"]; const float& movementSpeed = cPlayer["MovementSpeed"]; float speed = glm::length((const glm::vec3&)cPhysics["Velocity"]); - float animationSpeed = glm::max(speed, movementSpeed) / movementSpeed; + float animationWeight = glm::min(speed, movementSpeed) / movementSpeed; EntityWrapper rootNode = wi.FirstPersonEntity.FirstParentWithComponent("Model"); if (rootNode.Valid()) { - EntityWrapper animationNode = rootNode.FirstChildByName("Run"); - if (animationNode.Valid()) { - (bool&)animationNode["Animation"]["Play"] = animationSpeed > 0; - (double&)animationNode["Animation"]["Speed"] = animationSpeed; + EntityWrapper blend = rootNode.FirstChildByName("MovementBlend"); + if (blend.Valid()) { + (double&)blend["Blend"]["Weight"] = animationWeight; } - }*/ + } // Fire if we're able to fire if (canFire(cWeapon, wi)) { @@ -122,6 +123,8 @@ void AssaultWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) EntityWrapper reloadEffectSpawner = wi.FirstPersonEntity.FirstChildByName("FirstPersonReloadSpawner"); if (reloadEffectSpawner.Valid()) { SpawnerSystem::Spawn(reloadEffectSpawner, reloadEffectSpawner); + wi.FirstPersonEntity["Model"]["Visible"] = false; + wi.ThirdPersonEntity["Model"]["Visible"] = false; } } diff --git a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp index 3a4ed3a4..2d6ab74b 100644 --- a/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp +++ b/src/Game/Systems/Weapon/DefenderWeaponBehaviour.cpp @@ -36,6 +36,7 @@ void DefenderWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& m_EventBroker->Publish(e); } else { isReloading = false; + playAnimationAndReturn(wi.FirstPersonEntity, "FinalBlend", "Idle"); } } @@ -96,6 +97,9 @@ void DefenderWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi) // Start reload isReloading = true; reloadTimer = reloadTime; + + // Play animation + playAnimationAndReturn(wi.FirstPersonEntity, "FinalBlend", "Reload"); } void DefenderWeaponBehaviour::OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi) @@ -115,8 +119,40 @@ bool DefenderWeaponBehaviour::OnInputCommand(ComponentWrapper cWeapon, WeaponInf if (attachment.Valid()) { if (e.Value > 0) { SpawnerSystem::Spawn(attachment, attachment); + + EntityWrapper root = wi.FirstPersonEntity.FirstParentWithComponent("Model"); + if (root.Valid()) { + EntityWrapper subTree = root.FirstChildByName("FinalBlend"); + if (subTree.Valid()) { + EntityWrapper animationNode = subTree.FirstChildByName("Shield"); + if (animationNode.Valid()) { + Events::AutoAnimationBlend eFireBlend; + eFireBlend.RootNode = root; + eFireBlend.NodeName = "Shield"; + eFireBlend.Restart = true; + eFireBlend.Start = true; + m_EventBroker->Publish(eFireBlend); + } + } + } } else { attachment.DeleteChildren(); + + EntityWrapper root = wi.FirstPersonEntity.FirstParentWithComponent("Model"); + if (root.Valid()) { + EntityWrapper subTree = root.FirstChildByName("FinalBlend"); + if (subTree.Valid()) { + EntityWrapper animationNode = subTree.FirstChildByName("ActionBlend"); + if (animationNode.Valid()) { + Events::AutoAnimationBlend eFireBlend; + eFireBlend.RootNode = root; + eFireBlend.NodeName = "ActionBlend"; + eFireBlend.Restart = true; + eFireBlend.Start = true; + m_EventBroker->Publish(eFireBlend); + } + } + } } } } @@ -195,6 +231,9 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi } } + // Play animation + playAnimationAndReturn(wi.FirstPersonEntity, "BlendTreeDefenderWeapon", "Fire"); + // Sound Events::PlaySoundOnEntity e; e.EmitterID = wi.Player.ID;