@@ -202,10 +202,12 @@ class VPetAutoMoveHandler{
202
202
func startAutoMove( ) {
203
203
if ( moveStarted) { return ;}
204
204
moveStarted = true ;
205
+ self . VPET. autoActionHendler. autoActionStarted = true ;
205
206
generateMove ( ) ;
206
207
}
207
208
func stopWindowMove( ) {
208
209
moveStarted = false ;
210
+ self . VPET. autoActionHendler. autoActionStarted = false ;
209
211
//终止当前可能存在的动画的方法
210
212
NSAnimationContext . runAnimationGroup ( { ( context) in
211
213
context. duration = 0.0
@@ -217,8 +219,6 @@ class VPetAutoMoveHandler{
217
219
}
218
220
func stopAutoMove( ) {
219
221
//被用户交互阻止。
220
- if ( !moveStarted) { return ;}
221
- //TODO
222
222
stopWindowMove ( ) ;
223
223
moveStarted = false ;
224
224
let pl = self . VPET. generatePlayListC ( graphtype: . Move, modetype: self . VPET. VPetStatus, title: self . playingKeyword!)
@@ -276,7 +276,21 @@ class VPetAutoMoveHandler{
276
276
func animateWindow( startPos: Vector , endPos: Vector , duration: CGFloat , direction: MoveDirections ) {
277
277
if ( !moveStarted) { return ;}
278
278
//动画播放
279
- playingKeyword = directionKeyword [ direction] !. randomElement ( ) !
279
+ if direction == . WalkLeft{
280
+ switch VPET . VPetStatus{
281
+ case . Happy: playingKeyword = " walk.left.faster " ;break ;
282
+ default : playingKeyword = " walk.left "
283
+ }
284
+ }
285
+ else if direction == . WalkRight{
286
+ switch VPET . VPetStatus{
287
+ case . Happy: playingKeyword = " walk.right.faster " ;break ;
288
+ default : playingKeyword = " walk.right "
289
+ }
290
+ }
291
+ else {
292
+ playingKeyword = directionKeyword [ direction] !. randomElement ( ) !
293
+ }
280
294
let pl = VPET . generatePlayListAB ( graphtype: . Move, modetype: VPET . VPetStatus, title: playingKeyword!)
281
295
282
296
VPET . animeplayer. interruptAndSetPlayList ( pl) ;
@@ -311,9 +325,10 @@ class VPetAutoMoveHandler{
311
325
}
312
326
self . VPET. VPetGraphTypeStack. removeLast ( ) ;
313
327
328
+ //是否接着移动
314
329
//多么优秀的抽签方式
315
- let iscontinue = [ true , true , true , false , false ] . randomElement ( ) !
316
- // let iscontinue = true;
330
+ // let iscontinue = [true,true,true,false,false].randomElement()!
331
+ let iscontinue = true ;
317
332
if ( iscontinue) {
318
333
self . generateMove ( )
319
334
}
0 commit comments