Mercurial > hg > Database > Alice
view src/main/java/alice/test/topology/aquarium/fx/CalculatePosition.java @ 467:6e304a7a60e7 dispose
remove white space
author | sugi |
---|---|
date | Sat, 22 Nov 2014 12:08:24 +0900 |
parents | aefbe41fcf12 |
children | c9175c310987 |
line wrap: on
line source
package alice.test.topology.aquarium.fx; import alice.codesegment.CodeSegment; import alice.datasegment.CommandType; import alice.datasegment.Receiver; public class CalculatePosition extends CodeSegment { private Receiver info = ids.create(CommandType.TAKE); // diff fish position value private Receiver info1 = ids.create(CommandType.TAKE); // absolute fish position value private Receiver info2 = ids.create(CommandType.PEEK); public CalculatePosition(String key){ info.setKey(key); info1.setKey("OwnFishP"); info2.setKey("host"); } @Override public void run() { FishInfo dfp = info.asClass(FishInfo.class); FishInfo afp = info1.asClass(FishInfo.class); String myName = info2.asString(); afp.setX(afp.getX() + dfp.getX()); afp.setY(afp.getY() + dfp.getY()); afp.setZ(afp.getZ() + dfp.getZ()); ods.update(info1.key, afp); FishInfo fishInfo = new FishInfo(afp.getX(),afp.getY(),afp.getZ()); fishInfo.rolX = dfp.rolX; fishInfo.rolY = dfp.rolY; fishInfo.rolZ = dfp.rolZ; fishInfo.rotate = dfp.rotate; ods.update(myName+"FishabsoluteP", fishInfo); this.recycle(); } }