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

This commit is contained in:
Tleety
2016-03-12 17:04:00 +01:00
12 changed files with 182 additions and 209 deletions
@@ -163,6 +163,7 @@ bool FirstPersonInputController<EventContext>::OnCommand(const Events::InputComm
aeb.Duration = 0.1; aeb.Duration = 0.1;
aeb.NodeName = "Run"; aeb.NodeName = "Run";
aeb.RootNode = firstPersonModel; aeb.RootNode = firstPersonModel;
aeb.SingleLevelBlend = true;
aeb.Start = true; aeb.Start = true;
m_EventBroker->Publish(aeb); m_EventBroker->Publish(aeb);
} }
@@ -172,6 +173,7 @@ bool FirstPersonInputController<EventContext>::OnCommand(const Events::InputComm
aeb.Duration = 0.1; aeb.Duration = 0.1;
aeb.NodeName = "Run"; aeb.NodeName = "Run";
aeb.RootNode = firstPersonModel; aeb.RootNode = firstPersonModel;
aeb.SingleLevelBlend = true;
aeb.Start = true; aeb.Start = true;
aeb.Reverse = true; aeb.Reverse = true;
m_EventBroker->Publish(aeb); m_EventBroker->Publish(aeb);
@@ -211,10 +213,10 @@ bool FirstPersonInputController<EventContext>::OnCommand(const Events::InputComm
} }
} }
//Animation if (m_PlayerEntity.Valid()) {
if (glm::length2(m_Movement) < 0.25f) { glm::vec2 movementXZ = glm::vec2(m_Movement.x, m_Movement.z);
//Blend to Idle if (glm::length(movementXZ) < 0.1f) {
if (m_PlayerEntity.Valid()) { //Blend to Idle
EntityWrapper playerModel = m_PlayerEntity.FirstChildByName("PlayerModel"); EntityWrapper playerModel = m_PlayerEntity.FirstChildByName("PlayerModel");
if (playerModel.Valid()) { if (playerModel.Valid()) {
Events::AutoAnimationBlend aeb; Events::AutoAnimationBlend aeb;
@@ -233,10 +235,8 @@ bool FirstPersonInputController<EventContext>::OnCommand(const Events::InputComm
aeb.Start = true; aeb.Start = true;
m_EventBroker->Publish(aeb); m_EventBroker->Publish(aeb);
} }
} } else {
} else { //Blend to movement
//Blend to movement
if (m_PlayerEntity.Valid()) {
EntityWrapper playerModel = m_PlayerEntity.FirstChildByName("PlayerModel"); EntityWrapper playerModel = m_PlayerEntity.FirstChildByName("PlayerModel");
if (playerModel.Valid()) { if (playerModel.Valid()) {
Events::AutoAnimationBlend aeb; Events::AutoAnimationBlend aeb;
@@ -248,8 +248,7 @@ bool FirstPersonInputController<EventContext>::OnCommand(const Events::InputComm
} }
} }
if (glm::length(m_Movement) > 0) {
if (glm::length2(m_Movement) > 0) {
m_Movement = glm::normalize(m_Movement); m_Movement = glm::normalize(m_Movement);
//Animation //Animation
+1 -2
View File
@@ -49,9 +49,7 @@ public:
next = next->Child[0]; next = next->Child[0];
} }
} }
return next; return next;
} }
}; };
@@ -82,6 +80,7 @@ public:
BlendTree::Node* FirstCommonParent(Node* node1, Node* node2); BlendTree::Node* FirstCommonParent(Node* node1, Node* node2);
EntityWrapper GetSubTreeRoot(std::string nodeName); EntityWrapper GetSubTreeRoot(std::string nodeName);
std::vector<EntityWrapper> GetSubTreeRoots(std::string nodeName);
std::vector<EntityWrapper> GetSingleLevelRoots(std::string name); std::vector<EntityWrapper> GetSingleLevelRoots(std::string name);
std::vector<EntityWrapper> GetEntitesByName(std::string name); std::vector<EntityWrapper> GetEntitesByName(std::string name);
+3
View File
@@ -6,6 +6,7 @@
#include "Core/EntityFile.h" #include "Core/EntityFile.h"
#include "Core/EPlayerDamage.h" #include "Core/EPlayerDamage.h"
#include "Common.h" #include "Common.h"
#include "SpawnerSystem.h"
class BoostSystem : public System class BoostSystem : public System
{ {
@@ -17,5 +18,7 @@ private:
bool OnPlayerDamage(Events::PlayerDamage& e); bool OnPlayerDamage(Events::PlayerDamage& e);
std::string DetermineClass(EntityWrapper player); std::string DetermineClass(EntityWrapper player);
void giveAmmo(EntityWrapper giver, EntityWrapper receiver);
}; };
#endif #endif
@@ -37,7 +37,7 @@ private:
bool playerInFirstPerson(EntityWrapper player); bool playerInFirstPerson(EntityWrapper player);
bool dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi); bool dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi);
void giveAmmo(ComponentWrapper cWeapon, WeaponInfo& wi, EntityWrapper receiver); // void giveAmmo(ComponentWrapper cWeapon, WeaponInfo& wi, EntityWrapper receiver);
void CheckAmmo(ComponentWrapper cWeapon, WeaponInfo& wi); void CheckAmmo(ComponentWrapper cWeapon, WeaponInfo& wi);
@@ -305,6 +305,8 @@ private:
wi.ThirdPersonEntity = thirdPersonWeapon; wi.ThirdPersonEntity = thirdPersonWeapon;
wi.ThirdPersonPlayerModel = thirdPersonWeapon.FirstParentWithComponent("Model"); wi.ThirdPersonPlayerModel = thirdPersonWeapon.FirstParentWithComponent("Model");
player["Player"]["CurrentWeapon"] = cWeapon.Info.Name;
OnEquip(cWeapon, wi); OnEquip(cWeapon, wi);
} }
+39 -86
View File
@@ -57,7 +57,7 @@
</Components> </Components>
<Children/> <Children/>
</Entity> </Entity>
<Entity name="HUDSpawner"> <Entity name="HUD">
<Components> <Components>
<c:Spawner> <c:Spawner>
<EntityFile>Schema/Entities/PlayerHUD.xml</EntityFile> <EntityFile>Schema/Entities/PlayerHUD.xml</EntityFile>
@@ -373,7 +373,7 @@
</c:Model> </c:Model>
<c:Transform> <c:Transform>
<Position X="0" Y="0.198665127" Z="0"/> <Position X="0" Y="0.198665127" Z="0"/>
<Orientation X="-0.031580139" Y="-2.13055706" Z="0"/> <Orientation X="0.0531693883" Y="-2.13055706" Z="0"/>
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/> <Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
</c:Transform> </c:Transform>
</Components> </Components>
@@ -589,7 +589,6 @@
<c:HiddenForLocalPlayer/> <c:HiddenForLocalPlayer/>
<c:Model> <c:Model>
<Resource>Models/Characters/Assault/AssaultBlue.mesh</Resource> <Resource>Models/Characters/Assault/AssaultBlue.mesh</Resource>
<Visible>false</Visible>
</c:Model> </c:Model>
<c:Transform/> <c:Transform/>
</Components> </Components>
@@ -603,8 +602,8 @@
<EntityFile>Schema/Entities/WeaponAssaultBlueWorld.xml</EntityFile> <EntityFile>Schema/Entities/WeaponAssaultBlueWorld.xml</EntityFile>
</c:Spawner> </c:Spawner>
<c:Transform> <c:Transform>
<Position X="0.108882263" Y="1.09243619" Z="-0.367516935"/> <Position X="0.128669813" Y="1.08486295" Z="-0.361068189"/>
<Orientation X="-0.0281659421" Y="-0.0316450335" Z="0.132674664"/> <Orientation X="-0.0353792347" Y="-0.0854677409" Z="0.133094937"/>
</c:Transform> </c:Transform>
<c:WeaponAttachment> <c:WeaponAttachment>
<Weapon>AssaultWeapon</Weapon> <Weapon>AssaultWeapon</Weapon>
@@ -624,8 +623,8 @@
<EntityFile>Schema/Entities/SidearmWeaponBlueWorld.xml</EntityFile> <EntityFile>Schema/Entities/SidearmWeaponBlueWorld.xml</EntityFile>
</c:Spawner> </c:Spawner>
<c:Transform> <c:Transform>
<Position X="0.108882263" Y="1.09243619" Z="-0.367516935"/> <Position X="0.128669813" Y="1.08486295" Z="-0.361068189"/>
<Orientation X="-0.0281659421" Y="-0.0316450335" Z="0.132674664"/> <Orientation X="-0.0353792347" Y="-0.0854677409" Z="0.133094937"/>
</c:Transform> </c:Transform>
<c:WeaponAttachment> <c:WeaponAttachment>
<Weapon>SidearmWeapon</Weapon> <Weapon>SidearmWeapon</Weapon>
@@ -692,7 +691,7 @@
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName>CrouchStrafeLeftF</AnimationName> <AnimationName>CrouchStrafeLeftF</AnimationName>
<Time>0.47751323206761143</Time> <Time>0.14513013667773755</Time>
<Play>true</Play> <Play>true</Play>
</c:Animation> </c:Animation>
<c:Transform/> <c:Transform/>
@@ -703,7 +702,7 @@
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName>CrouchStrafeRightF</AnimationName> <AnimationName>CrouchStrafeRightF</AnimationName>
<Time>0.021962400161406492</Time> <Time>0.072451598628520131</Time>
<Play>true</Play> <Play>true</Play>
</c:Animation> </c:Animation>
<c:Transform/> <c:Transform/>
@@ -716,7 +715,7 @@
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName>CrouchWalkF</AnimationName> <AnimationName>CrouchWalkF</AnimationName>
<Time>0.80033638533880946</Time> <Time>0.8508255838059231</Time>
<Play>true</Play> <Play>true</Play>
</c:Animation> </c:Animation>
<c:Transform/> <c:Transform/>
@@ -729,7 +728,7 @@
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName>CrouchF</AnimationName> <AnimationName>CrouchF</AnimationName>
<Time>1.4735638822855002</Time> <Time>1.5240530807526143</Time>
<Play>true</Play> <Play>true</Play>
</c:Animation> </c:Animation>
<c:Transform/> <c:Transform/>
@@ -772,7 +771,7 @@
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName>WalkF</AnimationName> <AnimationName>WalkF</AnimationName>
<Time>0.4721928801537274</Time> <Time>0.35598021321569639</Time>
<Play>true</Play> <Play>true</Play>
</c:Animation> </c:Animation>
<c:Transform/> <c:Transform/>
@@ -783,7 +782,7 @@
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName>RunF</AnimationName> <AnimationName>RunF</AnimationName>
<Time>0.54088538957005738</Time> <Time>0.3084600556940007</Time>
<Speed>2</Speed> <Speed>2</Speed>
<Play>true</Play> <Play>true</Play>
</c:Animation> </c:Animation>
@@ -807,7 +806,7 @@
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName>StrafeLeftF</AnimationName> <AnimationName>StrafeLeftF</AnimationName>
<Time>0.1435940249715344</Time> <Time>0.91116869109547771</Time>
<Speed>2</Speed> <Speed>2</Speed>
<Play>true</Play> <Play>true</Play>
</c:Animation> </c:Animation>
@@ -819,7 +818,7 @@
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName>StrafeRightF</AnimationName> <AnimationName>StrafeRightF</AnimationName>
<Time>0.22100503380750069</Time> <Time>0.98857969993144401</Time>
<Speed>2</Speed> <Speed>2</Speed>
<Play>true</Play> <Play>true</Play>
</c:Animation> </c:Animation>
@@ -835,7 +834,7 @@
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName>IdleF</AnimationName> <AnimationName>IdleF</AnimationName>
<Time>0.054403308784401361</Time> <Time>0.85485929533452953</Time>
<Play>true</Play> <Play>true</Play>
</c:Animation> </c:Animation>
<c:Transform/> <c:Transform/>
@@ -924,10 +923,10 @@
<c:Transform/> <c:Transform/>
</Components> </Components>
<Children> <Children>
<Entity name="DashRight"> <Entity name="DashLeft">
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName>DashRightF</AnimationName> <AnimationName>DashLeftF</AnimationName>
<Time>1</Time> <Time>1</Time>
<Speed>1.7999999523162842</Speed> <Speed>1.7999999523162842</Speed>
<Loop>false</Loop> <Loop>false</Loop>
@@ -936,10 +935,10 @@
</Components> </Components>
<Children/> <Children/>
</Entity> </Entity>
<Entity name="DashLeft"> <Entity name="DashRight">
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName>DashLeftF</AnimationName> <AnimationName>DashRightF</AnimationName>
<Time>1</Time> <Time>1</Time>
<Speed>1.7999999523162842</Speed> <Speed>1.7999999523162842</Speed>
<Loop>false</Loop> <Loop>false</Loop>
@@ -979,7 +978,7 @@
<Entity name="WeaponBlend"> <Entity name="WeaponBlend">
<Components> <Components>
<c:BlendAdditive> <c:BlendAdditive>
<Adder>MovementBlend</Adder> <Adder>IdleAssault</Adder>
<Receiver>ActionBlend</Receiver> <Receiver>ActionBlend</Receiver>
</c:BlendAdditive> </c:BlendAdditive>
<c:Transform/> <c:Transform/>
@@ -1018,41 +1017,17 @@
</Entity> </Entity>
</Children> </Children>
</Entity> </Entity>
<Entity name="MovementBlend2"> <Entity name="IdleAssault">
<Components> <Components>
<c:Blend> <c:Animation>
<Pose1>Idle</Pose1> <AnimationName>IdleAssaultRifleU</AnimationName>
<Pose2>Run</Pose2> <Time>1.9871198993639698</Time>
<Weight>0</Weight> <Play>true</Play>
</c:Blend> <Additive>true</Additive>
</c:Animation>
<c:Transform/> <c:Transform/>
</Components> </Components>
<Children> <Children/>
<Entity name="Run">
<Components>
<c:Animation>
<AnimationName>IdleAssaultRifleU</AnimationName>
<Time>1.1033325663020008</Time>
<Play>true</Play>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Idle">
<Components>
<c:Animation>
<AnimationName>IdleAssaultRifleU</AnimationName>
<Time>1.1033325663020008</Time>
<Play>true</Play>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity> </Entity>
</Children> </Children>
</Entity> </Entity>
@@ -1083,44 +1058,12 @@
<Entity name="WeaponBlend"> <Entity name="WeaponBlend">
<Components> <Components>
<c:BlendAdditive> <c:BlendAdditive>
<Adder>MovementBlend2</Adder> <Adder>IdleSidearm</Adder>
<Receiver>ActionBlend</Receiver> <Receiver>ActionBlend</Receiver>
</c:BlendAdditive> </c:BlendAdditive>
<c:Transform/> <c:Transform/>
</Components> </Components>
<Children> <Children>
<Entity name="MovementBlend2">
<Components>
<c:Blend>
<Pose1>Idle</Pose1>
<Pose2>Run</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Idle">
<Components>
<c:Animation>
<AnimationName>IdleSecWepU</AnimationName>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Run">
<Components>
<c:Animation>
<AnimationName>IdleSecWepU</AnimationName>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="ActionBlend"> <Entity name="ActionBlend">
<Components> <Components>
<c:Blend> <c:Blend>
@@ -1153,6 +1096,16 @@
</Entity> </Entity>
</Children> </Children>
</Entity> </Entity>
<Entity name="IdleSidearm">
<Components>
<c:Animation>
<AnimationName>IdleSecWepU</AnimationName>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children> </Children>
</Entity> </Entity>
<Entity name="Aim"> <Entity name="Aim">
@@ -30,7 +30,6 @@
<CurrentWeapon></CurrentWeapon> <CurrentWeapon></CurrentWeapon>
</c:Player> </c:Player>
<c:Transform> <c:Transform>
<Position X="0" Y="0.221111551" Z="0"/>
<Orientation X="0" Y="-0" Z="0"/> <Orientation X="0" Y="-0" Z="0"/>
</c:Transform> </c:Transform>
</Components> </Components>
@@ -91,7 +90,7 @@
</Entity> </Entity>
</Children> </Children>
</Entity> </Entity>
<Entity name="HUDSpawner"> <Entity name="HUD">
<Components> <Components>
<c:Spawner> <c:Spawner>
<EntityFile>Schema/Entities/PlayerHUD.xml</EntityFile> <EntityFile>Schema/Entities/PlayerHUD.xml</EntityFile>
@@ -407,7 +406,7 @@
</c:Model> </c:Model>
<c:Transform> <c:Transform>
<Position X="0" Y="0.198665127" Z="0"/> <Position X="0" Y="0.198665127" Z="0"/>
<Orientation X="-0.0462424681" Y="-2.13055706" Z="0"/> <Orientation X="0.0531693883" Y="-2.13055706" Z="0"/>
<Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/> <Scale X="0.0500000007" Y="0.0500000007" Z="0.0500000007"/>
</c:Transform> </c:Transform>
</Components> </Components>
@@ -592,7 +591,6 @@
<c:Shielded/> <c:Shielded/>
<c:HiddenForLocalPlayer/> <c:HiddenForLocalPlayer/>
<c:Model> <c:Model>
<GlowIntensity>1.7999999523162842</GlowIntensity>
<Resource>Models/Characters/Defender/DefenderBlue.mesh</Resource> <Resource>Models/Characters/Defender/DefenderBlue.mesh</Resource>
</c:Model> </c:Model>
<c:Transform/> <c:Transform/>
@@ -607,8 +605,8 @@
<EntityFile>Schema/Entities/WeaponDefenderBlueWorld.xml</EntityFile> <EntityFile>Schema/Entities/WeaponDefenderBlueWorld.xml</EntityFile>
</c:Spawner> </c:Spawner>
<c:Transform> <c:Transform>
<Position X="0.159374163" Y="1.04528129" Z="-0.296122819"/> <Position X="0.160437703" Y="1.04422736" Z="-0.295565188"/>
<Orientation X="-0.104885302" Y="-0.0685810521" Z="0.143936574"/> <Orientation X="-0.105441377" Y="-0.0721141845" Z="0.143959135"/>
</c:Transform> </c:Transform>
<c:WeaponAttachment> <c:WeaponAttachment>
<Weapon>DefenderWeapon</Weapon> <Weapon>DefenderWeapon</Weapon>
@@ -628,8 +626,8 @@
<EntityFile>Schema/Entities/SidearmWeaponBlueWorld.xml</EntityFile> <EntityFile>Schema/Entities/SidearmWeaponBlueWorld.xml</EntityFile>
</c:Spawner> </c:Spawner>
<c:Transform> <c:Transform>
<Position X="0.159374163" Y="1.04528129" Z="-0.296122819"/> <Position X="0.160437703" Y="1.04422736" Z="-0.295565188"/>
<Orientation X="-0.104885302" Y="-0.0685810521" Z="0.143936574"/> <Orientation X="-0.105441377" Y="-0.0721141845" Z="0.143959135"/>
</c:Transform> </c:Transform>
<c:WeaponAttachment> <c:WeaponAttachment>
<Weapon>SidearmWeapon</Weapon> <Weapon>SidearmWeapon</Weapon>
@@ -696,7 +694,7 @@
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName>CrouchStrafeLeftF</AnimationName> <AnimationName>CrouchStrafeLeftF</AnimationName>
<Time>0.94903533204833757</Time> <Time>0.89884525886057709</Time>
<Play>true</Play> <Play>true</Play>
</c:Animation> </c:Animation>
<c:Transform/> <c:Transform/>
@@ -707,7 +705,7 @@
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName>CrouchStrafeRightF</AnimationName> <AnimationName>CrouchStrafeRightF</AnimationName>
<Time>0.7265272838887622</Time> <Time>0.82616672081135967</Time>
<Play>true</Play> <Play>true</Play>
</c:Animation> </c:Animation>
<c:Transform/> <c:Transform/>
@@ -720,7 +718,7 @@
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName>CrouchWalkF</AnimationName> <AnimationName>CrouchWalkF</AnimationName>
<Time>0.40505409558886285</Time> <Time>0.60454070598876264</Time>
<Play>true</Play> <Play>true</Play>
</c:Animation> </c:Animation>
<c:Transform/> <c:Transform/>
@@ -733,7 +731,7 @@
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName>CrouchF</AnimationName> <AnimationName>CrouchF</AnimationName>
<Time>1.0782815925355536</Time> <Time>0.27776820293545335</Time>
<Play>true</Play> <Play>true</Play>
</c:Animation> </c:Animation>
<c:Transform/> <c:Transform/>
@@ -776,7 +774,7 @@
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName>WalkF</AnimationName> <AnimationName>WalkF</AnimationName>
<Time>0.91020872499863614</Time> <Time>0.10969533539853593</Time>
<Play>true</Play> <Play>true</Play>
</c:Animation> </c:Animation>
<c:Transform/> <c:Transform/>
@@ -787,7 +785,7 @@
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName>RunF</AnimationName> <AnimationName>RunF</AnimationName>
<Time>0.4169170792598802</Time> <Time>0.81589030005967977</Time>
<Speed>2</Speed> <Speed>2</Speed>
<Play>true</Play> <Play>true</Play>
</c:Animation> </c:Animation>
@@ -811,7 +809,7 @@
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName>StrafeLeftF</AnimationName> <AnimationName>StrafeLeftF</AnimationName>
<Time>0.019625714661357208</Time> <Time>0.41859893546115678</Time>
<Speed>2</Speed> <Speed>2</Speed>
<Play>true</Play> <Play>true</Play>
</c:Animation> </c:Animation>
@@ -823,7 +821,7 @@
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName>StrafeRightF</AnimationName> <AnimationName>StrafeRightF</AnimationName>
<Time>0.097036723497323507</Time> <Time>0.49600994429712308</Time>
<Speed>2</Speed> <Speed>2</Speed>
<Play>true</Play> <Play>true</Play>
</c:Animation> </c:Animation>
@@ -839,7 +837,7 @@
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName>IdleF</AnimationName> <AnimationName>IdleF</AnimationName>
<Time>0.70908179896927592</Time> <Time>1.1919024261691025</Time>
<Play>true</Play> <Play>true</Play>
</c:Animation> </c:Animation>
<c:Transform/> <c:Transform/>
@@ -886,48 +884,12 @@
<Entity name="WeaponBlend"> <Entity name="WeaponBlend">
<Components> <Components>
<c:BlendAdditive> <c:BlendAdditive>
<Adder>MovementBlend2</Adder> <Adder>IdleDefender</Adder>
<Receiver>FinalBlend</Receiver> <Receiver>FinalBlend</Receiver>
</c:BlendAdditive> </c:BlendAdditive>
<c:Transform/> <c:Transform/>
</Components> </Components>
<Children> <Children>
<Entity name="MovementBlend2">
<Components>
<c:Blend>
<Pose1>Idle</Pose1>
<Pose2>Run</Pose2>
<Weight>0</Weight>
</c:Blend>
<c:Transform/>
</Components>
<Children>
<Entity name="Run">
<Components>
<c:Animation>
<AnimationName>IdleAssaultRifleU</AnimationName>
<Time>1.5413484111469096</Time>
<Play>true</Play>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Idle">
<Components>
<c:Animation>
<AnimationName>IdleAssaultRifleU</AnimationName>
<Time>1.5413484111469096</Time>
<Play>true</Play>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="FinalBlend"> <Entity name="FinalBlend">
<Components> <Components>
<c:Blend> <c:Blend>
@@ -998,7 +960,7 @@
<Components> <Components>
<c:Animation> <c:Animation>
<AnimationName>ShieldFrontU</AnimationName> <AnimationName>ShieldFrontU</AnimationName>
<Time>0.22021105203482882</Time> <Time>0.41969766243472861</Time>
<Play>true</Play> <Play>true</Play>
</c:Animation> </c:Animation>
<c:Transform/> <c:Transform/>
@@ -1009,6 +971,18 @@
</Entity> </Entity>
</Children> </Children>
</Entity> </Entity>
<Entity name="IdleDefender">
<Components>
<c:Animation>
<AnimationName>IdleAssaultRifleU</AnimationName>
<Time>0.74083502154680936</Time>
<Play>true</Play>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children> </Children>
</Entity> </Entity>
<Entity name="Aim"> <Entity name="Aim">
@@ -1036,7 +1010,7 @@
<Entity name="WeaponBlend"> <Entity name="WeaponBlend">
<Components> <Components>
<c:BlendAdditive> <c:BlendAdditive>
<Adder>MovementBlend2</Adder> <Adder>IdleSidearm</Adder>
<Receiver>ActionBlend</Receiver> <Receiver>ActionBlend</Receiver>
</c:BlendAdditive> </c:BlendAdditive>
<c:Transform/> <c:Transform/>
@@ -1073,36 +1047,15 @@
</Entity> </Entity>
</Children> </Children>
</Entity> </Entity>
<Entity name="MovementBlend2"> <Entity name="IdleSidearm">
<Components> <Components>
<c:Blend> <c:Animation>
<Pose1>Idle</Pose1> <AnimationName>IdleSecWepU</AnimationName>
<Pose2>Run</Pose2> <Additive>true</Additive>
</c:Blend> </c:Animation>
<c:Transform/> <c:Transform/>
</Components> </Components>
<Children> <Children/>
<Entity name="Idle">
<Components>
<c:Animation>
<AnimationName>IdleSecWepU</AnimationName>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
<Entity name="Run">
<Components>
<c:Animation>
<AnimationName>IdleSecWepU</AnimationName>
<Additive>true</Additive>
</c:Animation>
<c:Transform/>
</Components>
<Children/>
</Entity>
</Children>
</Entity> </Entity>
</Children> </Children>
</Entity> </Entity>
+9 -3
View File
@@ -127,8 +127,8 @@ void AnimationSystem::UpdateAnimations(double dt)
void AnimationSystem::UpdateWeights(double dt) void AnimationSystem::UpdateWeights(double dt)
{ {
for (auto it = m_AutoBlendQueues.begin(); it != m_AutoBlendQueues.end(); ) { for (auto it = m_AutoBlendQueues.begin(); it != m_AutoBlendQueues.end(); ) {
/* LOG_INFO("%s", it->first.Name().c_str()); //LOG_INFO("%s", it->first.Name().c_str());
it->second.PrintQueue();*/ //it->second.PrintQueue();
if(it->second.HasActiveBlendJob()) { if(it->second.HasActiveBlendJob()) {
AutoBlendQueue::AutoBlendJob& blendJob = it->second.GetActiveBlendJob(); AutoBlendQueue::AutoBlendJob& blendJob = it->second.GetActiveBlendJob();
@@ -158,12 +158,13 @@ void AnimationSystem::UpdateWeights(double dt)
bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e) bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e)
{ {
if (!e.RootNode.Valid()) { if (!e.RootNode.Valid()) {
LOG_ERROR("%s, RootNode invalid %s", e.NodeName, e.RootNode.Name().c_str());
return false; return false;
} }
if (!e.RootNode.HasComponent("Model")) { if (!e.RootNode.HasComponent("Model")) {
LOG_ERROR("%s, RootNode has no model %s", e.NodeName, e.RootNode.Name().c_str());
return false; return false;
} }
@@ -171,11 +172,13 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e)
try { try {
model = ResourceManager::Load<::Model, true>((std::string)e.RootNode["Model"]["Resource"]); model = ResourceManager::Load<::Model, true>((std::string)e.RootNode["Model"]["Resource"]);
} catch (const std::exception&) { } catch (const std::exception&) {
LOG_ERROR("%s, RootNode model not finished loading %s", e.NodeName, e.RootNode.Name().c_str());
return false; return false;
} }
Skeleton* skeleton = model->m_RawModel->m_Skeleton; Skeleton* skeleton = model->m_RawModel->m_Skeleton;
if (skeleton == nullptr) { if (skeleton == nullptr) {
LOG_ERROR("%s, RootNode skeleton invalid %s", e.NodeName, e.RootNode.Name().c_str());
return false; return false;
} }
@@ -183,6 +186,7 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e)
if (skeleton->BlendTrees.find(e.RootNode) != skeleton->BlendTrees.end()) { if (skeleton->BlendTrees.find(e.RootNode) != skeleton->BlendTrees.end()) {
blendTree = skeleton->BlendTrees.at(e.RootNode); blendTree = skeleton->BlendTrees.at(e.RootNode);
} else { } else {
LOG_ERROR("%s, No blendtree was found invalid %s", e.NodeName, e.RootNode.Name().c_str());
return false; return false;
} }
@@ -193,6 +197,7 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e)
subTreeRoot = blendTree->GetSubTreeRoot(e.NodeName); subTreeRoot = blendTree->GetSubTreeRoot(e.NodeName);
if (!subTreeRoot.Valid()) { if (!subTreeRoot.Valid()) {
LOG_ERROR("%s, subTreeRoot invalid", e.NodeName);
return false; return false;
} }
@@ -237,6 +242,7 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e)
subTreeRoot = entity; subTreeRoot = entity;
if (!subTreeRoot.Valid()) { if (!subTreeRoot.Valid()) {
LOG_ERROR("%s, subTreeRoot invalid", e.NodeName);
return false; return false;
} }
+75 -19
View File
@@ -35,19 +35,25 @@ bool BoostSystem::OnPlayerDamage(Events::PlayerDamage& e)
return false; return false;
} }
//get the XML file, example: "Schema/Entities/BoostclassName.xml"
std::string classXML = "Schema/Entities/" + className + ".xml";
//check if player already has a child with the component, if so delete that child LOG_INFO("intflictor: %s, vicitm: %s", e.Inflictor.Name().c_str(), e.Victim.Name().c_str());
auto playerBoostAssaultEntity = e.Victim.FirstChildByName(className); if(className == "SidearmWeapon") { // give ammo
if (playerBoostAssaultEntity.Valid()) { giveAmmo(e.Inflictor, e.Victim);
m_World->DeleteEntity(playerBoostAssaultEntity.ID); } else { //give boost
//get the XML file, example: "Schema/Entities/BoostclassName.xml"
std::string classXML = "Schema/Entities/" + className + ".xml";
//check if player already has a child with the component, if so delete that child
auto playerBoostAssaultEntity = e.Victim.FirstChildByName(className);
if (playerBoostAssaultEntity.Valid()) {
m_World->DeleteEntity(playerBoostAssaultEntity.ID);
}
//load boost XML file, set it entity parented with the victim player
auto entityFile = ResourceManager::Load<EntityFile>(classXML);
EntityWrapper boostAssaultEntity = entityFile->MergeInto(m_World);
m_World->SetName(boostAssaultEntity.ID, className);
m_World->SetParent(boostAssaultEntity.ID, e.Victim.ID);
} }
//load boost XML file, set it entity parented with the victim player
auto entityFile = ResourceManager::Load<EntityFile>(classXML);
EntityWrapper boostAssaultEntity = entityFile->MergeInto(m_World);
m_World->SetName(boostAssaultEntity.ID, className);
m_World->SetParent(boostAssaultEntity.ID, e.Victim.ID);
return true; return true;
} }
@@ -55,14 +61,64 @@ bool BoostSystem::OnPlayerDamage(Events::PlayerDamage& e)
std::string BoostSystem::DetermineClass(EntityWrapper inflictorPlayer) std::string BoostSystem::DetermineClass(EntityWrapper inflictorPlayer)
{ {
//determine the class based on what component the inflictor-player has //determine the class based on what component the inflictor-player has
if (m_World->HasComponent(inflictorPlayer.ID, "DashAbility")) { if (inflictorPlayer.HasComponent("Player")) {
return "BoostAssault"; if ((std::string)inflictorPlayer["Player"]["CurrentWeapon"] == "AssaultWeapon") {
} return "BoostAssault";
if (m_World->HasComponent(inflictorPlayer.ID, "ShieldAbility")) { }
return "BoostDefender"; if ((std::string)inflictorPlayer["Player"]["CurrentWeapon"] == "DefenderWeapon") {
} return "BoostDefender";
if (m_World->HasComponent(inflictorPlayer.ID, "SprintAbility")) { }
return "BoostSniper"; if ((std::string)inflictorPlayer["Player"]["CurrentWeapon"] == "SniperWeapon") {
return "BoostSniper";
}
if ((std::string)inflictorPlayer["Player"]["CurrentWeapon"] == "SidearmWeapon") {
return "SidearmWeapon";
}
} }
return ""; return "";
} }
void BoostSystem::giveAmmo(EntityWrapper giver, EntityWrapper receiver)
{
bool gaveAmmo = false;
if (receiver.HasComponent("AssaultWeapon")) {
int magazineSize = receiver["AssaultWeapon"]["MagazineSize"];
int& magazineAmmo = receiver["AssaultWeapon"]["MagazineAmmo"];
int maxAmmo = receiver["AssaultWeapon"]["MaxAmmo"];
int& ammo = receiver["AssaultWeapon"]["Ammo"];
if (magazineAmmo < magazineSize) {
magazineAmmo += 1;
gaveAmmo = true;
} else if (ammo < maxAmmo) {
ammo += 1;
gaveAmmo = true;
}
} else if (receiver.HasComponent("DefenderWeapon")) {
int magazineSize = receiver["DefenderWeapon"]["MagazineSize"];
int& magazineAmmo = receiver["DefenderWeapon"]["MagazineAmmo"];
int maxAmmo = receiver["DefenderWeapon"]["MaxAmmo"];
int& ammo = receiver["DefenderWeapon"]["Ammo"];
if (magazineAmmo < magazineSize) {
magazineAmmo += 1;
gaveAmmo = true;
} else if (ammo < maxAmmo) {
ammo += 1;
gaveAmmo = true;
}
}
if (gaveAmmo) {
EntityWrapper effectSpawner = giver.FirstChildByName("AmmoShareEffectSpawner");
if (effectSpawner.Valid()) {
if (effectSpawner.HasComponent("Spawner")) {
SpawnerSystem::Spawn(effectSpawner, effectSpawner);
}
}
}
}
@@ -24,6 +24,8 @@ void PlayerMovementSystem::Update(double dt)
if (LocalPlayer.Valid()){ if (LocalPlayer.Valid()){
updateVelocity(LocalPlayer, dt); updateVelocity(LocalPlayer, dt);
} }
m_SprintEffectTimer += dt; m_SprintEffectTimer += dt;
if (m_SprintEffectTimer < 0.016f) { if (m_SprintEffectTimer < 0.016f) {
return; return;
@@ -74,7 +74,7 @@ void AssaultWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo&
float animationWeight = glm::min(speed, movementSpeed) / movementSpeed; float animationWeight = glm::min(speed, movementSpeed) / movementSpeed;
EntityWrapper rootNode = wi.FirstPersonEntity; EntityWrapper rootNode = wi.FirstPersonEntity;
if (rootNode.Valid()) { if (rootNode.Valid()) {
EntityWrapper blend = rootNode.FirstChildByName("MovementBlend"); EntityWrapper blend = rootNode.FirstChildByName("MovementBlendAssault");
if (blend.Valid()) { if (blend.Valid()) {
(double&)blend["Blend"]["Weight"] = animationWeight; (double&)blend["Blend"]["Weight"] = animationWeight;
} }
@@ -14,7 +14,6 @@ void SidearmWeaponBehaviour::UpdateComponent(EntityWrapper& entity, ComponentWra
void SidearmWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt) void SidearmWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo& wi, double dt)
{ {
CheckAmmo(cWeapon, wi); CheckAmmo(cWeapon, wi);
// Start reloading automatically if at 0 mag ammo // Start reloading automatically if at 0 mag ammo
@@ -64,7 +63,7 @@ void SidearmWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo&
float animationWeight = glm::min(speed, movementSpeed) / movementSpeed; float animationWeight = glm::min(speed, movementSpeed) / movementSpeed;
EntityWrapper rootNode = wi.FirstPersonEntity; EntityWrapper rootNode = wi.FirstPersonEntity;
if (rootNode.Valid()) { if (rootNode.Valid()) {
EntityWrapper blend = rootNode.FirstChildByName("MovementBlend"); EntityWrapper blend = rootNode.FirstChildByName("MovementBlendSidearm");
if (blend.Valid()) { if (blend.Valid()) {
(double&)blend["Blend"]["Weight"] = animationWeight; (double&)blend["Blend"]["Weight"] = animationWeight;
} }
@@ -282,7 +281,7 @@ bool SidearmWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi
// If friendly fire, reduce damage to 0 (needed to make Boosts, Ammosharing work) // If friendly fire, reduce damage to 0 (needed to make Boosts, Ammosharing work)
if ((ComponentInfo::EnumType)victim["Team"]["Team"] == (ComponentInfo::EnumType)wi.Player["Team"]["Team"]) { if ((ComponentInfo::EnumType)victim["Team"]["Team"] == (ComponentInfo::EnumType)wi.Player["Team"]["Team"]) {
damage = 0; damage = 0;
giveAmmo(cWeapon, wi, victim); //giveAmmo(cWeapon, wi, victim);
} }
// Deal damage! // Deal damage!
@@ -294,6 +293,7 @@ bool SidearmWeaponBehaviour::dealDamage(ComponentWrapper cWeapon, WeaponInfo& wi
return damage > 0; return damage > 0;
} }
/*
void SidearmWeaponBehaviour::giveAmmo(ComponentWrapper cWeapon, WeaponInfo& wi, EntityWrapper receiver) void SidearmWeaponBehaviour::giveAmmo(ComponentWrapper cWeapon, WeaponInfo& wi, EntityWrapper receiver)
{ {
@@ -338,7 +338,7 @@ void SidearmWeaponBehaviour::giveAmmo(ComponentWrapper cWeapon, WeaponInfo& wi,
} }
} }
} }
} }*/
void SidearmWeaponBehaviour::CheckAmmo(ComponentWrapper cWeapon, WeaponInfo& wi) void SidearmWeaponBehaviour::CheckAmmo(ComponentWrapper cWeapon, WeaponInfo& wi)
{ {