diff options
author | Alexander Foremny <aforemny@posteo.de> | 2024-03-17 09:26:25 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2024-03-17 13:12:19 +0100 |
commit | 601474aa84cfc071c724051ac121e3c9cc796577 (patch) | |
tree | 058728022e968100e5a2314d5cc2e16de0f3bfee /src/shared/projectile.rs | |
parent | 4f9957fc6b4bdb4c7430f878101b07051b40a2ff (diff) |
feat: skillshots
Diffstat (limited to 'src/shared/projectile.rs')
-rw-r--r-- | src/shared/projectile.rs | 29 |
1 files changed, 25 insertions, 4 deletions
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, +} |