1 个不稳定版本
0.1.0 | 2023年4月26日 |
---|
#1565 在 游戏开发
11KB
194 行
Micro Quest
用于构建任务和对话的结构和系统,可选的Bevy集成。
使用方法
安装
在您的 Cargo.toml
中包含
[dependencies]
micro-quest = { version = "0.1", features = ["bevy"] }
代码中
这个crate提供了与.quest
toml文件一起工作的结构,这些文件由Micro Forge(一个游戏资产编辑器)创建。
启用bevy
特性后,您将获得一个QuestLog
资源,以及.quest
文件的加载器。还有一个AssetServerQuestLocator
,它将使用资产服务器来定位任务(在解析ID到资产路径时将尝试尊重命名子资源)。
/* If you're using bevy, add the plugin to configure resources and loaders */
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(micro_quest::MicroQuestPlugin);
}
fn some_system(quest_log: Res<QuestLog>, assets: AssetServerQuestLocator) {
// Assuming that the quest has been added to the log at some other point
log::info!("My First Quest: {:?}", quest_log.get_quest_state("quests/QuestList#MyFirstQuest", assets));
}
依赖项
~0–40MB
~596K SLoC