Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f147929aa9 |
@@ -27,7 +27,7 @@ public:
|
|||||||
virtual bool OnCommand(const Events::InputCommand& e) override;
|
virtual bool OnCommand(const Events::InputCommand& e) override;
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
|
|
||||||
void AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer);
|
void AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer, double& assaultDashCoolDownTimer);
|
||||||
virtual bool AssaultDashDoubleTapped() const { return m_AssaultDashDoubleTapped; }
|
virtual bool AssaultDashDoubleTapped() const { return m_AssaultDashDoubleTapped; }
|
||||||
virtual bool PlayerIsDashing() const { return m_PlayerIsDashing; }
|
virtual bool PlayerIsDashing() const { return m_PlayerIsDashing; }
|
||||||
|
|
||||||
@@ -41,7 +41,6 @@ protected:
|
|||||||
bool m_Crouching = false;
|
bool m_Crouching = false;
|
||||||
//assault dash membervariables - needed to calculate the doubletap- and dashlogic
|
//assault dash membervariables - needed to calculate the doubletap- and dashlogic
|
||||||
double m_AssaultDashDoubleTapDeltaTime = 0.0;
|
double m_AssaultDashDoubleTapDeltaTime = 0.0;
|
||||||
double m_AssaultDashCoolDownTimer = 0.0;
|
|
||||||
//i will let m_AssaultDashDoubleTapSensitivityTimer stay hardcoded, its not really a gamevariable (more an inputvariable),
|
//i will let m_AssaultDashDoubleTapSensitivityTimer stay hardcoded, its not really a gamevariable (more an inputvariable),
|
||||||
//and its very unlikely that someone wants to change that value
|
//and its very unlikely that someone wants to change that value
|
||||||
const float m_AssaultDashDoubleTapSensitivityTimer = 0.25f;
|
const float m_AssaultDashDoubleTapSensitivityTimer = 0.25f;
|
||||||
@@ -191,21 +190,21 @@ bool FirstPersonInputController<EventContext>::OnLockMouse(const Events::LockMou
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename EventContext>
|
template <typename EventContext>
|
||||||
void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer) {
|
void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer, double& assaultDashCoolDownTimer) {
|
||||||
m_AssaultDashDoubleTapDeltaTime += dt;
|
m_AssaultDashDoubleTapDeltaTime += dt;
|
||||||
m_AssaultDashCoolDownTimer -= dt;
|
assaultDashCoolDownTimer -= dt;
|
||||||
//cooldown = assaultDashCoolDownMaxTimer sec, pretend the dash lasts 0.25 sec (for friction to do its work)
|
//cooldown = assaultDashCoolDownMaxTimer sec, pretend the dash lasts 0.25 sec (for friction to do its work)
|
||||||
if (m_AssaultDashCoolDownTimer > (assaultDashCoolDownMaxTimer - 0.25f)) {
|
if (assaultDashCoolDownTimer > (assaultDashCoolDownMaxTimer - 0.25f)) {
|
||||||
m_PlayerIsDashing = true;
|
m_PlayerIsDashing = true;
|
||||||
} else {
|
} else {
|
||||||
m_PlayerIsDashing = false;
|
m_PlayerIsDashing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//dashing with shift
|
//dashing with shift
|
||||||
if (m_ShiftDashing && m_AssaultDashCoolDownTimer <= 0.0f) {
|
if (m_ShiftDashing && assaultDashCoolDownTimer <= 0.0f) {
|
||||||
//player is dashing with shift
|
//player is dashing with shift
|
||||||
//the wanted-direction is set in playermovement already so we dont need to check what direction we want to dash in!
|
//the wanted-direction is set in playermovement already so we dont need to check what direction we want to dash in!
|
||||||
m_AssaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
assaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
||||||
m_AssaultDashDoubleTapped = true;
|
m_AssaultDashDoubleTapped = true;
|
||||||
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
||||||
return;
|
return;
|
||||||
@@ -227,7 +226,7 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
|
|||||||
}
|
}
|
||||||
m_ValidDoubleTap = false;
|
m_ValidDoubleTap = false;
|
||||||
|
|
||||||
if (!(m_AssaultDashCoolDownTimer <= 0.0f)) {
|
if (!(assaultDashCoolDownTimer <= 0.0f)) {
|
||||||
//if we cant dash at the moment, then just reset the tap-sensitivity-timer
|
//if we cant dash at the moment, then just reset the tap-sensitivity-timer
|
||||||
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
||||||
return;
|
return;
|
||||||
@@ -235,7 +234,7 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
|
|||||||
//ok, we have a valid tap, lets do it
|
//ok, we have a valid tap, lets do it
|
||||||
m_AssaultDashDoubleTapped = true;
|
m_AssaultDashDoubleTapped = true;
|
||||||
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
||||||
m_AssaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
assaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
||||||
|
|
||||||
Events::DashAbility e;
|
Events::DashAbility e;
|
||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
<DashAbility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="DashAbility.xsd">
|
<DashAbility xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="DashAbility.xsd">
|
||||||
<CoolDownMaxTimer>2.0</CoolDownMaxTimer>
|
<CoolDownMaxTimer>2.0</CoolDownMaxTimer>
|
||||||
|
<CoolDownTimer>0.0</CoolDownTimer>
|
||||||
</DashAbility>
|
</DashAbility>
|
||||||
@@ -10,7 +10,10 @@
|
|||||||
<xs:complexType>
|
<xs:complexType>
|
||||||
<xs:all>
|
<xs:all>
|
||||||
<xs:element name="CoolDownMaxTimer" type="t:double" minOccurs="0">
|
<xs:element name="CoolDownMaxTimer" type="t:double" minOccurs="0">
|
||||||
<xs:annotation><xs:documentation>This is the cooldown on dash</xs:documentation></xs:annotation>
|
<xs:annotation><xs:documentation>This is the max cooldown on dash</xs:documentation></xs:annotation>
|
||||||
|
</xs:element>
|
||||||
|
<xs:element name="CoolDownTimer" type="t:double" minOccurs="0">
|
||||||
|
<xs:annotation><xs:documentation>This is the current cooldown on dash</xs:documentation></xs:annotation>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
</xs:all>
|
</xs:all>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
|
|||||||
EntityWrapper playerModel = player.FirstChildByName("PlayerModel");
|
EntityWrapper playerModel = player.FirstChildByName("PlayerModel");
|
||||||
if (playerModel.Valid()) {
|
if (playerModel.Valid()) {
|
||||||
ComponentWrapper cAnimationOffset = playerModel["AnimationOffset"];
|
ComponentWrapper cAnimationOffset = playerModel["AnimationOffset"];
|
||||||
float pitch = cameraOrientation.x + 0.2;
|
float pitch = cameraOrientation.x + 0.2f;
|
||||||
double time = (pitch + glm::half_pi<float>()) / glm::pi<float>();
|
double time = (pitch + glm::half_pi<float>()) / glm::pi<float>();
|
||||||
cAnimationOffset["Time"] = time;
|
cAnimationOffset["Time"] = time;
|
||||||
}
|
}
|
||||||
@@ -66,7 +66,7 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
|
|||||||
ComponentWrapper cPhysics = player["Physics"];
|
ComponentWrapper cPhysics = player["Physics"];
|
||||||
//Assault Dash Check
|
//Assault Dash Check
|
||||||
if (player.HasComponent("DashAbility")) {
|
if (player.HasComponent("DashAbility")) {
|
||||||
controller->AssaultDashCheck(dt, ((glm::vec3)cPhysics["Velocity"]).y != 0.0f, player["DashAbility"]["CoolDownMaxTimer"]);
|
controller->AssaultDashCheck(dt, ((glm::vec3)cPhysics["Velocity"]).y != 0.0f, player["DashAbility"]["CoolDownMaxTimer"], player["DashAbility"]["CoolDownTimer"]);
|
||||||
}
|
}
|
||||||
wishDirection = controller->Movement() * glm::inverse(glm::quat(ori));
|
wishDirection = controller->Movement() * glm::inverse(glm::quat(ori));
|
||||||
//this makes sure you can only dash in the 4 directions: forw,backw,left,right
|
//this makes sure you can only dash in the 4 directions: forw,backw,left,right
|
||||||
@@ -311,6 +311,7 @@ bool PlayerMovementSystem::OnDoubleJump(Events::DoubleJump & e)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
spawnHexagon(EntityWrapper(m_World, e.entityID));
|
spawnHexagon(EntityWrapper(m_World, e.entityID));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerMovementSystem::spawnHexagon(EntityWrapper target)
|
void PlayerMovementSystem::spawnHexagon(EntityWrapper target)
|
||||||
|
|||||||
Reference in New Issue
Block a user