make geisha curver, add fan
fix CurverProjectile replcation
This commit is contained in:
@@ -11,17 +11,21 @@ use crate::{
|
||||
use avian3d::prelude::*;
|
||||
use bevy::prelude::*;
|
||||
use bevy_replicon::prelude::{Replicated, SendMode, ServerTriggerExt, ToClients};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::f32::consts::PI;
|
||||
|
||||
const MAX_SHOT_AGES: f32 = 15.;
|
||||
|
||||
#[derive(Component)]
|
||||
struct CurverProjectile {
|
||||
#[derive(Component, Reflect, Deserialize, Serialize)]
|
||||
#[reflect(Component)]
|
||||
pub struct CurverProjectile {
|
||||
time: f32,
|
||||
damage: u32,
|
||||
}
|
||||
|
||||
pub fn plugin(app: &mut App) {
|
||||
app.register_type::<CurverProjectile>();
|
||||
|
||||
app.add_systems(
|
||||
Update,
|
||||
(shot_collision, enemy_hit).run_if(in_state(GameState::Playing)),
|
||||
@@ -31,10 +35,10 @@ pub fn plugin(app: &mut App) {
|
||||
(update, timeout).run_if(in_state(GameState::Playing)),
|
||||
);
|
||||
|
||||
global_observer!(app, on_trigger_missile);
|
||||
global_observer!(app, on_trigger_curver);
|
||||
}
|
||||
|
||||
fn on_trigger_missile(
|
||||
fn on_trigger_curver(
|
||||
trigger: On<TriggerCurver>,
|
||||
mut commands: Commands,
|
||||
query_transform: Query<&Transform>,
|
||||
@@ -75,10 +79,12 @@ fn on_trigger_missile(
|
||||
Visibility::default(),
|
||||
transform,
|
||||
Replicated,
|
||||
//TODO: put in client only system
|
||||
children![(
|
||||
Transform::from_rotation(Quat::from_rotation_x(PI / 2.).inverse()),
|
||||
AutoRotation(Quat::from_rotation_x(0.4) * Quat::from_rotation_z(0.3)),
|
||||
GltfSceneRoot::Projectile(head.projectile.clone()),
|
||||
Replicated,
|
||||
),],
|
||||
));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
GameState,
|
||||
abilities::{BuildExplosionSprite, healing::Healing},
|
||||
abilities::{BuildExplosionSprite, curver::CurverProjectile, healing::Healing},
|
||||
animation::AnimationFlags,
|
||||
backpack::{Backpack, backpack_ui::BackpackUiState},
|
||||
camera::{CameraArmRotation, CameraTarget},
|
||||
@@ -83,6 +83,7 @@ pub fn plugin(app: &mut App) {
|
||||
.replicate::<AnimatedCharacter>()
|
||||
.replicate::<AnimationFlags>()
|
||||
.replicate_once::<AutoRotation>()
|
||||
.replicate_once::<CurverProjectile>()
|
||||
.replicate::<Backpack>()
|
||||
.replicate::<BackpackUiState>()
|
||||
.replicate::<Billboard>()
|
||||
|
||||
Reference in New Issue
Block a user