forked from 2ndbeam/evolution-rs
property array for animal (traits sync and send are not yet implemented)
This commit is contained in:
parent
a3d619bdd0
commit
ba9be4e17b
2 changed files with 10 additions and 6 deletions
|
|
@ -1,6 +1,9 @@
|
|||
use bevy::prelude::*;
|
||||
|
||||
use crate::properties::Property;
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct Animal {
|
||||
//pub properties: Vec<тут крч пропертис>
|
||||
pub properties: Vec<Box<dyn Property>>
|
||||
}
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
|
||||
// Базовый трейт для свойства животного
|
||||
// Интересно, будет ли участвовать в моддинге
|
||||
pub trait Property {
|
||||
fn check_condition<T>(self : &Self,conditions: T) -> bool;
|
||||
fn trigger<T>(self : &Self, data: T);
|
||||
pub trait Property: Sync + Send {
|
||||
fn check_condition(self : &Self) -> bool;
|
||||
fn trigger(self : &Self);
|
||||
}
|
||||
|
||||
pub enum BaseProperties
|
||||
|
|
@ -27,7 +28,7 @@ pub enum BaseProperties
|
|||
}
|
||||
|
||||
impl Property for BaseProperties {
|
||||
fn check_condition<T>(self : &Self, conditions: T) -> bool {
|
||||
fn check_condition(self : &Self) -> bool {
|
||||
match self
|
||||
{
|
||||
BaseProperties::Swimmings => todo!(),
|
||||
|
|
@ -50,7 +51,7 @@ impl Property for BaseProperties {
|
|||
}
|
||||
}
|
||||
|
||||
fn trigger<T>(self : &Self, data: T) {
|
||||
fn trigger(self : &Self) {
|
||||
match self
|
||||
{
|
||||
BaseProperties::Swimmings => todo!(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue