76 lines
2.2 KiB
Rust
76 lines
2.2 KiB
Rust
use bevy::prelude::*;
|
|
|
|
// --- Components ---
|
|
#[derive(Component)]
|
|
pub struct Player {
|
|
pub speed: f32,
|
|
pub shoot_cooldown: Timer,
|
|
}
|
|
|
|
#[derive(Component)]
|
|
pub struct Bullet;
|
|
|
|
#[derive(Component, Clone, Copy, PartialEq, Eq, Debug)] // Added derive for common traits
|
|
pub enum EnemyType {
|
|
Grunt,
|
|
Boss, // Added Boss type
|
|
}
|
|
|
|
#[derive(Component)]
|
|
pub struct Enemy {
|
|
pub enemy_type: EnemyType, // Add type field
|
|
pub shoot_cooldown: Timer,
|
|
}
|
|
|
|
#[derive(Component)]
|
|
pub struct Invincible {
|
|
pub timer: Timer,
|
|
}
|
|
|
|
// New component to mark a player as captured by a Boss enemy
|
|
#[derive(Component, Clone)] // Added Clone derive
|
|
pub struct Captured {
|
|
// Reference to the capturing boss entity
|
|
pub boss_entity: Entity,
|
|
// Timer for how long the player remains captured
|
|
pub timer: Timer,
|
|
}
|
|
|
|
// New component for the tractor beam visual effect
|
|
#[derive(Component)]
|
|
pub struct TractorBeam {
|
|
pub target: Entity, // The entity being targeted (usually player)
|
|
pub timer: Timer, // How long the beam lasts
|
|
pub width: f32, // Visual width of the beam
|
|
pub active: bool, // Whether the beam is currently active
|
|
}
|
|
|
|
#[derive(Component)]
|
|
pub struct FormationTarget {
|
|
pub position: Vec3,
|
|
}
|
|
|
|
// Enum defining different ways an enemy can attack
|
|
#[derive(Component, Clone, Copy, PartialEq, Debug)]
|
|
pub enum AttackPattern {
|
|
SwoopDive, // Original pattern: dive towards center, then off screen
|
|
DirectDive, // Dive straight down
|
|
Kamikaze(Vec3), // Dive towards a specific target location (e.g., player's last known position) - Needs target Vec3
|
|
CaptureBeam, // New pattern: Boss dives and attempts to capture the player with a tractor beam
|
|
// Add more patterns later (e.g., FigureEight, Looping)
|
|
}
|
|
|
|
#[derive(Component, Clone, PartialEq, Debug)] // Added Debug derive
|
|
pub enum EnemyState {
|
|
Entering, // Flying onto the screen towards formation target
|
|
InFormation, // Holding position in the formation
|
|
Attacking(AttackPattern), // Diving towards the player using a specific pattern
|
|
}
|
|
|
|
#[derive(Component)]
|
|
pub struct EnemyBullet;
|
|
|
|
// Game Over UI Component (might move to ui.rs later if more UI exists)
|
|
#[derive(Component)]
|
|
pub struct GameOverUI;
|