|
@@ -27,6 +27,7 @@ use crate::scene::item::{
|
27
|
27
|
use crate::ui::vertical_menu::{vertical_menu_sprite_info, VerticalMenuSpriteInfo};
|
28
|
28
|
use crate::ui::MenuItem;
|
29
|
29
|
use crate::ui::{SceneItemPrepareOrder, UiComponent, UserEvent};
|
|
30
|
+use crate::util::velocity_for_behavior;
|
30
|
31
|
use crate::{Offset, ScenePoint, WindowPoint};
|
31
|
32
|
|
32
|
33
|
pub struct MainState {
|
|
@@ -260,15 +261,8 @@ impl MainState {
|
260
|
261
|
ItemBehavior::MoveTo(move_to_scene_point)
|
261
|
262
|
| ItemBehavior::MoveFastTo(move_to_scene_point)
|
262
|
263
|
| ItemBehavior::HideTo(move_to_scene_point) => {
|
263
|
|
- let velocity = match &scene_item.state.current_behavior {
|
264
|
|
- ItemBehavior::MoveTo(_) => MOVE_VELOCITY,
|
265
|
|
- ItemBehavior::MoveFastTo(_) => MOVE_FAST_VELOCITY,
|
266
|
|
- ItemBehavior::HideTo(_) => MOVE_HIDE_VELOCITY,
|
267
|
|
- _ => {
|
268
|
|
- panic!("This code should not be reached")
|
269
|
|
- }
|
270
|
|
- };
|
271
|
|
- // FIXME BS NOW: velocity
|
|
264
|
+ let velocity = velocity_for_behavior(&scene_item.state.current_behavior)
|
|
265
|
+ .expect("must have velocity here");
|
272
|
266
|
let move_vector =
|
273
|
267
|
(move_to_scene_point - scene_item.position).normalize() * velocity;
|
274
|
268
|
// TODO ici il faut calculer le déplacement réél (en fonction des ticks, etc ...)
|