Package serverMessages

Source Code of serverMessages.MotionEvent

package serverMessages;

import java.awt.geom.Point2D;

import units.Unit;

import Server.GameState;

public class MotionEvent extends ClientEventOut {
  protected double x,y;
  protected int unitID;
  public MotionEvent(int sourceID, long timeStamp, int unitIDIn, int xIn, int yIn){
    super(sourceID, timeStamp);
    x=xIn;
    y=yIn;
    unitID=unitIDIn;
    System.out.print("New motion:"+x+","+y+"\n");
  }
 
  public void modifyGameState(GameState g) {
    Unit u=g.getUnits().get(unitID);
    if(!(u==null)){
      u.setMove(new Point2D.Double(x, y));
     

    }
  }
 
}
TOP

Related Classes of serverMessages.MotionEvent

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.