#dialog #systems #quest #micro #structures #game #quests

micro_quest

管理游戏对话与任务的结构和系统

1 个不稳定版本

0.1.0 2023年4月26日

#1565游戏开发

Apache-2.0

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