Merge remote-tracking branch 'origin/master' into Movement
This commit is contained in:
@@ -32,6 +32,8 @@ private:
|
||||
glm::vec3 m_LastPosition = glm::vec3();
|
||||
// Used to track afterimages for sprint effect.
|
||||
float m_SprintEffectTimer;
|
||||
// Used to track afterimages for dash effect.
|
||||
float m_DashEffectTimer;
|
||||
// The logic for making the sound play when player is moving
|
||||
void playerStep(double dt, EntityWrapper player);
|
||||
// Spawn a hexagon at origin of an Entity
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<BoostAssault xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BoostAssault.xsd">
|
||||
<StrengthOfEffect>2</StrengthOfEffect>
|
||||
<StrengthOfEffect>1.35</StrengthOfEffect>
|
||||
</BoostAssault>
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
<FadeTime>1</FadeTime>
|
||||
<Time>0</Time>
|
||||
<Out>true</Out>
|
||||
<Loop>true</Loop>
|
||||
<Reverse>false</Reverse>
|
||||
</Fade>
|
||||
@@ -11,6 +11,9 @@
|
||||
<xs:element name="Out" type="t:bool" minOccurs="0">
|
||||
<xs:annotation><xs:documentation>If the entity should fade out or in.</xs:documentation></xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="Loop" type="t:bool" minOccurs="0">
|
||||
<xs:annotation><xs:documentation>If the effect should loop when it is done.</xs:documentation></xs:annotation>
|
||||
</xs:element>
|
||||
<xs:element name="Reverse" type="t:bool" minOccurs="0">
|
||||
<xs:annotation><xs:documentation>If the entity should reverse the fade after finishing, this will double the speed.</xs:documentation></xs:annotation>
|
||||
</xs:element>
|
||||
|
||||
+6135
-6040
File diff suppressed because it is too large
Load Diff
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||
<Entity name="DashEffect" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||
|
||||
<Components>
|
||||
<c:Lifetime>
|
||||
<Lifetime>0.5</Lifetime>
|
||||
</c:Lifetime>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
|
||||
<Children/>
|
||||
|
||||
</Entity>
|
||||
@@ -18,7 +18,126 @@
|
||||
<Position X="-16.5" Y="0" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
<Children>
|
||||
<Entity name="ScoreBoard_Red_Origin">
|
||||
<Components>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="RedSide">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="0" G="0.0862745121" R="1"/>
|
||||
<Visible>false</Visible>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.5"/>
|
||||
<Scale X="32" Y="23" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="ScoreBoard_Red">
|
||||
<Components>
|
||||
<c:Team>
|
||||
<Team>
|
||||
<Red/>
|
||||
</Team>
|
||||
</c:Team>
|
||||
<c:ScoreScreen>
|
||||
<Offset X="0" Y="-3" Z="0"/>
|
||||
</c:ScoreScreen>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="7" Z="1.5"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="IDText">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>ID</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Alignment>
|
||||
<Left/>
|
||||
</Alignment>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="-13" Y="2.5" Z="0"/>
|
||||
<Scale X="2" Y="2" Z="2"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="NameText">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Name</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Alignment>
|
||||
<Left/>
|
||||
</Alignment>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="-10" Y="2.5" Z="0"/>
|
||||
<Scale X="2" Y="2" Z="2"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="KDText">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>KD</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Alignment>
|
||||
<Left/>
|
||||
</Alignment>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="1.28838646" Y="2.5" Z="0"/>
|
||||
<Scale X="2" Y="2" Z="2"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="KillsText">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Kills</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Alignment>
|
||||
<Left/>
|
||||
</Alignment>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="4.6874299" Y="2.5" Z="0"/>
|
||||
<Scale X="2" Y="2" Z="2"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="DeathsText">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Deaths</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Alignment>
|
||||
<Left/>
|
||||
</Alignment>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="8.9577198" Y="2.5" Z="0"/>
|
||||
<Scale X="2" Y="2" Z="2"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="Background_Main">
|
||||
<Components>
|
||||
@@ -56,7 +175,126 @@
|
||||
<Position X="16.5" Y="0" Z="0"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
<Children>
|
||||
<Entity name="ScoreBoard_Blue_Origin">
|
||||
<Components>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="BlueSide">
|
||||
<Components>
|
||||
<c:Model>
|
||||
<Resource>Models/Core/UnitCube.mesh</Resource>
|
||||
<Color A="1" B="1" G="0.505882382" R="0"/>
|
||||
<Visible>false</Visible>
|
||||
</c:Model>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0" Z="0.5"/>
|
||||
<Scale X="32" Y="23" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="ScoreBoard_Blue">
|
||||
<Components>
|
||||
<c:Team>
|
||||
<Team>
|
||||
<Blue/>
|
||||
</Team>
|
||||
</c:Team>
|
||||
<c:ScoreScreen>
|
||||
<Offset X="0" Y="-3" Z="0"/>
|
||||
</c:ScoreScreen>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="7" Z="1.5"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="IDText">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>ID</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Alignment>
|
||||
<Left/>
|
||||
</Alignment>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="-13" Y="2.5" Z="0"/>
|
||||
<Scale X="2" Y="2" Z="2"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="NameText">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Name</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Alignment>
|
||||
<Left/>
|
||||
</Alignment>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="-10" Y="2.5" Z="0"/>
|
||||
<Scale X="2" Y="2" Z="2"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="KDText">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>KD</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Alignment>
|
||||
<Left/>
|
||||
</Alignment>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="1.28838646" Y="2.5" Z="0"/>
|
||||
<Scale X="2" Y="2" Z="2"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="KillsText">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Kills</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Alignment>
|
||||
<Left/>
|
||||
</Alignment>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="4.6874299" Y="2.5" Z="0"/>
|
||||
<Scale X="2" Y="2" Z="2"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="DeathsText">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Deaths</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Alignment>
|
||||
<Left/>
|
||||
</Alignment>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="8.9577198" Y="2.5" Z="0"/>
|
||||
<Scale X="2" Y="2" Z="2"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
<Entity name="ScoreBoard_Spectators">
|
||||
<Components>
|
||||
@@ -70,6 +308,98 @@
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="EndScreen">
|
||||
<Components>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="EndScreen_Origin">
|
||||
<Components>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="3.10000014" Z="42.9360008"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Camera">
|
||||
<Components>
|
||||
<c:Camera/>
|
||||
<c:EndScreen/>
|
||||
<c:Transform/>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="Sprite_Origin">
|
||||
<Components>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="0.65200001" Z="-1.72800004"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children>
|
||||
<Entity name="SpriteRed">
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<Model>Models/Core/UnitQuad.mesh</Model>
|
||||
<GlowMap></GlowMap>
|
||||
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||
<BlurBackground>true</BlurBackground>
|
||||
<Color A="0.588235319" B="0" G="0" R="0.588235319"/>
|
||||
<Visible>false</Visible>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Scale X="1.30000007" Y="0.300000012" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="SpriteBlue">
|
||||
<Components>
|
||||
<c:Sprite>
|
||||
<Model>Models/Core/UnitQuad.mesh</Model>
|
||||
<GlowMap></GlowMap>
|
||||
<DiffuseTexture>Textures/Core/White.png</DiffuseTexture>
|
||||
<BlurBackground>true</BlurBackground>
|
||||
<Color A="0.588235319" B="0.588235319" G="0" R="0"/>
|
||||
</c:Sprite>
|
||||
<c:Transform>
|
||||
<Scale X="1.30000007" Y="0.300000012" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="TextBlue">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Blue team win!</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
<Visible>false</Visible>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="-0.0670000017" Z="0.0299999993"/>
|
||||
<Scale X="0.150000006" Y="0.150000006" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
<Entity name="TextRed">
|
||||
<Components>
|
||||
<c:Text>
|
||||
<Content>Red team win!</Content>
|
||||
<Resource>Fonts/DroidSans.ttf,64</Resource>
|
||||
</c:Text>
|
||||
<c:Transform>
|
||||
<Position X="0" Y="-0.0670000017" Z="0.0299999993"/>
|
||||
<Scale X="0.150000006" Y="0.150000006" Z="1"/>
|
||||
</c:Transform>
|
||||
</Components>
|
||||
<Children/>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
</Entity>
|
||||
</Children>
|
||||
|
||||
</Entity>
|
||||
|
||||
@@ -24,14 +24,14 @@ void FadeSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& cFade,
|
||||
currentTime += dTime;
|
||||
|
||||
if(currentTime > fadeTime) {
|
||||
currentTime = 0.0;
|
||||
currentTime = 0.0 + fadeTime * (bool)cFade["Loop"];
|
||||
if ((bool)cFade["Reverse"]) {
|
||||
(Field<bool>)cFade["Out"] = !(bool)cFade["Out"];
|
||||
currentTime = fadeTime;
|
||||
}
|
||||
}
|
||||
if(currentTime < 0.0) {
|
||||
currentTime = fadeTime;
|
||||
currentTime = fadeTime * (bool)cFade["Loop"];
|
||||
if ((bool)cFade["Reverse"]) {
|
||||
(Field<bool>)cFade["Out"] = !(bool)cFade["Out"];
|
||||
currentTime = 0.0;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
PlayerMovementSystem::PlayerMovementSystem(SystemParams params)
|
||||
: System(params)
|
||||
, m_SprintEffectTimer(0.f)
|
||||
, m_DashEffectTimer(0.f)
|
||||
{
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &PlayerMovementSystem::OnPlayerSpawned);
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EDoubleJump, &PlayerMovementSystem::OnDoubleJump);
|
||||
@@ -24,23 +25,57 @@ void PlayerMovementSystem::Update(double dt)
|
||||
if (LocalPlayer.Valid()){
|
||||
updateVelocity(LocalPlayer, dt);
|
||||
}
|
||||
|
||||
|
||||
m_SprintEffectTimer += dt;
|
||||
if (m_SprintEffectTimer < 0.016f) {
|
||||
//m_SprintEffectTimer += dt;
|
||||
//if (m_SprintEffectTimer < 0.016f) {
|
||||
// return;
|
||||
//}
|
||||
//m_SprintEffectTimer = 0.f;
|
||||
//auto pool = m_World->GetComponents("SprintAbility");
|
||||
//if (pool == nullptr) {
|
||||
// return;
|
||||
//}
|
||||
//for (auto cSprint : *pool) {
|
||||
// if (cSprint.EntityID != LocalPlayer.ID && (bool)cSprint["Active"]) {
|
||||
// // Spawn one afterimage for each player that sprints.
|
||||
// EntityWrapper player(m_World, cSprint.EntityID);
|
||||
// auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/SprintEffect.xml");
|
||||
// EntityWrapper sprintEffect = entityFile->MergeInto(m_World);
|
||||
// auto playerModel = player.FirstChildByName("PlayerModel");
|
||||
// if (!playerModel.Valid()) {
|
||||
// continue;
|
||||
// }
|
||||
// if (!playerModel.HasComponent("Model")) {
|
||||
// continue;
|
||||
// }
|
||||
// if (!playerModel.HasComponent("Animation")) {
|
||||
// continue;
|
||||
// }
|
||||
// auto playerEntityModel = playerModel["Model"];
|
||||
// auto playerEntityAnimation = playerModel["Animation"];
|
||||
// playerEntityModel.Copy(sprintEffect["Model"]);
|
||||
// playerEntityAnimation.Copy(sprintEffect["Animation"]);
|
||||
// sprintEffect["ExplosionEffect"]["EndColor"] = (glm::vec4)playerEntityModel["Color"];
|
||||
// ((Field<glm::vec4>)sprintEffect["ExplosionEffect"]["EndColor"]).w(0.f);
|
||||
// sprintEffect["Animation"]["Speed1"] = 0.0;
|
||||
// sprintEffect["Animation"]["Speed2"] = 0.0;
|
||||
// sprintEffect["Animation"]["Speed3"] = 0.0;
|
||||
// sprintEffect["Transform"]["Position"] = (glm::vec3)player["Transform"]["Position"];
|
||||
// sprintEffect["Transform"]["Orientation"] = (glm::vec3)player["Transform"]["Orientation"];
|
||||
// }
|
||||
//}
|
||||
m_DashEffectTimer += dt;
|
||||
if (m_DashEffectTimer < 0.075f) {
|
||||
return;
|
||||
}
|
||||
m_SprintEffectTimer = 0.f;
|
||||
auto pool = m_World->GetComponents("SprintAbility");
|
||||
m_DashEffectTimer = 0.f;
|
||||
auto pool = m_World->GetComponents("DashAbility");
|
||||
if (pool == nullptr) {
|
||||
return;
|
||||
}
|
||||
for (auto cSprint : *pool) {
|
||||
if (cSprint.EntityID != LocalPlayer.ID && (bool)cSprint["Active"]) {
|
||||
// Spawn one afterimage for each player that sprints.
|
||||
EntityWrapper player(m_World, cSprint.EntityID);
|
||||
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/SprintEffect.xml");
|
||||
EntityWrapper sprintEffect = entityFile->MergeInto(m_World);
|
||||
for (auto cDash : *pool) {
|
||||
if (cDash.EntityID != LocalPlayer.ID && (double)cDash["CoolDownMaxTimer"] - (double)cDash["CoolDownTimer"] < 0.5) {
|
||||
// Spawn one afterimage for each player that Dashes.
|
||||
EntityWrapper player(m_World, cDash.EntityID);
|
||||
auto playerModel = player.FirstChildByName("PlayerModel");
|
||||
if (!playerModel.Valid()) {
|
||||
continue;
|
||||
@@ -48,20 +83,28 @@ void PlayerMovementSystem::Update(double dt)
|
||||
if (!playerModel.HasComponent("Model")) {
|
||||
continue;
|
||||
}
|
||||
if (!playerModel.HasComponent("Animation")) {
|
||||
continue;
|
||||
EntityWrapper dashEffect = playerModel.Clone();
|
||||
for (auto& cAnim : dashEffect.ChildrenWithComponent("Animation")) {
|
||||
cAnim["Animation"]["Play"] = false;
|
||||
}
|
||||
auto playerEntityModel = playerModel["Model"];
|
||||
auto playerEntityAnimation = playerModel["Animation"];
|
||||
playerEntityModel.Copy(sprintEffect["Model"]);
|
||||
playerEntityAnimation.Copy(sprintEffect["Animation"]);
|
||||
sprintEffect["ExplosionEffect"]["EndColor"] = (glm::vec4)playerEntityModel["Color"];
|
||||
((Field<glm::vec4>)sprintEffect["ExplosionEffect"]["EndColor"]).w(0.f);
|
||||
sprintEffect["Animation"]["Speed1"] = 0.0;
|
||||
sprintEffect["Animation"]["Speed2"] = 0.0;
|
||||
sprintEffect["Animation"]["Speed3"] = 0.0;
|
||||
sprintEffect["Transform"]["Position"] = (glm::vec3)player["Transform"]["Position"];
|
||||
sprintEffect["Transform"]["Orientation"] = (glm::vec3)player["Transform"]["Orientation"];
|
||||
const double fadeTime = 0.5f;
|
||||
for (auto& cModel : dashEffect.ChildrenWithComponent("Model")) {
|
||||
EntityWrapper e(m_World, cModel.ID);
|
||||
e.AttachComponent("Lifetime");
|
||||
e.AttachComponent("Fade");
|
||||
e["Fade"]["Loop"] = false;
|
||||
e["Fade"]["FadeTime"] = fadeTime;
|
||||
e["Fade"]["Time"] = fadeTime;
|
||||
e["Lifetime"]["Lifetime"] = fadeTime;
|
||||
}
|
||||
dashEffect.AttachComponent("Lifetime");
|
||||
dashEffect.AttachComponent("Fade");
|
||||
dashEffect["Fade"]["Loop"] = false;
|
||||
dashEffect["Fade"]["FadeTime"] = fadeTime;
|
||||
dashEffect["Fade"]["Time"] = fadeTime;
|
||||
dashEffect["Lifetime"]["Lifetime"] = fadeTime;
|
||||
dashEffect["Transform"]["Position"] = (glm::vec3)player["Transform"]["Position"];
|
||||
dashEffect["Transform"]["Orientation"] = (glm::vec3)player["Transform"]["Orientation"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user