让小车红灯停,绿灯行出现以下情况不能解决:
) c; E* ~+ h3 {8 n1)is
2 d8 K& \$ ~# Q2 P& t' Rdo
, R. v4 H% S: q7 D! F* C; ] if light="green"8 I+ }. C5 M! H7 Y1 Y; _
then @.stopped:=false;
9 H; G# y; }7 q& z) ^ else
T! r8 @2 W& r6 I9 s1 x @.stopped:=true;, y# e/ Q x- T# B- B
end;" {1 H* E. U, r
end;' ^4 ?) f' p _& U- X
* d; }) [8 Z* A用if else then,只会停止,不能运动,停了以后Method 不会再被调;
. k `5 V) @9 U% ~5 A- |& \) F2)is+ r; \+ Q9 y, C* \! m4 Q; c
do
% O* i7 b' X" j: Q, X7 m# V; s if light="green"
" ]2 G9 D4 a. |- w; W4 b then @.stopped:=false;* s+ A' K) S7 I% U
else# O& @* z5 v, U
@.stopped:=true;
- G( t7 T3 C, W [+ q; M* ^0 K end;
/ L$ V- |: A5 c0 g: q@.move;--加了这个以后则不管红绿灯都是一直运动的,
* ] r$ W# Y& `) u7 s# i. Rend;' B# _: f2 T" V1 D4 G7 E
3)用ispect-when-when-else,出现同样的情况 j# j0 p6 P% m3 x" x6 u( ?) S
求高手解决。 |