add example
This commit is contained in:
parent
2deec07a33
commit
8c055c5ccb
3 changed files with 24 additions and 0 deletions
|
|
@ -175,6 +175,11 @@ name = "ecs_ruby"
|
|||
path = "examples/ruby/ecs.rs"
|
||||
required-features = ["ruby"]
|
||||
|
||||
[[example]]
|
||||
name = "entity_variable_ruby"
|
||||
path = "examples/ruby/entity_variable.rs"
|
||||
required-features = ["ruby"]
|
||||
|
||||
[dev-dependencies]
|
||||
tracing-subscriber = "0.3.18"
|
||||
mlua = { version = "0.9.8", features = ["luajit", "vendored", "send"] }
|
||||
|
|
|
|||
2
assets/examples/ruby/entity_variable.rb
Normal file
2
assets/examples/ruby/entity_variable.rb
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# Bevy::Entity.current can be used to access the entity that is currently being processed
|
||||
puts("Current entity index: #{Bevy::Entity.current.index}")
|
||||
17
examples/ruby/entity_variable.rs
Normal file
17
examples/ruby/entity_variable.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
use bevy::prelude::*;
|
||||
use bevy_scriptum::runtimes::ruby::prelude::*;
|
||||
use bevy_scriptum::{prelude::*, BuildScriptingRuntime};
|
||||
|
||||
fn main() {
|
||||
App::new()
|
||||
.add_plugins(DefaultPlugins)
|
||||
.add_scripting::<RubyRuntime>(|_| {})
|
||||
.add_systems(Startup, startup)
|
||||
.run();
|
||||
}
|
||||
|
||||
fn startup(mut commands: Commands, assets_server: Res<AssetServer>) {
|
||||
commands.spawn(Script::<RubyScript>::new(
|
||||
assets_server.load("examples/ruby/entity_variable.rb"),
|
||||
));
|
||||
}
|
||||
Loading…
Reference in a new issue