Implemented AvoidObject behaviour and TextLCD
[des2015.git] / mart / ev3 / ex2 / nl / ru / des / behaviours / ShutdownBehaviour.java
1 package nl.ru.des.behaviours;
2
3 import lejos.robotics.subsumption.Behavior;
4 import nl.ru.des.LCDPrinter;
5 import nl.ru.des.bluetooth.ColorMemory;
6
7 public class ShutdownBehaviour implements Behavior {
8 private ColorMemory cm;
9 private boolean suppressed;
10
11 public ShutdownBehaviour(ColorMemory cm) {
12 this.cm = cm;
13 }
14
15 @Override
16 public boolean takeControl() {
17 return cm.finished();
18 }
19
20 @Override
21 public void action() {
22 suppressed = false;
23 LCDPrinter.print("finish");
24 while (!suppressed){
25 Thread.yield();
26 }
27 }
28
29 @Override
30 public void suppress() {
31 suppressed = true;
32 }
33 }