Add Bevy event queues for inbound and outbound packets, and use Bevy change detection for consumer new Peer handling.
This commit is contained in:
parent
cceca83dac
commit
c10f6cfb82
9 changed files with 348 additions and 72 deletions
|
|
@ -3,9 +3,10 @@ use std::net::SocketAddr;
|
|||
use avian2d::PhysicsPlugins;
|
||||
use bevy::{input::common_conditions::input_pressed, prelude::*};
|
||||
|
||||
use crate::net::NetIOPlugin;
|
||||
use crate::net::prelude::*;
|
||||
|
||||
use super::{
|
||||
net::{handle_deleted_peer, handle_incoming_packets, handle_new_peer},
|
||||
runtime::{move_camera, move_player, quit, zoom_camera},
|
||||
seed::Seed,
|
||||
setup::{check_for_seed, setup_balls, setup_from_seed, setup_player, setup_ui, setup_walls},
|
||||
|
|
@ -65,7 +66,15 @@ impl Plugin for GamePlugin {
|
|||
)
|
||||
.add_systems(
|
||||
FixedUpdate,
|
||||
check_for_seed.run_if(in_state(AppState::Loading)),
|
||||
(
|
||||
check_for_seed.run_if(in_state(AppState::Loading)),
|
||||
(
|
||||
handle_new_peer,
|
||||
handle_deleted_peer,
|
||||
handle_incoming_packets,
|
||||
)
|
||||
.run_if(in_state(NetworkState::MultiPlayer)),
|
||||
),
|
||||
)
|
||||
.add_systems(
|
||||
Update,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue