use std::cell::RefCell; use std::rc::Rc; use skunk2d::{Image, Vec2}; use crate::unit::Unit; pub struct UnitKind { pub sprite: Rc, pub name: String } impl UnitKind { pub fn new(name: &str) -> Rc { UnitKind { sprite: Image::load(format!("assets/units/{}.gif", name).as_str()), name: name.into() }.into() } pub fn spawn(self: Rc, pos: Vec2) -> Rc> { RefCell::new(Unit { kind: self, pos }).into() } }