aboutsummaryrefslogtreecommitdiffstats
path: root/rust/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--rust/src/basic_die.rs20
1 files changed, 17 insertions, 3 deletions
diff --git a/rust/src/basic_die.rs b/rust/src/basic_die.rs
index dc425b4..dbcccc8 100644
--- a/rust/src/basic_die.rs
+++ b/rust/src/basic_die.rs
@@ -13,7 +13,7 @@ enum InputState {
Shooting,
Moving
}
-
+
type SpatialRef = Option<Ref<Spatial>>;
@@ -37,7 +37,7 @@ pub struct BasicDie {
#[property(path="input/shoot_sensitivity")]
shoot_sensitivity: f32,
#[property(path="input/current_buff_index")]
- current_buff_index: i8,
+ current_buff_index: i32,
all_buffs: [Option<Box<dyn Buff>>; 5],
@@ -144,6 +144,7 @@ impl BasicDie {
Some(Box::new(BuffExtra ::new())),
];
+ godot_print!("Current Buff: {}", self.current_buff_index);
godot_print!("Player is ready");
}
@@ -166,8 +167,19 @@ impl BasicDie {
}
}
- // detect if the die stops moving
let delta_ms = OS::godot_singleton().get_ticks_msec() - self.last_shot_time;
+
+ // deactivate the Ball Buff after 5 seconds
+ if matches!(self.input_state, InputState::Moving)
+ && delta_ms > 5000
+ && self.current_buff_index == 1 {
+ match self.all_buffs[1] {
+ Some(ref mut buff) => buff.revert_buff(),
+ None => {}
+ }
+ }
+
+ // detect if the die stops moving
if matches!(self.input_state, InputState::Moving)
&& (delta_ms > self.stopping_min_ms) {
@@ -178,6 +190,7 @@ impl BasicDie {
godot_print!("Die stopped moving at velocity {} after {} ms", current_vel, delta_ms);
//deactivate the old buff
+ godot_print!("Current Buff: {}", self.current_buff_index);
match self.all_buffs[self.current_buff_index as usize] {
Some(ref mut buff) => buff.revert_buff(),
None => {}
@@ -349,6 +362,7 @@ impl BasicDie {
};
// apply the current buff
+ godot_print!("Current Buff: {}", self.current_buff_index);
match self.all_buffs[self.current_buff_index as usize] {
Some(ref mut buff) => buff.execute_buff(),
None => {}