Merge remote-tracking branch 'origin/master' into Dirtybit

# Conflicts:
#	src/Engine/Collision/CollisionSystem.cpp
#	src/Engine/Core/Transform.cpp
#	src/Engine/Editor/EditorSystem.cpp
#	src/Engine/Rendering/AnimationSystem.cpp
#	src/Engine/Rendering/BoneAttachmentSystem.cpp
#	src/Game/Systems/CapturePointSystem.cpp
#	src/Game/Systems/ExplosionEffectSystem.cpp
#	src/Game/Systems/PlayerMovementSystem.cpp
This commit is contained in:
2016-03-12 03:37:29 +01:00
220 changed files with 61854 additions and 9148 deletions
+51 -48
View File
@@ -81,27 +81,18 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
cameraOrientation.x(cameraOrientation.x() + controller->Rotation().x);
// Limit camera pitch so we don't break our necks
cameraOrientation.x(glm::clamp(cameraOrientation.x(), -glm::half_pi<float>(), glm::half_pi<float>()));
// Set third person model aim pitch
EntityWrapper playerModel = player.FirstChildByName("PlayerModel");
//Third-person aim
if (playerModel.Valid()) {
EntityWrapper aimPrimaryEntity = playerModel.FirstChildByName("AimPrimary");
EntityWrapper aimPrimaryEntity = playerModel.FirstChildByName("Aim");
if(aimPrimaryEntity.Valid()){
if(aimPrimaryEntity.HasComponent("Animation")) {
float pitch = cameraOrientation.x() + 0.2f;
double time = (pitch + glm::half_pi<float>()) / glm::pi<float>();
float pitch = cameraOrientation.x();
double time = ((pitch + glm::half_pi<float>()) / glm::pi<float>());
(Field<double>)aimPrimaryEntity["Animation"]["Time"] = time;
}
}
EntityWrapper aimSecondaryEntity = playerModel.FirstChildByName("AimSecondary");
if (aimSecondaryEntity.Valid()) {
if (aimSecondaryEntity.HasComponent("Animation")) {
float pitch = cameraOrientation.x() + 0.2f;
double time = (pitch + glm::half_pi<float>()) / glm::pi<float>();
(Field<double>)aimSecondaryEntity["Animation"]["Time"] = time;
}
}
}
}
@@ -214,7 +205,7 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
{
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.25;
aeb.NodeName = "StandCrouchBlend";
aeb.NodeName = "MovementBlend";
aeb.RootNode = playerModel;
aeb.Start = true;
aeb.Restart = false;
@@ -245,11 +236,11 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
{
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.25;
aeb.NodeName = "StandCrouchBlend";
aeb.NodeName = "MovementBlend";
aeb.RootNode = playerModel;
aeb.Start = true;
aeb.Restart = false;
aeb.AnimationEntity = playerModel.FirstChildByName("Jump");
aeb.AnimationEntity = playerModel.FirstChildByName("BlendTreeLower").FirstChildByName("Jump");
m_EventBroker->Publish(aeb);
}
}
@@ -274,6 +265,12 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
size = glm::vec3(1.f, 1.f, 1.f);
} else {
size = glm::vec3(1.f, 1.6f, 1.f);
if (controller->CrouchingLastFrame() && isOnGround) {
// The collision should resolve this anyway, but
// this is more reliable, since the box gets larger.
Field<glm::vec3> pos = cTransform["Position"];
pos.y(pos.y() + 0.3f);
}
}
}
@@ -378,12 +375,12 @@ void PlayerMovementSystem::spawnHexagon(EntityWrapper target)
bool PlayerMovementSystem::OnDashAbility(Events::DashAbility & e)
{
EntityWrapper player(m_World, e.Player);
if (!player.Valid() || !IsClient){// || player.ID == LocalPlayer.ID) {
if (!player.Valid()){// || !IsClient || player.ID == LocalPlayer.ID) {
return false;
}
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/DashEffect.xml");
EntityWrapper dashEffect = entityFile->MergeInto(m_World);
// auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/DashEffect.xml");
// EntityWrapper dashEffect = entityFile->MergeInto(m_World);
EntityWrapper playerModel = player.FirstChildByName("PlayerModel");
for (auto& kv : m_PlayerInputControllers) {
@@ -401,7 +398,7 @@ bool PlayerMovementSystem::OnDashAbility(Events::DashAbility & e)
if (controller->Movement().x > 0) {
{
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.3;
aeb.Duration = 0.1;
aeb.NodeName = "DashRight";
aeb.RootNode = playerModel;
aeb.Restart = true;
@@ -410,19 +407,18 @@ bool PlayerMovementSystem::OnDashAbility(Events::DashAbility & e)
}
{
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.3;
aeb.NodeName = "StandCrouchBlend";
aeb.Duration = 0.2;
aeb.NodeName = "MovementBlend";
aeb.RootNode = playerModel;
aeb.Delay = -0.3;
aeb.Start = true;
aeb.Restart = false;
aeb.AnimationEntity = playerModel.FirstChildByName("DashForward");
aeb.AnimationEntity = playerModel.FirstChildByName("DashRight");
m_EventBroker->Publish(aeb);
}
} else {
{
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.3;
aeb.Duration = 0.1;
aeb.NodeName = "DashLeft";
aeb.RootNode = playerModel;
aeb.Restart = true;
@@ -431,13 +427,12 @@ bool PlayerMovementSystem::OnDashAbility(Events::DashAbility & e)
}
{
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.3;
aeb.NodeName = "StandCrouchBlend";
aeb.Duration = 0.2;
aeb.NodeName = "MovementBlend";
aeb.RootNode = playerModel;
aeb.Delay = -0.3;
aeb.Start = true;
aeb.Restart = false;
aeb.AnimationEntity = playerModel.FirstChildByName("DashForward");
aeb.AnimationEntity = playerModel.FirstChildByName("DashLeft");
m_EventBroker->Publish(aeb);
}
}
@@ -445,7 +440,7 @@ bool PlayerMovementSystem::OnDashAbility(Events::DashAbility & e)
if (controller->Movement().z < 0) {
{
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.3;
aeb.Duration = 0.1;
aeb.NodeName = "DashForward";
aeb.RootNode = playerModel;
aeb.Restart = true;
@@ -454,10 +449,9 @@ bool PlayerMovementSystem::OnDashAbility(Events::DashAbility & e)
}
{
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.3;
aeb.NodeName = "StandCrouchBlend";
aeb.Duration = 0.2;
aeb.NodeName = "MovementBlend";
aeb.RootNode = playerModel;
aeb.Delay = -0.3;
aeb.Start = true;
aeb.Restart = false;
aeb.AnimationEntity = playerModel.FirstChildByName("DashForward");
@@ -466,7 +460,7 @@ bool PlayerMovementSystem::OnDashAbility(Events::DashAbility & e)
} else {
{
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.3;
aeb.Duration = 0.1;
aeb.NodeName = "DashBackward";
aeb.RootNode = playerModel;
aeb.Restart = true;
@@ -475,32 +469,41 @@ bool PlayerMovementSystem::OnDashAbility(Events::DashAbility & e)
}
{
Events::AutoAnimationBlend aeb;
aeb.Duration = 0.3;
aeb.NodeName = "StandCrouchBlend";
aeb.Duration = 0.2;
aeb.NodeName = "MovementBlend";
aeb.RootNode = playerModel;
aeb.Delay = -0.3;
aeb.Start = true;
aeb.Restart = false;
aeb.AnimationEntity = playerModel.FirstChildByName("DashForward");
aeb.AnimationEntity = playerModel.FirstChildByName("DashBackward");
m_EventBroker->Publish(aeb);
}
}
}
}
}
}
/*
auto playerEntityAnimation = playerModel["Animation"];
playerEntityModel.Copy(dashEffect["Model"]);
playerEntityAnimation.Copy(dashEffect["Animation"]);
dashEffect["ExplosionEffect"]["EndColor"] = (glm::vec4)playerEntityModel["Color"];
((Field<glm::vec4>)dashEffect["ExplosionEffect"]["EndColor"]).w = 0.f;
*/
EntityWrapper dashEffectModel;
dashEffectModel = playerModel.Clone();
player["Transform"].Copy(dashEffectModel["Transform"]);
dashEffectModel.AttachComponent("ExplosionEffect");
dashEffectModel["ExplosionEffect"]["EndColor"] = (glm::vec4)playerModel["Model"]["Color"];
((Field<glm::vec4>)dashEffectModel["ExplosionEffect"]["EndColor"]).w = 0.f;
(Field<double>)dashEffectModel["ExplosionEffect"]["ExplosionDuration"] = dashEffect["Lifetime"]["Lifetime"];
(Field<glm::vec3>)dashEffectModel["ExplosionEffect"]["ExplosionOrigin"] = glm::vec3(0, 1, 0) + (0.2f * controller->Movement());
auto animationChildren = dashEffectModel.ChildrenWithComponent("Animation");
for (auto animationEntity : animationChildren) {
(Field<bool>)animationEntity["Animation"]["Play"] = false;
}
*/
}
}
}
return true;
}