aboutsummaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2024-03-17 09:26:25 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-03-17 13:12:19 +0100
commit601474aa84cfc071c724051ac121e3c9cc796577 (patch)
tree058728022e968100e5a2314d5cc2e16de0f3bfee /src/shared
parent4f9957fc6b4bdb4c7430f878101b07051b40a2ff (diff)
feat: skillshots
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/imperative.rs3
-rw-r--r--src/shared/projectile.rs29
2 files changed, 27 insertions, 5 deletions
diff --git a/src/shared/imperative.rs b/src/shared/imperative.rs
index 256ea1a..61a4762 100644
--- a/src/shared/imperative.rs
+++ b/src/shared/imperative.rs
@@ -6,7 +6,8 @@ use serde::Serialize;
pub enum Imperative {
Idle,
WalkTo(Vec2),
- Attack(AttackKey, PlayerId),
+ AttackTarget(AttackKey, PlayerId),
+ AttackDirection(AttackKey, Vec2),
}
#[derive(Resource, Copy, Clone, PartialEq, Debug, Deserialize, Serialize)]
diff --git a/src/shared/projectile.rs b/src/shared/projectile.rs
index 16a064a..f944e8a 100644
--- a/src/shared/projectile.rs
+++ b/src/shared/projectile.rs
@@ -3,17 +3,38 @@ use crate::shared::*;
#[derive(Bundle)]
pub struct ProjectileBundle {
pub projectile: Projectile,
- pub position: ProjectilePosition,
pub replicate: Replicate,
}
#[derive(Component, Message, Serialize, Deserialize, Clone, Debug, PartialEq)]
+
pub struct Projectile {
- pub target_player: PlayerId,
+ pub type_: ProjectileType,
pub source_player: PlayerId,
pub damage: f32,
- pub instant: bool,
}
#[derive(Component, Message, Serialize, Deserialize, Clone, Debug, PartialEq)]
-pub struct ProjectilePosition(pub Vec2);
+pub enum ProjectileType {
+ Free(FreeProjectile),
+ Instant(InstantProjectile),
+ Targeted(TargetedProjectile),
+}
+
+#[derive(Component, Message, Serialize, Deserialize, Clone, Debug, PartialEq)]
+pub struct FreeProjectile {
+ pub position: Vec2,
+ pub direction: Vec2,
+ pub starting_position: Vec2,
+}
+
+#[derive(Component, Message, Serialize, Deserialize, Clone, Debug, PartialEq)]
+pub struct InstantProjectile {
+ pub target_player: PlayerId,
+}
+
+#[derive(Component, Message, Serialize, Deserialize, Clone, Debug, PartialEq)]
+pub struct TargetedProjectile {
+ pub target_player: PlayerId,
+ pub position: Vec2,
+}