Mercurial > hg > Database > Alice
comparison src/alice/test/topology/aquarium/SetLocation.java @ 134:53aff28cde6b working
change package
author | sugi |
---|---|
date | Wed, 15 Aug 2012 17:11:57 +0900 |
parents | src/alice/test/topology/fishmodel/alpha/SetLocation.java@117dad267a9b |
children | 87f1a30a8c82 |
comparison
equal
deleted
inserted
replaced
133:26b4b18c51fa | 134:53aff28cde6b |
---|---|
1 package alice.test.topology.aquarium; | |
2 | |
3 import alice.codesegment.CodeSegment; | |
4 import alice.datasegment.CommandType; | |
5 import alice.datasegment.Receiver; | |
6 | |
7 | |
8 public class SetLocation extends CodeSegment{ | |
9 | |
10 private Receiver position = ids.create(CommandType.PEEK); | |
11 MakeObject obj; | |
12 String key; | |
13 String vector; | |
14 int range; | |
15 | |
16 public SetLocation(MakeObject obj ,String key,int index,int range){ | |
17 this.obj = obj; | |
18 this.key = key; | |
19 this.range = range; | |
20 this.position.setKey("local",key,index); | |
21 } | |
22 | |
23 @Override | |
24 public void run(){ | |
25 | |
26 FishPoint fp = this.position.asClass(FishPoint.class); | |
27 //obj.setLocation(fp.getX() - 2*range, fp.getY()); | |
28 | |
29 float startX = 2*range - 1.5f; | |
30 float endX = 2*range + 1.5f; | |
31 if (startX <= fp.getX() && fp.getX() < endX) | |
32 obj.setLocation(fp.getX() - 2*range, fp.getY()); | |
33 | |
34 new SetLocation(this.obj,this.key,this.position.index,this.range); | |
35 | |
36 } | |
37 | |
38 | |
39 } |