//! The `GroundPool` entity — a stationary, behavior-carrying field (acid, slow, ...). A pool
//! is NOT an enum of kinds; it's a stationary projectile carrying the same composable behavior
//! list, so "acid pool" and "slow field" are configured *instances*. The `PoolBehavior` trait
//! and dispatch live in `crate::behavior::pool`; concrete ticks live in `crate::pools`.
use macroquad::math::Vec2;
use crate::{
behavior::pool::PoolBehavior,
pools::{acid::AcidTick, slow::SlowTick},
types::Source,
};
#[derive(Clone)]
pub struct GroundPool {
pub pos: Vec2,
pub radius: f32,
pub ttl: f32,
pub source: Source,
pub behaviors: Vec<Box<dyn PoolBehavior>>,
}
impl GroundPool {
pub fn acid(pos: Vec2, potency: f32, source: Source) -> GroundPool {
GroundPool {
pos,
radius: 1.5,
ttl: 5.0,
source,
behaviors: vec![Box::new(AcidTick { potency })],
}
}
pub fn slow(pos: Vec2, radius: f32, factor: f32, source: Source) -> GroundPool {
GroundPool {
pos,
radius,
ttl: 4.0,
source,
behaviors: vec![Box::new(SlowTick { factor })],
}
}
}