No description
| src | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| README.md | ||
| ron.toml | ||
| rust-toolchain.toml | ||
予言の鳥
a dialogue plugin for bevy
Usage
use bevy::prelude::*;
use yogen_no_tori::prelude::*;
fn main() {
App::new()
.add_plugins(
DefaultPlugins,
// add the plugin
DialoguePlugin
)
.add_system(Startup, spawn_dialogue)
.run();
}
fn spawn_dialogue(mut commands: Commands) {
// create a new graph
let dialogue = ActionGraph::build()
// add action nodes
.start_with_text("A kitsune is standing in front of you.")
.followed_by_choice()
.followed_by_many(|choice| {
choice.followed_by_text("hi?", "<your wallet is missing>")
.end();
choice.followed_by_text("go away you nasty thing", "<your soul is missing>")
.end();
choice.followed_by_text("<pat the kitsune>", "aaaa! <33")
.followed_by_text("The kitsune leaves happily.")
.followed_by_text("...")
.followed_by_text("<your wallet is missing>")
.end();
});
// spawn the graph
dialogue.spawn_dialogue(dialogue);
}