blob: d6feb6c1623bfa32d6368804971311c4caac275d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
use downcast::Any;
pub trait Mass : Any {
fn name(&self) -> &String;
fn position(&self) -> (f64, f64, f64);
fn serialize(&self) -> String;
fn process(&mut self);
fn slow(&mut self);
fn give_acceleration(&mut self, acceleration : (f64, f64, f64));
fn box_clone(&self) -> Box<Mass>;
fn range(&self) -> f64;
fn give_target(&mut self, target : Option<usize>);
}
impl Clone for Box<Mass> {
fn clone(&self) -> Box<Mass> {
self.box_clone()
}
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum Type {
Ship,
Astroid,
}
downcast!(Mass);
|