Mercurial > hg > Database > Alice
view src/alice/test/topology/fishmodel/alpha/SendLocation.java @ 115:9845b74063ec working
share max number
author | sugi |
---|---|
date | Sat, 21 Jul 2012 10:02:41 +0900 |
parents | a8f77957a477 |
children | f84e1684c6be |
line wrap: on
line source
package alice.test.topology.fishmodel.alpha; 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; public SendLocation(float x,float y){ this.x = x; this.y = y; } @Override public void run() { FishPoint FP = this.position.asClass(FishPoint.class); if (FP.getX()+this.x>9.0f){ FP.setXY(-1.0f, FP.getY()+this.y); } else if (FP.getX()+this.x< -1){ FP.setXY(9.0f, FP.getY()+this.y); } else { FP.setXY(FP.getX()+this.x, FP.getY()+this.y); } ods.update("local", "fish", FP); } }