use crate::shared::activation::*; use crate::shared::buffs::*; use crate::shared::faction::*; use crate::shared::immovable::*; use crate::shared::player::*; use crate::shared::shape::*; use crate::shared::stats::*; use crate::shared::*; #[derive(Bundle)] pub struct TowerBundle { id: PlayerId, position: PlayerPosition, color: PlayerColor, imperative: Imperative, cooldown: Cooldown, health: Health, champion: Champion, effective_stats: EffectiveStats, buffs: Buffs, activation: Activation, shape: Shape, tower: Tower, immovable: Immovable, faction: Faction, replicate: Replicate, } impl TowerBundle { pub fn new(id: ClientId, position: Vec2, faction: Faction) -> Self { let mut replicate = Replicate { replication_group: ReplicationGroup::default().set_priority(10.), ..Default::default() }; replicate.enable_replicate_once::(); replicate.enable_replicate_once::(); replicate.target::(NetworkTarget::Single(id)); replicate.target::(NetworkTarget::Single(id)); replicate.target::(NetworkTarget::Single(id)); let champion = Champion::Tower; let effective_stats = EffectiveStats(champion.base_stats().0); TowerBundle { id: PlayerId(id), position: PlayerPosition(position), color: PlayerColor(faction.to_color()), imperative: Imperative::Idle, cooldown: Cooldown::default(), health: Health { health: effective_stats.0.max_health, shield: 0., }, champion, effective_stats, buffs: Buffs::default(), activation: Activation::default(), shape: Shape::tower(), tower: Tower::default(), immovable: Immovable, faction, replicate, } } } #[derive(Component, Default)] pub struct Tower { pub last_target: Option, } #[derive(Component, Clone, Copy)] pub struct LastTarget { pub entity: Entity, pub player_id: PlayerId, }