Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4e23e7bf30 | |||
| a8ab49f202 | |||
| a53ab7f745 | |||
| b6b96c5f11 |
@@ -55,6 +55,7 @@ protected:
|
|||||||
//specialabilitys
|
//specialabilitys
|
||||||
bool m_MovementKeyDown = false;
|
bool m_MovementKeyDown = false;
|
||||||
bool m_SpecialAbilityKeyDown = false;
|
bool m_SpecialAbilityKeyDown = false;
|
||||||
|
int m_NumberOfMovementKeysDown = 0;
|
||||||
|
|
||||||
EventRelay<EventContext, Events::LockMouse> m_ELockMouse;
|
EventRelay<EventContext, Events::LockMouse> m_ELockMouse;
|
||||||
bool OnLockMouse(const Events::LockMouse& e);
|
bool OnLockMouse(const Events::LockMouse& e);
|
||||||
@@ -132,6 +133,7 @@ bool FirstPersonInputController<EventContext>::OnCommand(const Events::InputComm
|
|||||||
}
|
}
|
||||||
//if value = 0 then you have just released this key
|
//if value = 0 then you have just released this key
|
||||||
if (e.Value != 0) {
|
if (e.Value != 0) {
|
||||||
|
m_NumberOfMovementKeysDown++;
|
||||||
m_MovementKeyDown = true;
|
m_MovementKeyDown = true;
|
||||||
//if you pressed the same key within m_AssaultDashDoubleTapSensitivityTimer then you have doubletapped it
|
//if you pressed the same key within m_AssaultDashDoubleTapSensitivityTimer then you have doubletapped it
|
||||||
if (m_AssaultDashDoubleTapDeltaTime < m_AssaultDashDoubleTapSensitivityTimer && m_AssaultDashTapDirection == m_CurrentDirectionVector) {
|
if (m_AssaultDashDoubleTapDeltaTime < m_AssaultDashDoubleTapSensitivityTimer && m_AssaultDashTapDirection == m_CurrentDirectionVector) {
|
||||||
@@ -139,10 +141,14 @@ bool FirstPersonInputController<EventContext>::OnCommand(const Events::InputComm
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//== 0
|
//== 0
|
||||||
m_MovementKeyDown = false;
|
m_NumberOfMovementKeysDown--;
|
||||||
//you have just released the key, store what key it was and reset the doubletap-sensitivity-timer
|
if (m_NumberOfMovementKeysDown == 0) {
|
||||||
m_AssaultDashTapDirection = m_CurrentDirectionVector;
|
m_MovementKeyDown = false;
|
||||||
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
}
|
||||||
|
//you have just released the key, store what key it was and reset the doubletap-sensitivity-timer
|
||||||
|
m_AssaultDashTapDirection = m_CurrentDirectionVector;
|
||||||
|
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,12 +208,6 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
|
|||||||
m_AssaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
m_AssaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
|
||||||
m_AssaultDashDoubleTapped = true;
|
m_AssaultDashDoubleTapped = true;
|
||||||
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
m_AssaultDashDoubleTapDeltaTime = 0.f;
|
||||||
//moving to the side has priority
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//dashing with doubletap - check if doubletap to dash enabled
|
|
||||||
if (ResourceManager::Load<ConfigFile>("Input.ini")->Get<bool>("Keyboard.DoubleTapToDash", false)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,6 +216,11 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
|
|||||||
m_AssaultDashDoubleTapped = false;
|
m_AssaultDashDoubleTapped = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//dashing with doubletap - check if doubletap to dash enabled
|
||||||
|
if (!ResourceManager::Load<ConfigFile>("Input.ini")->Get<bool>("Keyboard.DoubleTapToDash", false)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//check if we have received a valid doubletap
|
//check if we have received a valid doubletap
|
||||||
if (!m_ValidDoubleTap) {
|
if (!m_ValidDoubleTap) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -7,6 +7,9 @@
|
|||||||
#include "Events/EDoubleJump.h"
|
#include "Events/EDoubleJump.h"
|
||||||
#include "../Engine/Sound/EPlaySoundOnEntity.h"
|
#include "../Engine/Sound/EPlaySoundOnEntity.h"
|
||||||
|
|
||||||
|
#include "Core/EntityFile.h"
|
||||||
|
#include "Core/EntityFileParser.h"
|
||||||
|
|
||||||
class PlayerMovementSystem : public ImpureSystem
|
class PlayerMovementSystem : public ImpureSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
Sensitivity=0.5
|
Sensitivity=0.5
|
||||||
InvertPitch=false
|
InvertPitch=false
|
||||||
|
|
||||||
|
[Keyboard]
|
||||||
|
DoubleTapToDash=false
|
||||||
|
|
||||||
[Bindings]
|
[Bindings]
|
||||||
MouseLeft=PrimaryFire
|
MouseLeft=PrimaryFire
|
||||||
MouseX=Yaw
|
MouseX=Yaw
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Effects/JumpEffectHexagon.mesh</Resource>
|
||||||
|
<Color A="0.576470613" B="500" G="255" R="0.854901969"/>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0.600000024" Y="0.800000012" Z="0"/>
|
||||||
|
<Scale X="0.50000012" Y="0.50000019" Z="0.50000014"/>
|
||||||
|
</c:Transform>
|
||||||
|
<c:Lifetime>
|
||||||
|
<Lifetime>0.5</Lifetime>
|
||||||
|
</c:Lifetime>
|
||||||
|
<c:ExplosionEffect>
|
||||||
|
<ColorByDistance>true</ColorByDistance>
|
||||||
|
<Velocity X="0" Y="-7.76300049" Z="0"/>
|
||||||
|
<ExplosionOrigin X="0" Y="2.67900002" Z="0"/>
|
||||||
|
<ExponentialAccelaration>true</ExponentialAccelaration>
|
||||||
|
<ExplosionDuration>0.5</ExplosionDuration>
|
||||||
|
<EndColor A="0" B="0" G="0" R="1"/>
|
||||||
|
<Randomness>true</Randomness>
|
||||||
|
</c:ExplosionEffect>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children/>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -109,9 +109,15 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
|
|||||||
//you cant jump and dash at the same time - since there is no friction in the air and we would thus dash much further in the air
|
//you cant jump and dash at the same time - since there is no friction in the air and we would thus dash much further in the air
|
||||||
if (!controller->PlayerIsDashing() && controller->Jumping() && !controller->Crouching() && (isOnGround || !controller->DoubleJumping())) {
|
if (!controller->PlayerIsDashing() && controller->Jumping() && !controller->Crouching() && (isOnGround || !controller->DoubleJumping())) {
|
||||||
(bool)cPhysics["IsOnGround"] = false;
|
(bool)cPhysics["IsOnGround"] = false;
|
||||||
if (velocity.y == 0.f) {
|
if (isOnGround) {
|
||||||
controller->SetDoubleJumping(false);
|
controller->SetDoubleJumping(false);
|
||||||
} else {
|
} else {
|
||||||
|
//put a hexagon at the players feet
|
||||||
|
auto hexagonEffect = ResourceManager::Load<EntityFile>("Schema/Entities/DoubleJumpHexagon.xml");
|
||||||
|
EntityFileParser parser(hexagonEffect);
|
||||||
|
EntityID hexagonEffectID = parser.MergeEntities(m_World);
|
||||||
|
EntityWrapper hexagonEW = EntityWrapper(m_World, hexagonEffectID);
|
||||||
|
hexagonEW["Transform"]["Position"] = (glm::vec3)player["Transform"]["Position"];
|
||||||
controller->SetDoubleJumping(true);
|
controller->SetDoubleJumping(true);
|
||||||
Events::DoubleJump e;
|
Events::DoubleJump e;
|
||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
|
|||||||
Reference in New Issue
Block a user