diff --git a/assets/games/rose/prefabs/Player.xml b/assets/games/rose/prefabs/Player.xml
index 86c8323a..ff75f0f5 100644
--- a/assets/games/rose/prefabs/Player.xml
+++ b/assets/games/rose/prefabs/Player.xml
@@ -8,6 +8,7 @@
+
diff --git a/src/dawnrose/scene/components/PlayerController.cpp b/src/dawnrose/scene/components/PlayerController.cpp
index a9c138ab..b00737bf 100644
--- a/src/dawnrose/scene/components/PlayerController.cpp
+++ b/src/dawnrose/scene/components/PlayerController.cpp
@@ -15,7 +15,8 @@ PlayerController::PlayerController(SceneItem *item) : SceneItemComponent(item) {
std::vector PlayerController::getDependencies() {
return {
(this->entityMove = item->getComponent()),
- (this->entitySwordAttack = item->getComponent())
+ (this->entitySwordAttack = item->getComponent()),
+ (this->entityShootingAttack = item->getComponent())
};
}
@@ -32,5 +33,9 @@ void PlayerController::onStart() {
if(this->entitySwordAttack != nullptr && getGame()->inputManager.isPressed(INPUT_BIND_ACCEPT)) {
this->entitySwordAttack->attack();
}
+
+ if(this->entityShootingAttack != nullptr && getGame()->inputManager.isPressed(INPUT_BIND_CANCEL)) {
+ this->entityShootingAttack->attack();
+ }
}, getScene()->eventSceneUpdate);
}
\ No newline at end of file
diff --git a/src/dawnrose/scene/components/PlayerController.hpp b/src/dawnrose/scene/components/PlayerController.hpp
index 29fe79c5..df1d2724 100644
--- a/src/dawnrose/scene/components/PlayerController.hpp
+++ b/src/dawnrose/scene/components/PlayerController.hpp
@@ -6,12 +6,14 @@
#pragma once
#include "scene/components/entity/EntityMove.hpp"
#include "scene/components/entity/EntitySwordAttack.hpp"
+#include "scene/components/entity/EntityShootingAttack.hpp"
namespace Dawn {
class PlayerController : public SceneItemComponent {
protected:
EntityMove *entityMove = nullptr;
EntitySwordAttack *entitySwordAttack = nullptr;
+ EntityShootingAttack *entityShootingAttack = nullptr;
public:
PlayerController(SceneItem *item);
diff --git a/src/dawnrose/scene/components/entity/CMakeLists.txt b/src/dawnrose/scene/components/entity/CMakeLists.txt
index 36335f8f..95a41e1e 100644
--- a/src/dawnrose/scene/components/entity/CMakeLists.txt
+++ b/src/dawnrose/scene/components/entity/CMakeLists.txt
@@ -12,4 +12,5 @@ target_sources(${DAWN_TARGET_NAME}
EntityAttackBase.cpp
EntityFaction.cpp
EntitySwordAttack.cpp
+ EntityShootingAttack.cpp
)
\ No newline at end of file
diff --git a/src/dawnrose/scene/components/entity/EntityShootingAttack.cpp b/src/dawnrose/scene/components/entity/EntityShootingAttack.cpp
new file mode 100644
index 00000000..e524461c
--- /dev/null
+++ b/src/dawnrose/scene/components/entity/EntityShootingAttack.cpp
@@ -0,0 +1,47 @@
+// Copyright (c) 2023 Dominic Masters
+//
+// This software is released under the MIT License.
+// https://opensource.org/licenses/MIT
+
+#include "EntityShootingAttack.hpp"
+
+using namespace Dawn;
+
+EntityShootingAttack::EntityShootingAttack(SceneItem* item) : EntityAttackBase(item) {
+}
+
+void EntityShootingAttack::onStart() {
+ EntityAttackBase::onStart();
+
+ useEvent([&] {
+ std::cout << "Shoot!" << std::endl;
+ }, this->onAttackActiveStart);
+}
+
+void EntityShootingAttack::onDispose() {
+ EntityAttackBase::onDispose();
+}
+
+float_t EntityShootingAttack::getAttackRampUpDuration() {
+ return 0.1f;
+}
+
+float_t EntityShootingAttack::getAttackActiveDuration() {
+ return 0.2f;
+}
+
+float_t EntityShootingAttack::getAttackRampDownDuration() {
+ return 0.1f;
+}
+
+float_t EntityShootingAttack::getAttackCooldownDuration() {
+ return 0.0f;
+}
+
+bool_t EntityShootingAttack::isInterruptable() {
+ return false;
+}
+
+bool_t EntityShootingAttack::canAttack() {
+ return true;
+}
\ No newline at end of file
diff --git a/src/dawnrose/scene/components/entity/EntityShootingAttack.hpp b/src/dawnrose/scene/components/entity/EntityShootingAttack.hpp
new file mode 100644
index 00000000..2402dbaa
--- /dev/null
+++ b/src/dawnrose/scene/components/entity/EntityShootingAttack.hpp
@@ -0,0 +1,26 @@
+// Copyright (c) 2023 Dominic Masters
+//
+// This software is released under the MIT License.
+// https://opensource.org/licenses/MIT
+
+#pragma once
+#include "scene/components/entity/EntityAttackBase.hpp"
+
+namespace Dawn {
+ class EntityShootingAttack : public EntityAttackBase {
+ protected:
+
+ public:
+ EntityShootingAttack(SceneItem* item);
+
+ void onStart() override;
+ void onDispose() override;
+
+ float_t getAttackRampUpDuration() override;
+ float_t getAttackActiveDuration() override;
+ float_t getAttackRampDownDuration() override;
+ float_t getAttackCooldownDuration() override;
+ bool_t isInterruptable() override;
+ bool_t canAttack() override;
+ };
+}
\ No newline at end of file
diff --git a/src/dawnrose/scene/components/entity/EntitySwordAttack.hpp b/src/dawnrose/scene/components/entity/EntitySwordAttack.hpp
index 72004153..dbac9302 100644
--- a/src/dawnrose/scene/components/entity/EntitySwordAttack.hpp
+++ b/src/dawnrose/scene/components/entity/EntitySwordAttack.hpp
@@ -12,14 +12,11 @@ namespace Dawn {
class EntitySwordAttack : public EntityAttackBase {
protected:
- float_t attackTime = -1;
SwordHitbox *hurtboxItem = nullptr;
public:
// @optional
glm::vec3 attackOffset = glm::vec3(0,0,1);
- // @optional
- glm::vec3 attackSize = glm::vec3(1,1,1);
EntitySwordAttack(SceneItem* item);