-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
87 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,28 @@ | ||
use crate::prelude::*; | ||
use bevy::prelude::*; | ||
|
||
|
||
/// This does **not** trigger observers, making it safe from infinite loops | ||
/// Reattaches the [`RunOnSpawn`] component whenever [`OnRunResult`] is called. | ||
pub type Repeat = InsertOnRunResult<RunOnSpawn>; | ||
|
||
|
||
// /// This does **not** trigger observers, making it safe from infinite loops | ||
// /// Reattaches the [`RunOnSpawn`] component whenever [`OnRunResult`] is called. | ||
#[derive(Debug, Clone, PartialEq, Component, Action, Reflect)] | ||
#[reflect(Default, Component, ActionMeta)] | ||
#[category(ActionCategory::Behavior)] | ||
#[observers(repeat)] | ||
pub struct Repeat { | ||
// TODO times | ||
// pub times: RepeatAnimation, | ||
} | ||
|
||
impl Default for Repeat { | ||
fn default() -> Self { | ||
Self { | ||
// times: RepeatAnimation::Forever, | ||
} | ||
} | ||
} | ||
|
||
fn repeat(trigger: Trigger<OnRunResult>, mut commands: Commands) { | ||
commands.entity(trigger.entity()).insert(RunOnSpawn); | ||
} |
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