amethyst / amethyst/rustrogueliketutorial

Chapter 9: May not need `maintain` after each RunState call to dispatch

未關閉
#173 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Rust
星號
970
分支
166
PR 合併指標
30 天內沒有已合併 PR

描述

In this section of [Chapter 9](http://bfnightly.bracketproductions.com/rustbook/chapter_9.html#using-items) :

> Testing this with cargo run gives a surprise: the potion isn't deleted after use! This is because the ECS simply marks entities as dead - it doesn't delete them in systems (so as to not mess up iterators and threading). So after every call to dispatch, we need to add a call to maintain. In main.ecs:
>
> ```rust
> RunState::PreRun => {
> self.run_systems();
> self.ecs.maintain();
> newrunstate = RunState::AwaitingInput;
> }
> ```
>
>
Maybe it is not necessary to do this here, because the `maintain` is called in `self.run_systems();`.

> the potion isn't deleted after use!

It is because return to `RunState::AwaitingInput` when use the potion, It will keep waiting for input, and then keypress `i`, jump to the `ShowInventory` again.

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。