From 601474aa84cfc071c724051ac121e3c9cc796577 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Sun, 17 Mar 2024 09:26:25 +0100 Subject: feat: skillshots --- src/shared/projectile.rs | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'src/shared/projectile.rs') 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, +} -- cgit v1.2.3