本文整理汇总了Java中org.newdawn.slick.util.pathfinding.Mover类的典型用法代码示例。如果您正苦于以下问题:Java Mover类的具体用法?Java Mover怎么用?Java Mover使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Mover类属于org.newdawn.slick.util.pathfinding包,在下文中一共展示了Mover类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCost
import org.newdawn.slick.util.pathfinding.Mover; //导入依赖的package包/类
/**
* @see AStarHeuristic#getCost(TileBasedMap, Mover, int, int, int, int)
*/
public float getCost(TileBasedMap map, Mover mover, int x, int y, int tx, int ty) {
float dx = tx - x;
float dy = ty - y;
return ((dx*dx)+(dy*dy));
}
示例2: getCost
import org.newdawn.slick.util.pathfinding.Mover; //导入依赖的package包/类
/**
* @see AStarHeuristic#getCost(TileBasedMap, Mover, int, int, int, int)
*/
public float getCost(TileBasedMap map, Mover mover, int x, int y, int tx, int ty) {
float dx = tx - x;
float dy = ty - y;
float result = (float) (Math.sqrt((dx*dx)+(dy*dy)));
return result;
}
示例3: blocked
import org.newdawn.slick.util.pathfinding.Mover; //导入依赖的package包/类
/**
* @see TileBasedMap#blocked(Mover, int, int)
*/
public boolean blocked(Mover mover, int x, int y) {
// if there's a unit at the location, then it's blocked
if (getUnit(x,y) != 0) {
return true;
}
int unit = ((RoverMover) mover).getType();
// Either it's blocked or its not, simpler
return terrain[x][y] == BLOCKED;
}
示例4: blocked
import org.newdawn.slick.util.pathfinding.Mover; //导入依赖的package包/类
/**
* @see org.newdawn.slick.util.pathfinding.TileBasedMap#blocked(org.newdawn.slick.util.pathfinding.Mover, int, int)
*/
public boolean blocked(Mover mover, int x, int y) {
// if theres a unit at the location, then it's blocked
if (getUnit(x,y) != 0) {
return true;
}
int unit = ((RoverMover) mover).getType();
// Either it's blocked or its not, simpler
return terrain[x][y] == BLOCKED;
}
示例5: getCost
import org.newdawn.slick.util.pathfinding.Mover; //导入依赖的package包/类
/**
* @see AStarHeuristic#getCost(TileBasedMap, Mover, int, int, int, int)
*/
public float getCost(TileBasedMap map, Mover mover, int x, int y, int tx, int ty) {
float dx = tx - x;
float dy = ty - y;
float result = (float) (Math.sqrt((dx*dx)+(dy*dy)));
return result;
}
示例6: getCost
import org.newdawn.slick.util.pathfinding.Mover; //导入依赖的package包/类
@Override
public float getCost(TileBasedMap ctx, Mover mover, int x, int y,
int goalX, int goalY) {
return Math.max(Math.abs(x - goalX), Math.abs(y - goalY));
/*
float diagonal = Math.min(Math.abs(x - goalX), Math.abs(y - goalY));
float straight = (Math.abs(x - goalX) + Math.abs(y - goalY));
float h = (DIAGONAL_COST * diagonal) + (ADJACENT_COST * (straight - (2f * diagonal)));
return h;*/
}
示例7: getMover
import org.newdawn.slick.util.pathfinding.Mover; //导入依赖的package包/类
public Mover getMover() {
return null;
}
示例8: getCost
import org.newdawn.slick.util.pathfinding.Mover; //导入依赖的package包/类
/**
* @see AStarHeuristic#getCost(TileBasedMap, Mover, int, int, int, int)
*/
public float getCost(TileBasedMap map, Mover mover, int x, int y, int tx,
int ty) {
return minimumCost * (Math.abs(x-tx) + Math.abs(y-ty));
}
示例9: getCost
import org.newdawn.slick.util.pathfinding.Mover; //导入依赖的package包/类
/**
* @see TileBasedMap#getCost(Mover, int, int, int, int)
*/
public float getCost(Mover mover, int sx, int sy, int tx, int ty) {
return 1;
}
示例10: getCost
import org.newdawn.slick.util.pathfinding.Mover; //导入依赖的package包/类
/**
* @see org.newdawn.slick.util.pathfinding.TileBasedMap#getCost(Mover, int, int, int, int)
*/
public float getCost(Mover mover, int sx, int sy, int tx, int ty) {
return 1;
}
示例11: getCost
import org.newdawn.slick.util.pathfinding.Mover; //导入依赖的package包/类
@Override
public float getCost(TileBasedMap ctx, Mover mover, int x, int y,
int goalX, int goalY) {
return Math.max(Math.abs(x - goalX), Math.abs(y - goalY));
}
示例12: getMover
import org.newdawn.slick.util.pathfinding.Mover; //导入依赖的package包/类
/**
* Path finding context implementation
*
* @return The current mover
*/
public Mover getMover() {
return null;
}