Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improvements on AI, HA renderer, Overworld and related modules
- Loading branch information
Showing
120 changed files
with
4,033 additions
and
2,969 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use crate::resources::AiBehaviorMemory; | ||
use emergent::prelude::*; | ||
use oxygengine_core::{ | ||
ecs::Component, | ||
prefab::{Prefab, PrefabComponent}, | ||
Ignite, Scalar, | ||
}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Ignite, Default, Serialize, Deserialize)] | ||
pub struct AiInstance<C> | ||
where | ||
C: Component, | ||
{ | ||
pub template: String, | ||
#[serde(default)] | ||
pub decide_delay: Scalar, | ||
#[serde(skip)] | ||
#[ignite(ignore)] | ||
pub(crate) decide_phase: Scalar, | ||
#[serde(skip)] | ||
#[ignite(ignore)] | ||
pub(crate) decision_maker: Option<Box<dyn DecisionMakingTask<AiBehaviorMemory<C>>>>, | ||
} | ||
|
||
impl<C> AiInstance<C> | ||
where | ||
C: Component, | ||
{ | ||
pub fn new(template: impl ToString, decide_delay: Scalar) -> Self { | ||
Self { | ||
template: template.to_string(), | ||
decide_delay, | ||
decide_phase: 0.0, | ||
decision_maker: None, | ||
} | ||
} | ||
} | ||
|
||
impl<C> Prefab for AiInstance<C> where C: Component + Default {} | ||
|
||
impl<C> PrefabComponent for AiInstance<C> where C: Component + Default {} |
Oops, something went wrong.