92
|
1 package alice.test.topology.movement;
|
|
2
|
|
3 import alice.codesegment.CodeSegment;
|
|
4 import alice.datasegment.CommandType;
|
|
5 import alice.datasegment.Receiver;
|
|
6
|
|
7
|
|
8 public class SendLocation extends CodeSegment {
|
|
9
|
97
|
10 public Receiver position = ids.create(CommandType.PEEK);
|
|
11 float x;
|
|
12 float y;
|
92
|
13
|
97
|
14 public SendLocation(float x,float y){
|
|
15 this.x = x;
|
|
16 this.y = y;
|
92
|
17 }
|
|
18
|
|
19 @Override
|
|
20 public void run() {
|
93
|
21 System.out.println("update");
|
97
|
22 FishPoint FP = this.position.asClass(FishPoint.class);
|
|
23 FP.setXY(FP.getX()+this.x, FP.getY()+this.y);
|
|
24 ods.update("parent", "fish3X", FP);
|
92
|
25
|
|
26 }
|
|
27
|
|
28 }
|