Mercurial > hg > Database > Alice
diff src/alice/test/topology/aquarium/SendLocation.java @ 134:53aff28cde6b working
change package
author | sugi |
---|---|
date | Wed, 15 Aug 2012 17:11:57 +0900 |
parents | src/alice/test/topology/fishmodel/alpha/SendLocation.java@1044a79ce4ef |
children | 87f1a30a8c82 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/alice/test/topology/aquarium/SendLocation.java Wed Aug 15 17:11:57 2012 +0900 @@ -0,0 +1,41 @@ +package alice.test.topology.aquarium; + +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.Receiver; + + +public class SendLocation extends CodeSegment { + + public Receiver position = ids.create(CommandType.PEEK); + float x; + float y; + float max = 3.3f; + float min = -1.3f; + + public SendLocation(float x,float y){ + this.x = x; + this.y = y; + } + + @Override + public void run() { + FishPoint fp = this.position.asClass(FishPoint.class); + + fp.setXY(fp.getX()+this.x, fp.getY()+this.y); + /* + if (fp.getX()+this.x>max){ + fp.setXY(-1.0f, fp.getY()+this.y); + } else if (fp.getX()+this.x< min){ + fp.setXY(max, fp.getY()+this.y); + } + else { + fp.setXY(fp.getX()+this.x, fp.getY()+this.y); + } + */ + + ods.update("local", "fish", fp); + + } + +}