pub struct LevelController { /* private fields */ }Expand description
关卡控制器结构体。
管理僵尸的生成时机、类型和波次。它实现了完整的关卡流程控制, 包括初始等待时间、波次管理、难度递增和胜利条件判定。
Implementations§
Source§impl LevelController
impl LevelController
Sourcepub fn new() -> Self
pub fn new() -> Self
创建一个新的 LevelController 实例。
初始化时,设置关卡开始时间为当前时间,并配置波次和生成规律。 第一波僵尸将在关卡开始后18秒出现。
§Returns
返回一个新的 LevelController 实例。
Sourcepub fn is_final_wave_announced(&mut self) -> bool
pub fn is_final_wave_announced(&mut self) -> bool
获取当前是否已经宣布最后一波来袭。
当最后一波僵尸出现时,此方法将返回true,可用于在UI上显示“最后一波来袭“的通知。
注意:此方法会设置内部标记,确保只返回一次true。
§Returns
如果最后一波已经开始且尚未宣布,则返回true;否则返回false。
Sourcepub fn is_level_completed(&self, zombies: &[Zombie]) -> bool
pub fn is_level_completed(&self, zombies: &[Zombie]) -> bool
Sourcepub fn is_wave_cleared(&self, zombies: &[Zombie]) -> bool
pub fn is_wave_cleared(&self, zombies: &[Zombie]) -> bool
Auto Trait Implementations§
impl Freeze for LevelController
impl RefUnwindSafe for LevelController
impl Send for LevelController
impl Sync for LevelController
impl Unpin for LevelController
impl UnsafeUnpin for LevelController
impl UnwindSafe for LevelController
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more