38 lines
989 B
Java
38 lines
989 B
Java
|
|
public class Shot extends GameItem
|
|
{
|
|
public static final double DEFAULT_RADIUS = 0.03;
|
|
public static final double SHOT_DURATION = 3.0;
|
|
public static final double SHOT_DAMAGE = 0.27;
|
|
|
|
public long createTime;
|
|
public Integer id;
|
|
|
|
public Shot(Integer id, long createTime, double x, double y)
|
|
{
|
|
this.id = id;
|
|
this.createTime = createTime;
|
|
this.radius = DEFAULT_RADIUS;
|
|
this.x = x;
|
|
this.y = y;
|
|
this.dx = 0;
|
|
this.dy = 0;
|
|
}
|
|
|
|
public boolean equals(Shot other)
|
|
{
|
|
return this.createTime == other.createTime &&
|
|
this.radius == other.radius &&
|
|
this.x == other.x &&
|
|
this.y == other.y &&
|
|
this.dx == other.dx &&
|
|
this.dy == other.dy;
|
|
}
|
|
|
|
public String toString()
|
|
{
|
|
return String.format("%d:%.3f:%.3f:%.3f:%.3f:%.3f",
|
|
id, radius, x, y, dx, dy);
|
|
}
|
|
}
|