view src/alice/test/topology/fishmodel/alpha/SendLocation.java @ 132:1044a79ce4ef working

delete cs from OutputCodeSegment
author sugi
date Tue, 14 Aug 2012 19:43:10 +0900
parents 117dad267a9b
children
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;
	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);
		
	}

}