Trait Game

Source
pub trait Game {
    // Required methods
    fn player_join(&mut self, id: u32);
    fn player_ready(&mut self, id: u32);
    fn player_input(&mut self, id: u32, input: &Input);
    fn player_leave(&mut self, id: u32);
    fn on_net_msg(&mut self, id: u32, msg: &ClNetMessage<'_>);
    fn on_command(&mut self, id: u32, command: &Command<'_>);
    fn swap_tees(&mut self, id1: u32, id2: u32);
    fn tick(&mut self, cur_time: Instant);
    fn is_empty(&self) -> bool;
}

Required Methods§

Source

fn player_join(&mut self, id: u32)

Source

fn player_ready(&mut self, id: u32)

Source

fn player_input(&mut self, id: u32, input: &Input)

Source

fn player_leave(&mut self, id: u32)

Source

fn on_net_msg(&mut self, id: u32, msg: &ClNetMessage<'_>)

Source

fn on_command(&mut self, id: u32, command: &Command<'_>)

Source

fn swap_tees(&mut self, id1: u32, id2: u32)

Source

fn tick(&mut self, cur_time: Instant)

Source

fn is_empty(&self) -> bool

returns whether there are still players or spawnable entities in the world When false, tick doesn’t need to be called until next player_join event.

Implementors§