19 lines
399 B
Rust
19 lines
399 B
Rust
use godot::{classes::AudioStreamPlayer3D, prelude::*};
|
|
|
|
#[derive(GodotClass)]
|
|
#[class(base=Node3D, init)]
|
|
pub struct Weapon {
|
|
#[export]
|
|
sound_emitter: Option<Gd<AudioStreamPlayer3D>>,
|
|
|
|
base: Base<Node3D>,
|
|
}
|
|
|
|
impl Weapon {
|
|
pub fn shoot(&mut self, to: Vector3, deal_damage: bool) {
|
|
if let Some(emitter) = &mut self.sound_emitter {
|
|
emitter.play();
|
|
}
|
|
}
|
|
}
|