view src/alice/test/topology/fishmodel/alpha/SendLocation.java @ 107:a8f77957a477 working

create new model to share fish point
author sugi
date Tue, 10 Jul 2012 02:30:25 +0900
parents src/alice/test/topology/movement/SendLocation.java@993a9f194615
children 9845b74063ec
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);
		FP.setXY(FP.getX()+this.x, FP.getY()+this.y);
		ods.update("local", "fish", FP);
		
	}

}