Mercurial > hg > Database > Alice
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/topology/aquarium/SetLocation.java Wed Aug 15 17:11:57 2012 +0900 @@ -0,0 +1,39 @@ +package alice.test.topology.aquarium; + +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.Receiver; + + +public class SetLocation extends CodeSegment{ + + private Receiver position = ids.create(CommandType.PEEK); + MakeObject obj; + String key; + String vector; + int range; + + public SetLocation(MakeObject obj ,String key,int index,int range){ + this.obj = obj; + this.key = key; + this.range = range; + this.position.setKey("local",key,index); + } + + @Override + public void run(){ + + FishPoint fp = this.position.asClass(FishPoint.class); + //obj.setLocation(fp.getX() - 2*range, fp.getY()); + + float startX = 2*range - 1.5f; + float endX = 2*range + 1.5f; + if (startX <= fp.getX() && fp.getX() < endX) + obj.setLocation(fp.getX() - 2*range, fp.getY()); + + new SetLocation(this.obj,this.key,this.position.index,this.range); + + } + + +}