entitypath.java

来自「一个很不错的j2me的rpg游戏的源码」· Java 代码 · 共 58 行

JAVA
58
字号
package mobileRPG.client;

public class EntityPath {
	
	protected int xTarget;
	protected int yTarget;
	protected EntityPath next;
	protected boolean completed, active;
	
	public EntityPath(int xTarget, int yTarget, EntityPath next) {
		this.xTarget = xTarget;
		this.yTarget = yTarget;
		this.next = next;
		completed = false;
		active = false;
	}
	
	public int getXTarget() {return xTarget;}
	public int getYTarget() {return yTarget;}
	
	public boolean isCompleted() {return completed;}
	public void setCompleted() {completed = true;}
	
	public boolean isActive() {return active;}
	public void setActive(boolean active) {this.active = active;}
	
	public void setNext(EntityPath next) {this.next = next;}
	
	public boolean isPush() {
		return false;
	}
	
	public EntityPath getNext() {
		if (next != null) {
			// If the next path has already been completed, remove it from the list
			if (next.isCompleted()) {
				next = null;
			}
		}
		return next;
	}
	
	public EntityPath getLast() {
		if (getNext() == null) {
			// If this is the last item on the list:
			
			// If this path has already completed, don't return it.
			if (this.isCompleted()) {return null;}
			
			// Otherwise return this
			return this;
			
		}
		return next.getLast();
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?