Browse Source

enhance move system

Bastien Sevajol 6 years ago
parent
commit
edb1f45ae6
1 changed files with 8 additions and 0 deletions
  1. 8 0
      synergine2_xyz/move/simulation.py

+ 8 - 0
synergine2_xyz/move/simulation.py View File

108
         from_position: typing.Tuple[int, int],
108
         from_position: typing.Tuple[int, int],
109
         to_position: typing.Tuple[int, int],
109
         to_position: typing.Tuple[int, int],
110
         gui_action: typing.Any,
110
         gui_action: typing.Any,
111
+        move_duration: float=0.0,
111
         *args,
112
         *args,
112
         **kwargs
113
         **kwargs
113
     ):
114
     ):
116
         self.from_position = from_position
117
         self.from_position = from_position
117
         self.to_position = to_position
118
         self.to_position = to_position
118
         self.gui_action = gui_action
119
         self.gui_action = gui_action
120
+        self.move_duration = move_duration
119
 
121
 
120
     def repr_debug(self) -> str:
122
     def repr_debug(self) -> str:
121
         return '{}: subject_id:{}, from_position:{} to_position: {}'.format(
123
         return '{}: subject_id:{}, from_position:{} to_position: {}'.format(
133
         from_position: typing.Tuple[int, int],
135
         from_position: typing.Tuple[int, int],
134
         to_position: typing.Tuple[int, int],
136
         to_position: typing.Tuple[int, int],
135
         gui_action: typing.Any,
137
         gui_action: typing.Any,
138
+        move_duration: float=0.0,
136
         *args,
139
         *args,
137
         **kwargs
140
         **kwargs
138
     ):
141
     ):
141
         self.from_position = from_position
144
         self.from_position = from_position
142
         self.to_position = to_position
145
         self.to_position = to_position
143
         self.gui_action = gui_action
146
         self.gui_action = gui_action
147
+        self.move_duration = move_duration
144
 
148
 
145
     def repr_debug(self) -> str:
149
     def repr_debug(self) -> str:
146
         return '{}: subject_id:{}, from_position:{} to_position: {}'.format(
150
         return '{}: subject_id:{}, from_position:{} to_position: {}'.format(
177
     def _is_fresh_new_step(self, move_to_data: dict) -> bool:
181
     def _is_fresh_new_step(self, move_to_data: dict) -> bool:
178
         return move_to_data['just_reach'] or move_to_data['initial']
182
         return move_to_data['just_reach'] or move_to_data['initial']
179
 
183
 
184
+    def finalize_event(self, move_to_data: dict, event: Event) -> None:
185
+        pass
186
+
180
     def action(self, data) -> [Event]:
187
     def action(self, data) -> [Event]:
181
         # TODO: MoveToIntention doit être configurable
188
         # TODO: MoveToIntention doit être configurable
182
         try:
189
         try:
221
         move.initial = False
228
         move.initial = False
222
         # Note: Need to explicitly set to update shared data
229
         # Note: Need to explicitly set to update shared data
223
         self.subject.intentions.set(move)
230
         self.subject.intentions.set(move)
231
+        self.finalize_event(data, event)
224
 
232
 
225
         return [event]
233
         return [event]