diff options
Diffstat (limited to 'godot/scenes/Die.gd')
-rw-r--r-- | godot/scenes/Die.gd | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/godot/scenes/Die.gd b/godot/scenes/Die.gd index 6f061b5..76c1474 100644 --- a/godot/scenes/Die.gd +++ b/godot/scenes/Die.gd @@ -22,6 +22,8 @@ var mat var target_bounce = 1 var previous_bounciness = 0 +var curr_buff = buff.none + var _game: Game = null enum buff { @@ -101,7 +103,10 @@ func _physics_process(delta): if dice_is_moving == true and angular_velocity.length() < 0.01 and linear_velocity.length() < 0.01: dice_is_moving = false - get_buff_from_upwards_side() + revert_current_buff() + curr_buff = get_buff_from_upwards_side() + apply_buff() + elif dice_is_moving == false and angular_velocity.length() >= 0.01 and linear_velocity.length() >= 0.01: dice_is_moving = true @@ -158,3 +163,25 @@ func ball_revert(): $BallShape.hide() $BallShape.set_process(false) $BallShape.disabled = true + + +func revert_current_buff(): + match curr_buff: + buff.ball: + ball_revert() + buff.bounce: + bounciness_revert() + buff.phase: + phase_revert() + + +func apply_buff(): + match curr_buff: + buff.ball: + ball() + buff.bounce: + bounciness() + buff.phase: + phase() + buff.stroke: + extra_stroke() |