property array for animal (traits sync and send are not yet implemented)

This commit is contained in:
Rendo 2025-02-15 22:01:40 +05:00
commit ba9be4e17b
2 changed files with 10 additions and 6 deletions

View file

@ -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>>
}

View file

@ -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!(),