Switching rooms
This commit is contained in:
@@ -57,10 +57,13 @@ private:
|
|||||||
EntityWrapper RootNode = EntityWrapper::Invalid;
|
EntityWrapper RootNode = EntityWrapper::Invalid;
|
||||||
double Duration;
|
double Duration;
|
||||||
double CurrentTime = 0.0;
|
double CurrentTime = 0.0;
|
||||||
|
double Delay = 0.0;
|
||||||
BlendTree::AutoBlendInfo BlendInfo;
|
BlendTree::AutoBlendInfo BlendInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
std::list<AutoBlendJob> m_AutoBlendJobs;
|
std::list<AutoBlendJob> m_AutoBlendJobs;
|
||||||
|
std::unordered_map<EntityWrapper, AutoBlendJob> m_QueuedAutoBlendJobs;
|
||||||
std::list<BlendJob> m_BlendJobs;
|
std::list<BlendJob> m_BlendJobs;
|
||||||
std::list<QueuedBlendJob> m_QueuedBlendJobs;
|
std::list<QueuedBlendJob> m_QueuedBlendJobs;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
#ifndef AutoBlendQueue_h__
|
||||||
|
#define AutoBlendQueue_h__
|
||||||
|
|
||||||
|
#include "../Core/ResourceManager.h"
|
||||||
|
#include "Skeleton.h"
|
||||||
|
#include "Model.h"
|
||||||
|
#include "BlendTree.h"
|
||||||
|
|
||||||
|
class AutoBlendQueue
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct AutoBlendJob
|
||||||
|
{
|
||||||
|
EntityWrapper RootNode = EntityWrapper::Invalid;
|
||||||
|
double Duration;
|
||||||
|
double CurrentTime = 0.0;
|
||||||
|
double Delay = 0.0;
|
||||||
|
BlendTree::AutoBlendInfo BlendInfo;
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::map<double, AutoBlendJob> m_BlendQueue;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -60,9 +60,12 @@ public:
|
|||||||
{
|
{
|
||||||
std::string NodeName;
|
std::string NodeName;
|
||||||
double progress;
|
double progress;
|
||||||
|
bool Restart;
|
||||||
|
double AnimationSpeed;
|
||||||
std::unordered_map<EntityWrapper, double> StartWeights;
|
std::unordered_map<EntityWrapper, double> StartWeights;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BlendTree(EntityWrapper ModelEntity, Skeleton* skeleton);
|
BlendTree(EntityWrapper ModelEntity, Skeleton* skeleton);
|
||||||
~BlendTree();
|
~BlendTree();
|
||||||
|
|||||||
@@ -11,7 +11,12 @@ struct AutoAnimationBlend : Event
|
|||||||
{
|
{
|
||||||
EntityWrapper RootNode = EntityWrapper::Invalid;
|
EntityWrapper RootNode = EntityWrapper::Invalid;
|
||||||
std::string NodeName;
|
std::string NodeName;
|
||||||
double Duration;
|
double Duration = 0.0;
|
||||||
|
double Delay = 0.0;
|
||||||
|
|
||||||
|
|
||||||
|
double AnimationSpeed = 1.0;
|
||||||
|
bool Restart = false;
|
||||||
|
|
||||||
EntityWrapper AnimationEntity = EntityWrapper::Invalid;
|
EntityWrapper AnimationEntity = EntityWrapper::Invalid;
|
||||||
};
|
};
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,557 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity name="AnimationTests" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:SceneLight>
|
||||||
|
<Gamma>0.30000001192092896</Gamma>
|
||||||
|
<Exposure>3</Exposure>
|
||||||
|
</c:SceneLight>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.100000001" Y="-1.5150001" Z="-3.70500016"/>
|
||||||
|
<Orientation X="0" Y="2.41300011" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:DirectionalLight>
|
||||||
|
<Intensity>0</Intensity>
|
||||||
|
</c:DirectionalLight>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Widgets/Lights/DirectionalLightWidget.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="2.42800021" Z="-2.80000019"/>
|
||||||
|
<Orientation X="5.60000038" Y="3.14159203" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Light">
|
||||||
|
<Components>
|
||||||
|
<c:PointLight>
|
||||||
|
<Color A="1" B="0.70588237" G="0.70588237" R="1"/>
|
||||||
|
<Radius>8</Radius>
|
||||||
|
<Intensity>0.60000002384185791</Intensity>
|
||||||
|
</c:PointLight>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="1.32209361" Y="1.37392569" Z="-0.0505663045"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Assault">
|
||||||
|
<Components>
|
||||||
|
<c:BlendAdditive>
|
||||||
|
<Adder>AimBlend</Adder>
|
||||||
|
<Receiver>FinalBlend</Receiver>
|
||||||
|
</c:BlendAdditive>
|
||||||
|
<c:Model>
|
||||||
|
<GlowIntensity>5</GlowIntensity>
|
||||||
|
<Resource>Models/Characters/Assault/AssaultBlue.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="WeaponAttachment">
|
||||||
|
<Components>
|
||||||
|
<c:BoneAttachment>
|
||||||
|
<BoneName>R_Arm_Weapon_Joint</BoneName>
|
||||||
|
</c:BoneAttachment>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.153846264" Y="1.07432497" Z="-0.209223658"/>
|
||||||
|
<Scale X="1.00000012" Y="1" Z="1.00000012"/>
|
||||||
|
<Orientation X="-0.033799246" Y="-0.120032266" Z="0.188354403"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="AimBlend">
|
||||||
|
<Components>
|
||||||
|
<c:Blend>
|
||||||
|
<Pose1>AimPrimary</Pose1>
|
||||||
|
<Pose2>AimSecondary</Pose2>
|
||||||
|
<Weight>0</Weight>
|
||||||
|
</c:Blend>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="AimPrimary">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>AimRifleA</AnimationName>
|
||||||
|
<Time>0.49999979138374329</Time>
|
||||||
|
<Loop>false</Loop>
|
||||||
|
<Additive>true</Additive>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="AimSecondary">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>AimSecWepA</AnimationName>
|
||||||
|
<Time>0.5</Time>
|
||||||
|
<Loop>false</Loop>
|
||||||
|
<Additive>true</Additive>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="FinalBlend">
|
||||||
|
<Components>
|
||||||
|
<c:BlendOverride>
|
||||||
|
<Master>ReloadSwitchBlend</Master>
|
||||||
|
<Slave>MovementBlend</Slave>
|
||||||
|
</c:BlendOverride>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="MovementBlend">
|
||||||
|
<Components>
|
||||||
|
<c:Blend>
|
||||||
|
<Pose1>StandCrouchBlend</Pose1>
|
||||||
|
<Pose2>JumpDashBlend</Pose2>
|
||||||
|
<Weight>0</Weight>
|
||||||
|
</c:Blend>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="StandCrouchBlend">
|
||||||
|
<Components>
|
||||||
|
<c:Blend>
|
||||||
|
<Pose1>StandMovement</Pose1>
|
||||||
|
<Pose2>CrouchMovement</Pose2>
|
||||||
|
<Weight>0</Weight>
|
||||||
|
</c:Blend>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="StandMovement">
|
||||||
|
<Components>
|
||||||
|
<c:Blend>
|
||||||
|
<Pose1>MovementBlend</Pose1>
|
||||||
|
<Pose2>Idle</Pose2>
|
||||||
|
<Weight>0</Weight>
|
||||||
|
</c:Blend>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="MovementBlend">
|
||||||
|
<Components>
|
||||||
|
<c:Blend>
|
||||||
|
<Pose1>RunWalkBlend</Pose1>
|
||||||
|
<Pose2>StrafeLRBlend</Pose2>
|
||||||
|
<Weight>0</Weight>
|
||||||
|
</c:Blend>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="RunWalkBlend">
|
||||||
|
<Components>
|
||||||
|
<c:Blend>
|
||||||
|
<Pose1>Walk</Pose1>
|
||||||
|
<Pose2>Run</Pose2>
|
||||||
|
<Weight>1</Weight>
|
||||||
|
</c:Blend>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="Walk">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>WalkF</AnimationName>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Run">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>RunF</AnimationName>
|
||||||
|
<Time>0.032768287014830921</Time>
|
||||||
|
<Speed>1</Speed>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="StrafeLRBlend">
|
||||||
|
<Components>
|
||||||
|
<c:Blend>
|
||||||
|
<Pose1>Left</Pose1>
|
||||||
|
<Pose2>Right</Pose2>
|
||||||
|
<Weight>0</Weight>
|
||||||
|
</c:Blend>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="Left">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>StrafeLeftF</AnimationName>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Right">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>StrafeRightF</AnimationName>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Idle">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>IdleF</AnimationName>
|
||||||
|
<Time>0.8319563183471943</Time>
|
||||||
|
<Speed>1</Speed>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="CrouchMovement">
|
||||||
|
<Components>
|
||||||
|
<c:Blend>
|
||||||
|
<Pose1>MovementBlend</Pose1>
|
||||||
|
<Pose2>Idle</Pose2>
|
||||||
|
</c:Blend>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="MovementBlend">
|
||||||
|
<Components>
|
||||||
|
<c:Blend>
|
||||||
|
<Pose1>Walk</Pose1>
|
||||||
|
<Pose2>StrafeLRBlend</Pose2>
|
||||||
|
<Weight>0</Weight>
|
||||||
|
</c:Blend>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="StrafeLRBlend">
|
||||||
|
<Components>
|
||||||
|
<c:Blend>
|
||||||
|
<Pose1>Left</Pose1>
|
||||||
|
<Pose2>Right</Pose2>
|
||||||
|
<Weight>0</Weight>
|
||||||
|
</c:Blend>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="Left">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>CrouchStrafeLeftF</AnimationName>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Right">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>CrouchStrafeRightF</AnimationName>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Walk">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>CrouchWalkF</AnimationName>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Idle">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>CrouchF</AnimationName>
|
||||||
|
<Time>0.99862473341677438</Time>
|
||||||
|
<Speed>1</Speed>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="JumpDashBlend">
|
||||||
|
<Components>
|
||||||
|
<c:Blend>
|
||||||
|
<Pose1>Jump</Pose1>
|
||||||
|
<Pose2>DashBlend</Pose2>
|
||||||
|
<Weight>1</Weight>
|
||||||
|
</c:Blend>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="Jump">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>JumpF</AnimationName>
|
||||||
|
<Time>0.5</Time>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="DashBlend">
|
||||||
|
<Components>
|
||||||
|
<c:Blend>
|
||||||
|
<Pose1>DashFBBlend</Pose1>
|
||||||
|
<Pose2>DashLRBlend</Pose2>
|
||||||
|
<Weight>0</Weight>
|
||||||
|
</c:Blend>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="DashFBBlend">
|
||||||
|
<Components>
|
||||||
|
<c:Blend>
|
||||||
|
<Pose1>DashForward</Pose1>
|
||||||
|
<Pose2>DashBackward</Pose2>
|
||||||
|
<Weight>1</Weight>
|
||||||
|
</c:Blend>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="DashForward">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>DashForwardF</AnimationName>
|
||||||
|
<Loop>false</Loop>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="DashBackward">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>DashBackwardF</AnimationName>
|
||||||
|
<Time>1</Time>
|
||||||
|
<Loop>false</Loop>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="DashLRBlend">
|
||||||
|
<Components>
|
||||||
|
<c:Blend>
|
||||||
|
<Pose1>DashLeft</Pose1>
|
||||||
|
<Pose2>DashRight</Pose2>
|
||||||
|
<Weight>0</Weight>
|
||||||
|
</c:Blend>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="DashLeft">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>DashLeftF</AnimationName>
|
||||||
|
<Time>1</Time>
|
||||||
|
<Loop>false</Loop>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="DashRight">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>DashRightF</AnimationName>
|
||||||
|
<Loop>false</Loop>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="ReloadSwitchBlend">
|
||||||
|
<Components>
|
||||||
|
<c:Blend>
|
||||||
|
<Pose1>ReloadSwitch</Pose1>
|
||||||
|
<Pose2>WeaponActionBlend</Pose2>
|
||||||
|
<Weight>1</Weight>
|
||||||
|
</c:Blend>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="ReloadSwitch">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>ReloadSwitchU</AnimationName>
|
||||||
|
<Time>0.00030848838797092881</Time>
|
||||||
|
<Speed>1</Speed>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="WeaponActionBlend">
|
||||||
|
<Components>
|
||||||
|
<c:Blend>
|
||||||
|
<Pose1>IdleBlend</Pose1>
|
||||||
|
<Pose2>ShootBlend</Pose2>
|
||||||
|
<Weight>1</Weight>
|
||||||
|
</c:Blend>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="IdleBlend">
|
||||||
|
<Components>
|
||||||
|
<c:Blend>
|
||||||
|
<Pose1>IdlePrimary</Pose1>
|
||||||
|
<Pose2>IdleSecondary</Pose2>
|
||||||
|
</c:Blend>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="IdlePrimary">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>IdleAssaultRifleU</AnimationName>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="IdleSecondary">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>IdleSecWepU</AnimationName>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="ShootBlend">
|
||||||
|
<Components>
|
||||||
|
<c:Blend>
|
||||||
|
<Pose1>ShootPrimary</Pose1>
|
||||||
|
<Pose2>ShootSecondary</Pose2>
|
||||||
|
<Weight>0</Weight>
|
||||||
|
</c:Blend>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="ShootPrimary">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>ShootFastRifleU</AnimationName>
|
||||||
|
<Time>0.12914212153428517</Time>
|
||||||
|
<Speed>1</Speed>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="ShootSecondary">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName>ShootSecWepFastU</AnimationName>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Plane">
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitPlane.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Scale X="5" Y="1" Z="5"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Light">
|
||||||
|
<Components>
|
||||||
|
<c:PointLight>
|
||||||
|
<Color A="1" B="0.956862748" G="0.960784316" R="0.819607854"/>
|
||||||
|
<Radius>8</Radius>
|
||||||
|
<Intensity>0.60000002384185791</Intensity>
|
||||||
|
</c:PointLight>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-1.36898434" Y="1.37392569" Z="0.620898128"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Light">
|
||||||
|
<Components>
|
||||||
|
<c:PointLight>
|
||||||
|
<Radius>8</Radius>
|
||||||
|
<Intensity>0.80000001192092896</Intensity>
|
||||||
|
</c:PointLight>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.127636135" Y="1.37392569" Z="-1.52101767"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity name="AnimationTests" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:SceneLight>
|
||||||
|
<Gamma>0.30000001192092896</Gamma>
|
||||||
|
<Exposure>3</Exposure>
|
||||||
|
</c:SceneLight>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.100000001" Y="-1.5150001" Z="-3.70500016"/>
|
||||||
|
<Orientation X="0" Y="2.41300011" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:DirectionalLight>
|
||||||
|
<Intensity>0</Intensity>
|
||||||
|
</c:DirectionalLight>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Widgets/Lights/DirectionalLightWidget.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="2.42800021" Z="-2.80000019"/>
|
||||||
|
<Orientation X="5.60000038" Y="3.14159203" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Light">
|
||||||
|
<Components>
|
||||||
|
<c:PointLight>
|
||||||
|
<Color A="1" B="0.70588237" G="0.70588237" R="1"/>
|
||||||
|
<Radius>8</Radius>
|
||||||
|
<Intensity>0.60000002384185791</Intensity>
|
||||||
|
</c:PointLight>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="1.32209361" Y="1.37392569" Z="-0.0505663045"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Assault">
|
||||||
|
<Components>
|
||||||
|
<c:BlendAdditive>
|
||||||
|
<Adder></Adder>
|
||||||
|
<Receiver></Receiver>
|
||||||
|
</c:BlendAdditive>
|
||||||
|
<c:Model>
|
||||||
|
<GlowIntensity>5</GlowIntensity>
|
||||||
|
<Resource>Models/Characters/Defender/DefenderBlue.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="WeaponAttachment">
|
||||||
|
<Components>
|
||||||
|
<c:BoneAttachment>
|
||||||
|
<BoneName>R_Arm_Weapon_Joint</BoneName>
|
||||||
|
</c:BoneAttachment>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Weapons/Blue/AssaultWeaponBlue.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Scale X="1.00000012" Y="1" Z="1.00000012"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="AimBlend">
|
||||||
|
<Components>
|
||||||
|
<c:Blend>
|
||||||
|
<Pose1>AimPrimary</Pose1>
|
||||||
|
<Pose2>AimSecondary</Pose2>
|
||||||
|
<Weight>0</Weight>
|
||||||
|
</c:Blend>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity name="AimPrimary">
|
||||||
|
<Components>
|
||||||
|
<c:Animation>
|
||||||
|
<AnimationName></AnimationName>
|
||||||
|
</c:Animation>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="AimSecondary">
|
||||||
|
<Components>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Plane">
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitPlane.mesh</Resource>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Scale X="5" Y="1" Z="5"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Light">
|
||||||
|
<Components>
|
||||||
|
<c:PointLight>
|
||||||
|
<Color A="1" B="0.956862748" G="0.960784316" R="0.819607854"/>
|
||||||
|
<Radius>8</Radius>
|
||||||
|
<Intensity>0.60000002384185791</Intensity>
|
||||||
|
</c:PointLight>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-1.36898434" Y="1.37392569" Z="0.620898128"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Light">
|
||||||
|
<Components>
|
||||||
|
<c:PointLight>
|
||||||
|
<Radius>8</Radius>
|
||||||
|
<Intensity>0.80000001192092896</Intensity>
|
||||||
|
</c:PointLight>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0.127636135" Y="1.37392569" Z="-1.52101767"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -92,9 +92,30 @@ void AnimationSystem::UpdateAnimations(double dt)
|
|||||||
double animationSpeed = (double)animationC["Speed"];
|
double animationSpeed = (double)animationC["Speed"];
|
||||||
|
|
||||||
if (animationSpeed != 0.0) {
|
if (animationSpeed != 0.0) {
|
||||||
|
|
||||||
double nextTime = (double)animationC["Time"] + animationSpeed * dt;
|
double nextTime = (double)animationC["Time"] + animationSpeed * dt;
|
||||||
|
|
||||||
|
|
||||||
|
//Pre animation end blend
|
||||||
|
if (m_QueuedAutoBlendJobs.find(entity) != m_QueuedAutoBlendJobs.end()) {
|
||||||
|
if (glm::sign(m_QueuedAutoBlendJobs.at(entity).Delay) < 0) {
|
||||||
|
if (!(bool)animationC["Loop"]) {
|
||||||
|
if (nextTime > animation->Duration + m_QueuedAutoBlendJobs.at(entity).Delay && glm::sign(animationSpeed) > 0) {
|
||||||
|
AnimationComplete(entity);
|
||||||
|
} else if (nextTime < 0 - m_QueuedAutoBlendJobs.at(entity).Delay && glm::sign(animationSpeed) < 0) {
|
||||||
|
AnimationComplete(entity);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (nextTime > animation->Duration + m_QueuedAutoBlendJobs.at(entity).Delay && glm::sign(animationSpeed) > 0) {
|
||||||
|
AnimationComplete(entity);
|
||||||
|
} else if (nextTime < 0 - m_QueuedAutoBlendJobs.at(entity).Delay && glm::sign(animationSpeed) < 0) {
|
||||||
|
AnimationComplete(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!(bool)animationC["Loop"]) {
|
if (!(bool)animationC["Loop"]) {
|
||||||
if (nextTime > animation->Duration) {
|
if (nextTime > animation->Duration) {
|
||||||
nextTime = animation->Duration;
|
nextTime = animation->Duration;
|
||||||
@@ -119,6 +140,7 @@ void AnimationSystem::UpdateAnimations(double dt)
|
|||||||
e.Entity = entity;
|
e.Entity = entity;
|
||||||
e.Name = (std::string)animationC["AnimationName"];
|
e.Name = (std::string)animationC["AnimationName"];
|
||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
|
AnimationComplete(entity);
|
||||||
|
|
||||||
while (nextTime > animation->Duration) {
|
while (nextTime > animation->Duration) {
|
||||||
nextTime -= animation->Duration;
|
nextTime -= animation->Duration;
|
||||||
@@ -128,13 +150,12 @@ void AnimationSystem::UpdateAnimations(double dt)
|
|||||||
e.Entity = entity;
|
e.Entity = entity;
|
||||||
e.Name = (std::string)animationC["AnimationName"];
|
e.Name = (std::string)animationC["AnimationName"];
|
||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
|
AnimationComplete(entity);
|
||||||
while (nextTime < 0) {
|
while (nextTime < 0) {
|
||||||
nextTime += animation->Duration;
|
nextTime += animation->Duration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(double&)animationC["Time"] = nextTime;
|
(double&)animationC["Time"] = nextTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,7 +164,7 @@ void AnimationSystem::UpdateAnimations(double dt)
|
|||||||
|
|
||||||
void AnimationSystem::UpdateWeights(double dt)
|
void AnimationSystem::UpdateWeights(double dt)
|
||||||
{
|
{
|
||||||
/* for (auto it = m_BlendJobs.begin(); it != m_BlendJobs.end(); it++) {
|
for (auto it = m_BlendJobs.begin(); it != m_BlendJobs.end();) {
|
||||||
if (!it->BlendEntity.Valid()) {
|
if (!it->BlendEntity.Valid()) {
|
||||||
it = m_BlendJobs.erase(it);
|
it = m_BlendJobs.erase(it);
|
||||||
continue;
|
continue;
|
||||||
@@ -161,7 +182,9 @@ void AnimationSystem::UpdateWeights(double dt)
|
|||||||
it = m_BlendJobs.erase(it);
|
it = m_BlendJobs.erase(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for (auto it = m_AutoBlendJobs.begin(); it != m_AutoBlendJobs.end();) {
|
for (auto it = m_AutoBlendJobs.begin(); it != m_AutoBlendJobs.end();) {
|
||||||
@@ -214,7 +237,7 @@ void AnimationSystem::UpdateWeights(double dt)
|
|||||||
|
|
||||||
void AnimationSystem::AnimationComplete(EntityWrapper animationEntity)
|
void AnimationSystem::AnimationComplete(EntityWrapper animationEntity)
|
||||||
{
|
{
|
||||||
for (auto it = m_QueuedBlendJobs.begin(); it != m_QueuedBlendJobs.end(); it++) {
|
for (auto it = m_QueuedBlendJobs.begin(); it != m_QueuedBlendJobs.end();) {
|
||||||
if (!it->BlendEntity.Valid() || !it->AnimationEntity.Valid()) {
|
if (!it->BlendEntity.Valid() || !it->AnimationEntity.Valid()) {
|
||||||
it = m_QueuedBlendJobs.erase(it);
|
it = m_QueuedBlendJobs.erase(it);
|
||||||
continue;
|
continue;
|
||||||
@@ -229,10 +252,28 @@ void AnimationSystem::AnimationComplete(EntityWrapper animationEntity)
|
|||||||
bj.CurrentTime = 0.0;
|
bj.CurrentTime = 0.0;
|
||||||
m_BlendJobs.push_back(bj);
|
m_BlendJobs.push_back(bj);
|
||||||
it = m_QueuedBlendJobs.erase(it);
|
it = m_QueuedBlendJobs.erase(it);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
++it;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (m_QueuedAutoBlendJobs.find(animationEntity) != m_QueuedAutoBlendJobs.end()) {
|
||||||
|
AutoBlendJob abj = m_QueuedAutoBlendJobs.at(animationEntity);
|
||||||
|
|
||||||
|
if (!abj.RootNode.Valid() || !animationEntity.Valid()) {
|
||||||
|
m_QueuedAutoBlendJobs.erase(animationEntity);
|
||||||
|
} else {
|
||||||
|
m_AutoBlendJobs.push_back(abj);
|
||||||
|
m_QueuedAutoBlendJobs.erase(animationEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AnimationSystem::OnAnimationBlend(Events::AnimationBlend& e)
|
bool AnimationSystem::OnAnimationBlend(Events::AnimationBlend& e)
|
||||||
@@ -256,17 +297,16 @@ bool AnimationSystem::OnAnimationBlend(Events::AnimationBlend& e)
|
|||||||
m_QueuedBlendJobs.push_back(qbj);
|
m_QueuedBlendJobs.push_back(qbj);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
BlendJob bj;
|
||||||
|
bj.BlendEntity = e.BlendEntity;
|
||||||
|
bj.StartWeight = (double)e.BlendEntity["Blend"]["Weight"];
|
||||||
|
bj.GoalWeight = e.GoalWeight;
|
||||||
|
bj.Duration = e.Duration;
|
||||||
|
bj.CurrentTime = 0.0;
|
||||||
|
m_BlendJobs.push_back(bj);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlendJob bj;
|
|
||||||
bj.BlendEntity = e.BlendEntity;
|
|
||||||
bj.StartWeight = (double)e.BlendEntity["Blend"]["Weight"];
|
|
||||||
bj.GoalWeight = e.GoalWeight;
|
|
||||||
bj.Duration = e.Duration;
|
|
||||||
bj.CurrentTime = 0.0;
|
|
||||||
m_BlendJobs.push_back(bj);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -280,18 +320,39 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoBlendJob abj;
|
if (e.AnimationEntity.Valid()) {
|
||||||
abj.RootNode = e.RootNode;
|
AutoBlendJob abj;
|
||||||
abj.CurrentTime = 0.0;
|
abj.RootNode = e.RootNode;
|
||||||
abj.Duration = e.Duration;
|
abj.CurrentTime = 0.0;
|
||||||
|
abj.Duration = e.Duration;
|
||||||
|
abj.Delay = e.Delay;
|
||||||
|
|
||||||
BlendTree::AutoBlendInfo abInfo;
|
BlendTree::AutoBlendInfo abInfo;
|
||||||
abInfo.NodeName = e.NodeName;
|
abInfo.NodeName = e.NodeName;
|
||||||
abInfo.progress = 0.0;
|
abInfo.progress = 0.0;
|
||||||
|
abInfo.Restart = e.Restart;
|
||||||
abj.BlendInfo = abInfo;
|
abInfo.AnimationSpeed = e.AnimationSpeed;
|
||||||
|
abj.BlendInfo = abInfo;
|
||||||
|
|
||||||
m_AutoBlendJobs.push_back(abj);
|
m_QueuedAutoBlendJobs[e.AnimationEntity] = abj;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
AutoBlendJob abj;
|
||||||
|
abj.RootNode = e.RootNode;
|
||||||
|
abj.CurrentTime = 0.0;
|
||||||
|
abj.Duration = e.Duration;
|
||||||
|
|
||||||
|
BlendTree::AutoBlendInfo abInfo;
|
||||||
|
abInfo.NodeName = e.NodeName;
|
||||||
|
abInfo.progress = 0.0;
|
||||||
|
abInfo.Restart = e.Restart;
|
||||||
|
abInfo.AnimationSpeed = e.AnimationSpeed;
|
||||||
|
|
||||||
|
abj.BlendInfo = abInfo;
|
||||||
|
|
||||||
|
m_AutoBlendJobs.push_back(abj);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -301,8 +362,6 @@ bool AnimationSystem::OnInputCommand(const Events::InputCommand& e)
|
|||||||
|
|
||||||
if (e.Value == 1.f) {
|
if (e.Value == 1.f) {
|
||||||
if (e.Command == "BlendTest0") {
|
if (e.Command == "BlendTest0") {
|
||||||
|
|
||||||
|
|
||||||
auto blendComponents = m_World->GetComponents("BlendAdditive");
|
auto blendComponents = m_World->GetComponents("BlendAdditive");
|
||||||
|
|
||||||
if (blendComponents == nullptr) {
|
if (blendComponents == nullptr) {
|
||||||
@@ -314,11 +373,12 @@ bool AnimationSystem::OnInputCommand(const Events::InputCommand& e)
|
|||||||
EntityWrapper entity = EntityWrapper(m_World, bc.EntityID);
|
EntityWrapper entity = EntityWrapper(m_World, bc.EntityID);
|
||||||
|
|
||||||
if (entity.Name() == "Assault") {
|
if (entity.Name() == "Assault") {
|
||||||
|
|
||||||
Events::AutoAnimationBlend aeb;
|
Events::AutoAnimationBlend aeb;
|
||||||
aeb.Duration = m_BlendTime1;
|
aeb.Duration = m_BlendTime1;
|
||||||
aeb.NodeName = m_AnimationName1;
|
aeb.NodeName = m_AnimationName1;
|
||||||
aeb.RootNode = entity;
|
aeb.RootNode = entity;
|
||||||
|
aeb.Restart = true;
|
||||||
|
|
||||||
m_EventBroker->Publish(aeb);
|
m_EventBroker->Publish(aeb);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -338,15 +398,183 @@ bool AnimationSystem::OnInputCommand(const Events::InputCommand& e)
|
|||||||
|
|
||||||
if (entity.Name() == "Assault") {
|
if (entity.Name() == "Assault") {
|
||||||
|
|
||||||
Events::AutoAnimationBlend aeb;
|
{
|
||||||
aeb.Duration = m_BlendTime2;
|
Events::AutoAnimationBlend aeb;
|
||||||
aeb.NodeName = m_AnimationName2;
|
aeb.Duration = m_BlendTime2;
|
||||||
aeb.RootNode = entity;
|
aeb.NodeName = m_AnimationName2;
|
||||||
m_EventBroker->Publish(aeb);
|
aeb.RootNode = entity;
|
||||||
|
aeb.Restart = true;
|
||||||
|
m_EventBroker->Publish(aeb);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
Events::AutoAnimationBlend aeb;
|
||||||
|
aeb.Duration = m_BlendTime2;
|
||||||
|
aeb.NodeName = "Run";
|
||||||
|
aeb.RootNode = entity;
|
||||||
|
aeb.Restart = true;
|
||||||
|
aeb.AnimationEntity = entity.FirstChildByName("DashLeft");
|
||||||
|
m_EventBroker->Publish(aeb);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(e.Command == "DashForward") {
|
||||||
|
auto blendComponents = m_World->GetComponents("BlendAdditive");
|
||||||
|
|
||||||
|
if (blendComponents == nullptr) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (auto& bc : *blendComponents) {
|
||||||
|
EntityWrapper entity = EntityWrapper(m_World, bc.EntityID);
|
||||||
|
|
||||||
|
if (entity.Name() == "Assault") {
|
||||||
|
{
|
||||||
|
Events::AutoAnimationBlend aeb;
|
||||||
|
aeb.Duration = 0.1;
|
||||||
|
aeb.NodeName = "DashForward";
|
||||||
|
aeb.RootNode = entity;
|
||||||
|
aeb.Restart = true;
|
||||||
|
m_EventBroker->Publish(aeb);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
Events::AutoAnimationBlend aeb;
|
||||||
|
aeb.Duration = 0.3;
|
||||||
|
aeb.NodeName = "Run";
|
||||||
|
aeb.RootNode = entity;
|
||||||
|
aeb.Restart = true;
|
||||||
|
aeb.Delay = 0;
|
||||||
|
aeb.AnimationEntity = entity.FirstChildByName("DashForward");
|
||||||
|
m_EventBroker->Publish(aeb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (e.Command == "DashBackward") {
|
||||||
|
auto blendComponents = m_World->GetComponents("BlendAdditive");
|
||||||
|
|
||||||
|
if (blendComponents == nullptr) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (auto& bc : *blendComponents) {
|
||||||
|
EntityWrapper entity = EntityWrapper(m_World, bc.EntityID);
|
||||||
|
|
||||||
|
if (entity.Name() == "Assault") {
|
||||||
|
{
|
||||||
|
Events::AutoAnimationBlend aeb;
|
||||||
|
aeb.Duration = 0.1;
|
||||||
|
aeb.NodeName = "DashBackward";
|
||||||
|
aeb.RootNode = entity;
|
||||||
|
aeb.Restart = true;
|
||||||
|
m_EventBroker->Publish(aeb);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
Events::AutoAnimationBlend aeb;
|
||||||
|
aeb.Duration = 0.3;
|
||||||
|
aeb.NodeName = "Run";
|
||||||
|
aeb.RootNode = entity;
|
||||||
|
aeb.Restart = true;
|
||||||
|
aeb.Delay = -0.3;
|
||||||
|
aeb.AnimationEntity = entity.FirstChildByName("DashBackward");
|
||||||
|
m_EventBroker->Publish(aeb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (e.Command == "DashLeft") {
|
||||||
|
auto blendComponents = m_World->GetComponents("BlendAdditive");
|
||||||
|
|
||||||
|
if (blendComponents == nullptr) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (auto& bc : *blendComponents) {
|
||||||
|
EntityWrapper entity = EntityWrapper(m_World, bc.EntityID);
|
||||||
|
|
||||||
|
if (entity.Name() == "Assault") {
|
||||||
|
{
|
||||||
|
Events::AutoAnimationBlend aeb;
|
||||||
|
aeb.Duration = 0.1;
|
||||||
|
aeb.NodeName = "DashLeft";
|
||||||
|
aeb.RootNode = entity;
|
||||||
|
aeb.Restart = true;
|
||||||
|
m_EventBroker->Publish(aeb);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
Events::AutoAnimationBlend aeb;
|
||||||
|
aeb.Duration = 0.3;
|
||||||
|
aeb.NodeName = "Run";
|
||||||
|
aeb.RootNode = entity;
|
||||||
|
aeb.Restart = true;
|
||||||
|
aeb.Delay = -0.3;
|
||||||
|
aeb.AnimationEntity = entity.FirstChildByName("DashLeft");
|
||||||
|
m_EventBroker->Publish(aeb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (e.Command == "DashRight") {
|
||||||
|
auto blendComponents = m_World->GetComponents("BlendAdditive");
|
||||||
|
|
||||||
|
if (blendComponents == nullptr) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (auto& bc : *blendComponents) {
|
||||||
|
EntityWrapper entity = EntityWrapper(m_World, bc.EntityID);
|
||||||
|
|
||||||
|
if (entity.Name() == "Assault") {
|
||||||
|
{
|
||||||
|
Events::AutoAnimationBlend aeb;
|
||||||
|
aeb.Duration = 0.1;
|
||||||
|
aeb.NodeName = "DashRight";
|
||||||
|
aeb.RootNode = entity;
|
||||||
|
aeb.Restart = true;
|
||||||
|
m_EventBroker->Publish(aeb);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
Events::AutoAnimationBlend aeb;
|
||||||
|
aeb.Duration = 0.3;
|
||||||
|
aeb.NodeName = "Run";
|
||||||
|
aeb.RootNode = entity;
|
||||||
|
aeb.Restart = true;
|
||||||
|
aeb.AnimationEntity = entity.FirstChildByName("DashRight");
|
||||||
|
aeb.Delay = -0.3;
|
||||||
|
m_EventBroker->Publish(aeb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (e.Command == "Jump") {
|
||||||
|
auto blendComponents = m_World->GetComponents("BlendAdditive");
|
||||||
|
|
||||||
|
if (blendComponents == nullptr) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (auto& bc : *blendComponents) {
|
||||||
|
EntityWrapper entity = EntityWrapper(m_World, bc.EntityID);
|
||||||
|
|
||||||
|
if (entity.Name() == "Assault") {
|
||||||
|
{
|
||||||
|
Events::AutoAnimationBlend aeb;
|
||||||
|
aeb.Duration = 0.35;
|
||||||
|
aeb.NodeName = "Jump";
|
||||||
|
aeb.RootNode = entity;
|
||||||
|
aeb.Restart = true;
|
||||||
|
m_EventBroker->Publish(aeb);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
Events::AutoAnimationBlend aeb;
|
||||||
|
aeb.Duration = 0.35;
|
||||||
|
aeb.NodeName = "Run";
|
||||||
|
aeb.RootNode = entity;
|
||||||
|
aeb.Restart = false;
|
||||||
|
aeb.AnimationEntity = entity.FirstChildByName("Jump");
|
||||||
|
m_EventBroker->Publish(aeb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -207,6 +207,21 @@ BlendTree::AutoBlendInfo BlendTree::AutoBlendStep(AutoBlendInfo blendInfo)
|
|||||||
{
|
{
|
||||||
std::vector<Node*> goalNodes = FindNodesByName(blendInfo.NodeName);
|
std::vector<Node*> goalNodes = FindNodesByName(blendInfo.NodeName);
|
||||||
|
|
||||||
|
if (blendInfo.Restart) {
|
||||||
|
for (auto it = goalNodes.begin(); it != goalNodes.end(); it++) {
|
||||||
|
EntityWrapper entity = (*it)->Entity;
|
||||||
|
|
||||||
|
if (entity.Valid()) {
|
||||||
|
if (entity.HasComponent("Animation")) {
|
||||||
|
(double&)entity["Animation"]["Time"] = 0.0;
|
||||||
|
(double&)entity["Animation"]["Speed"] = blendInfo.AnimationSpeed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
blendInfo.Restart = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(goalNodes.size() == 0) {
|
if(goalNodes.size() == 0) {
|
||||||
return blendInfo;
|
return blendInfo;
|
||||||
} else if(goalNodes.size() == 1) {
|
} else if(goalNodes.size() == 1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user