Fully working wrappers
This commit is contained in:
parent
ba78ce8502
commit
a57bdc52d0
5 changed files with 92 additions and 28 deletions
|
|
@ -1,27 +1,43 @@
|
|||
use crate::genetics::{gene::{Gene, GenePlace}, genome::Genome};
|
||||
use crate::genetics::{gene::{Gene, GenePlace, GeneSource, GeneType}, genome::Genome};
|
||||
use godot::builtin::Vector2;
|
||||
|
||||
pub fn peashooter_template() -> Genome {
|
||||
Genome::from_edges(vec![
|
||||
Gene::new()
|
||||
Gene::new(GeneSource::Peashooter, GenePlace::Root, GeneType::pure_producer(|_|{todo!()}), "peashooter/peashooter_base.tres".to_string(), get_place_base),
|
||||
Gene::new(GeneSource::Peashooter, GenePlace::Stem, GeneType::fill_all(),"peashooter/peashooter_stem.tres".to_string(),get_place_stem),
|
||||
Gene::new(GeneSource::Peashooter, GenePlace::Head, GeneType::fill_all(),"peashooter/peashooter_head.tres".to_string(),get_place_head),
|
||||
Gene::visible(GeneSource::Peashooter, GenePlace::Eyes, GeneType::Structural,"peashooter/peashooter_eyes.tres".to_string()),
|
||||
Gene::visible(GeneSource::Peashooter, GenePlace::Mouth, GeneType::consumer(|_|{}), "peashooter/peashooter_mouth.tres".to_string()),
|
||||
Gene::visible(GeneSource::Peashooter, GenePlace::Leaf, GeneType::modifier(|_|{todo!()}), "peashooter/peashooter_leaf.tres".to_string()),
|
||||
], vec![
|
||||
|
||||
])
|
||||
(0,1),
|
||||
(1,2),
|
||||
(2,3),
|
||||
(2,4),
|
||||
(2,5)
|
||||
]).unwrap()
|
||||
}
|
||||
|
||||
fn get_place_base(place: GenePlace) -> Vector2 {
|
||||
Vector2::ZERO
|
||||
match place {
|
||||
GenePlace::Stem => Vector2::new(-1.5,-10.5),
|
||||
_ => Vector2::ZERO,
|
||||
}
|
||||
}
|
||||
|
||||
fn get_place_stem(place: GenePlace) -> Vector2 {
|
||||
Vector2::ZERO
|
||||
match place {
|
||||
GenePlace::Head => Vector2::new(4.,-15.),
|
||||
_ => Vector2::ZERO,
|
||||
}
|
||||
}
|
||||
|
||||
fn get_place_head(place: GenePlace) -> Vector2 {
|
||||
Vector2::ZERO
|
||||
}
|
||||
|
||||
fn get_place_leaf(place: GenePlace) -> Vector2 {
|
||||
Vector2::ZERO
|
||||
match place {
|
||||
GenePlace::Eyes => Vector2::new(1.5,-3.5),
|
||||
GenePlace::Leaf => Vector2::new(-12.,-13.),
|
||||
GenePlace::Mouth => Vector2::new(6.5,5.),
|
||||
_ => Vector2::ZERO,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue