亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? gameobject.java

?? 用java開發的一個實施策略游戲源碼 值得學習一下
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/*
	Netwar
	Copyright (C) 2002  Daniel Grund, Kyle Kakligian, Jason Komutrattananon, & Brian Hibler.
 
	This file is part of Netwar.
 
	Netwar is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.
 
	Netwar is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.
 
	You should have received a copy of the GNU General Public License
	along with Netwar; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package netwar.game;
import netwar.utils.*;
import netwar.utils.vectorgraphics.*;
import netwar.gui.HexViewer;
import java.awt.*;
import netwar.mapper.*;  // sigh, I didn't want to have to include this -kyle

/** Abstract class to define a GameObject.
 * This defines any object which:
 * <BR> occupies at least one Hex,
 * <BR> has vertical aspects (it isn't flat at z = 0),
 * <BR> (optionally) can be destroyed by weapons,
 * <BR> (optionally) has a weapon.
 * @author Group N2 - Project Netwar
 * @author Daniel Grund
 * @author Kyle Kakligian
 */
public abstract class GameObject {
	/** Vector of GameObjects containing all currently active GameObjects. */
	static protected Vector GameObjects = new LVector();
	/** The ID number to assign to the next GameObject added into the game. */
	static int nextID = 1;
	/** The ID number of this GameObject. A GameObject must have an ID so it can
	 * be referenced by Commands, which may take some time before they are implemented
	 * (so an object may be deleted before then) and will be implemented on all
	 * computers involved in the game.
	 */
	protected int myID;
	/** The Player who owns this game Object. It can be compared for friend-or-foe
	 * recognition, and can be accessed to acquire the team color, and other team
	 * wide facts.
	 */
	protected Player myPlayer;
	/** The head of the linked list which provides the distanceSquared and Point3D offset
	 * from this GameObject to each other GameObject, sorted from closest to farthest.
	 */
	public SelfSortingMutualDistanceSquared firstSSMDS = null;
	
	/** Point3d's for locations within the hex. I.e. 0,0,0 is the floor at hex center.
	 * vr[0] is a Point3d for where the center of the hex is if the GameObject is
	 * currently centered in the hex.
	 */
	protected Point3D vr[];
	
	/** X part of current hex coordinate. */
	protected int x;
	/** Y part of current hex coordinate */
	protected int y;
	
	//Animation sequence and frame
	/** Code number indicating the animation sequence in progress.
	 * <BR> 0 = only passive animations.
	 * <BR> 1 = rotating left.
	 * <BR> 2 = rotating right.
	 * <BR> 3 = moving forward.
	 * <BR> 4 = being created.
	 * <BR> 5 = dying.
	 */
	protected int action = 0;
	/** The number of frames remaining until this animation sequence is completed. */
	protected int frame = 0;
	/** The number of frames remaining until the primary weapon is reloaded. */
	protected int reload = 0;
	
	//Current long-term objectives
	/** Code number indicating the long term goal set by this object.
	 * <BR> 0 = Wait for orders/watch for targets.
	 * <BR> 1 = Go to hex whose coordinates are (goalX, goalY).
	 * <BR> 2 = Pursue GameObject target; try to keep it within followDistance() hexes.
	 */
	protected int mode = 0; //0 = stand still, 1 = go to destination, 2 = pursue target
	/** X part of the hex coord of the long term goal. */
	protected int goalX;
	/** Y part of the hex coord of the long term goal. */
	protected int goalY;
	/** The GameObject which is being pursued and/or shot at by this GameObject. */
	protected GameObject target;
	/** The SSMDS which provides distanceSquared and offset data for the target. */
	protected SelfSortingMutualDistanceSquared targetSSMDS = null;
	
        /** Used for saving maps, this method returns a structure of all the unit's positions.
         */        
        public static GameObjectLocationStruct[] getLocationStruct() {
            GameObjectLocationStruct ret[] = new GameObjectLocationStruct[GameObjects.getLength()];
            int t = 0;
            for(GameObjects.goFirst(); GameObjects.isInList(); GameObjects.goNext()) {
                GameObject go = (GameObject)(GameObjects.get());
                ret[t] = new GameObjectLocationStruct(go.x, go.y, 0);
                t++;
            }
            return ret;
        }
        /** Used for saving maps, this method returns a structure of all the unit's package names.
         */        
        public static String[] getLocationStructStrings() {
            String ret[] = new String[GameObjects.getLength()];
            int t = 0;
            for(GameObjects.goFirst(); GameObjects.isInList(); GameObjects.goNext()) {
                ret[t] = new String(GameObjects.get().getClass().getName());
                t++;
            }
            return ret;
        }
	/** Adds a GameObject into the game at the specified location, on the specified team.
	 * This performs the following initialization processes:
	 * <BR> Assigns a new unique ID number to the GameObject.
	 * <BR> Adds the GameObject into the main Vector of GameObjects.
	 * <BR> Sets the hex coordinates of the GameObject to those passed to this method.
	 * <BR> Calls the param() method of the GameObject, giving it p as the parameter.
	 * This allows an arbitrary initialization to take place, which may require an integer.
	 * <BR> Calls the CreateVectors() method of the GameObject, which allows the 3D location
	 * data to be initialized.
	 * <BR> Integrates this GameObject into the SSMDS distance tracking system.
	 * <BR> Initializes the animation sequence to the first frame of the creation graphics.
	 * <BR> Sets the Player's team to that passed to this method.
	 * <BR> Puts the GameObject in the hex identified by the parameters. It is the calling
	 * method's responsibility to ensure that the hex is a valid location to make this
	 * GameObject.
	 * @param u The GameObject to be incorporated into the game.
	 * @param startX The X part of the hex coordinate to start the object in.
	 * @param startY The Y part of the hex coordinate to start the object in.
	 * @param p The parameter for the arbitrary initialization method param().
	 * @param team The player which owns this object. May be null, for a neutral object.
	 * @return u, the GameObject which was just incorporated.
	 */
	public static GameObject newGameObject(GameObject u, int startX, int startY, int p, Player team) {
		Hex spawnHex = Hex.getHex(startX, startY);
                
		/**/if(nextID == 2147483647) return null;
		//Game will stop making GameObjects if we get too many.
		//This will seem really wierd, but very few people will find this feature.
		//The problem will be that, although many IDs are no longer used, we can't
		//easily change IDs because Commands in the Queue, the array, and in transit
		//will refer to the wrong IDs.
		//A better solution at this point is to go through and readjust ALL IDs,
		//and make the Commands which were already in the Queue adjust to the new
		//IDs, but that is big and long and stuff. Maybe next year.
		
		u.myID = nextID++;
                GameObjects.append(u);
		u.myPlayer = team;
                if(team != null)
                        team.newObject(u);
		u.x = startX;
		u.y = startY;
		u.param(p);
		u.createVectors();
		u.addTo(HexViewer.getHexViewer());
		for(GameObjects.goFirst(); GameObjects.get() != u; GameObjects.goNext())
			SelfSortingMutualDistanceSquared.newSSMDS(u, (GameObject)GameObjects.get());
		u.action = 4; //Making
		u.frame = u.framesToMake();
		spawnHex.enter(u);
		spawnHex.reserve();
		return u;
	}
        /** Same as newGameObject, only for the mapper.
         * @see #newGameObject newFameObject()
         */        
	public static GameObject newGameObjectM(GameObject u, int startX, int startY, int p) {
                HexM spawnHex = HexM.getHex(startX, startY);
		/**/if(nextID == 2147483647) return null;
		//Game will stop making GameObjects if we get too many.
		//This will seem really wierd, but very few people will find this feature.
		//The problem will be that, although many IDs are no longer used, we can't
		//easily change IDs because Commands in the Queue, the array, and in transit
		//will refer to the wrong IDs.
		//A better solution at this point is to go through and readjust ALL IDs,
		//and make the Commands which were already in the Queue adjust to the new
		//IDs, but that is big and long and stuff. Maybe next year.
		
		u.myID = nextID++;
                GameObjects.append(u);
                try {u.myPlayer = new Player(1, 0, 0, Color.red, true);}
		catch(Exception e) {u.myPlayer = Player.getLocal();}
                
		u.x = startX;
		u.y = startY;
                u.param(p);
		u.createVectors();
                u.addTo(HexViewerM.getHexViewer());
		for(GameObjects.goFirst(); GameObjects.get() != u; GameObjects.goNext())
			SelfSortingMutualDistanceSquared.newSSMDS(u, (GameObject)GameObjects.get());
        	u.action = 4; //Making
                u.frame = u.framesToMake();
                spawnHex.enter(u);
		return u;
	}
        /** Same as newGameObject, only for the mapper where the unit is not to be displayed.
         * @see #newGameObject newFameObject()
         */        
	public static GameObject newGameObjectMnohex(GameObject u, int p) {
                if(nextID == 2147483647) return null;
		u.myID = nextID++;
                
                try {u.myPlayer = new Player(1, 0, 0, Color.red, true);}
		catch(Exception e) {u.myPlayer = Player.getLocal();}
                
		u.param(p);
		u.createVectors();
                //u.addTo(HexViewerM.getHexViewer());
		//for(GameObjects.goFirst(); GameObjects.get() != u; GameObjects.goNext())
		//	SelfSortingMutualDistanceSquared.newSSMDS(u, (GameObject)GameObjects.get());
        	u.action = 4; //Making
                u.frame = u.framesToMake();
                return u;
	}
	/** Removes this GameObject from the game.
	 * This involves the following de-integration processes:
	 * <BR> Removes this object from the SSMDS tracking system.
	 * <BR> Removes this object from the GameObjects Vector.
	 * <BR> Removing the object from the Hex reservation system is the
	 * responsibility of the calling method.
	 */
	public void remove() {
		if(firstSSMDS != null)
			firstSSMDS.remove(this);
		GameObjects.goFirst();
		while(GameObjects.get() != this)
			GameObjects.goNext();
		GameObjects.remove();
                if(myPlayer != null)
                        myPlayer.remObject(this);
	}
        /** Sets the position of the GameObject.
         */        
	public void setXY(int X, int Y) {x=X;y=Y;}
	/** Given an ID number, finds the GameObject with that ID.
	 * @param ID The ID number of the GameObject.
	 * @return The GameObject with that ID, or null if none exists with that ID.
	 **/
	public static GameObject getObjectWithID(int ID) {
		GameObject go;
		//First, see if we are already on the Unit or past it.
		//If on the Unit, hurray. If past it, go back to start.
		if(GameObjects.isInList()) {
			go = (GameObject)GameObjects.get();
			if(go.myID == ID)
				return go;
			if(go.myID > ID)
				GameObjects.goFirst();
		}else
			GameObjects.goFirst();
		while(GameObjects.isInList()) {
			go = (GameObject)GameObjects.get();
			if(go.myID == ID) //Found it!
				return go;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品私人自拍| 亚洲精品久久久蜜桃| 九九九精品视频| 国产精品久久久久久久久晋中| 色一区在线观看| 蜜臀av一区二区在线观看| 中文字幕第一页久久| 91麻豆精品国产91久久久久| 国精产品一区一区三区mba视频 | 亚洲视频1区2区| 91精品国产全国免费观看| av电影在线不卡| 日韩电影一二三区| 国产精品国产馆在线真实露脸| 欧美激情综合五月色丁香| 国产精品夫妻自拍| 夜夜嗨av一区二区三区中文字幕 | 麻豆精品在线播放| 国产在线看一区| 成人高清免费观看| 韩国一区二区视频| 国产精品1024久久| 精品无人区卡一卡二卡三乱码免费卡 | 尤物在线观看一区| 亚洲午夜久久久久久久久电影网| 欧美一区二区日韩| 欧美大胆人体bbbb| 欧美丰满少妇xxxxx高潮对白| 91热门视频在线观看| 国产精品夜夜爽| 久久99国产精品久久99果冻传媒| 老色鬼精品视频在线观看播放| 亚洲主播在线播放| 亚洲成a人片在线不卡一二三区| 中文字幕在线不卡| 国产精品水嫩水嫩| 亚洲国产人成综合网站| 精品写真视频在线观看| 色哟哟一区二区在线观看| 日韩欧美色综合网站| 亚洲色欲色欲www| 国模冰冰炮一区二区| 欧美影视一区在线| 欧美日本乱大交xxxxx| 欧美日韩一区二区三区四区| 欧美性色黄大片手机版| 精品国产网站在线观看| 久久综合九色综合97_久久久| 欧美精品一区二区三区蜜桃| 亚洲视频在线观看一区| 极品瑜伽女神91| 欧美久久高跟鞋激| 樱花草国产18久久久久| 国产精品一区二区久久精品爱涩| 欧美日韩国产美| 亚洲欧美一区二区三区久本道91 | 欧美r级在线观看| 精品少妇一区二区三区| 亚洲一区二区在线免费看| 国产成人av一区| 精品久久99ma| 蜜臀精品一区二区三区在线观看 | 亚洲精品一区二区三区在线观看 | 日韩欧美一区二区免费| 一区二区三区在线高清| av中文一区二区三区| 久久久久久久综合色一本| 国产精品色哟哟| 国产一区二区三区免费观看| 91丨porny丨在线| 中文字幕精品一区二区精品绿巨人| 美日韩一区二区三区| 91精品国产入口在线| 三级一区在线视频先锋| 国产资源在线一区| 欧美不卡一区二区三区四区| 成人禁用看黄a在线| 久久亚洲精品小早川怜子| 久久99精品久久久久久久久久久久| 91精品啪在线观看国产60岁| 一区二区三区四区在线免费观看| 99久久伊人精品| 91黄色免费网站| 国产亚洲欧美色| 午夜精品一区二区三区三上悠亚| 国产精品一区二区久久精品爱涩 | 久久久噜噜噜久噜久久综合| 老司机免费视频一区二区| 欧美mv日韩mv| 国产剧情一区二区| 国产精品亲子乱子伦xxxx裸| 色偷偷久久一区二区三区| 亚洲午夜激情网站| 日韩一本二本av| 亚洲国产精品麻豆| 91精品国产手机| 国产一区不卡视频| 亚洲色大成网站www久久九九| 色网站国产精品| 日本欧美久久久久免费播放网| 日韩一区二区精品在线观看| 国产一区二区三区精品欧美日韩一区二区三区 | 中文字幕免费在线观看视频一区| 国产综合色精品一区二区三区| 久久一日本道色综合| 99视频一区二区| 日韩国产欧美三级| 亚洲国产精品t66y| 欧美日韩国产影片| 国产精品18久久久久久vr| 日韩一区欧美小说| 欧美va在线播放| 91女厕偷拍女厕偷拍高清| 亚洲成人av一区| 欧美极品少妇xxxxⅹ高跟鞋| 欧亚一区二区三区| 一区二区三区四区不卡视频| 欧美一区二区三区小说| av影院午夜一区| 久久99久国产精品黄毛片色诱| 中文字幕视频一区| 欧美第一区第二区| 色偷偷成人一区二区三区91| 国内久久婷婷综合| 亚洲成a人片在线不卡一二三区| www国产亚洲精品久久麻豆| 欧美精品一区二区久久久| 在线观看中文字幕不卡| 国产a级毛片一区| 国产精品久久久久毛片软件| 日韩一区二区高清| 欧美老年两性高潮| 色综合久久久久久久久| 丰满少妇久久久久久久| 蜜桃久久久久久久| 日韩专区中文字幕一区二区| 亚洲人成伊人成综合网小说| 欧美极品aⅴ影院| 久久久久久久一区| 欧美mv日韩mv国产网站app| 欧美一区二区三区在线看| 欧美在线啊v一区| 日本久久一区二区| gogo大胆日本视频一区| 大尺度一区二区| 亚洲综合无码一区二区| 亚洲日本在线看| 中文字幕在线不卡一区二区三区| 久久美女高清视频| 久久久久国产精品人| 久久久精品国产99久久精品芒果| 日韩免费观看高清完整版在线观看| 欧美日韩亚洲国产综合| 欧美群妇大交群中文字幕| 欧美日韩国产精选| 欧美一区三区四区| 日韩女优视频免费观看| 欧美r级电影在线观看| 久久久久久久网| 欧美国产一区视频在线观看| 国产精品人成在线观看免费| 亚洲欧美自拍偷拍| 国产精品电影一区二区三区| 中文字幕在线观看一区| 一区二区三区在线观看欧美| 亚洲123区在线观看| 国产欧美一区二区在线| 日韩免费观看2025年上映的电影| 欧美一区二区三区色| 精品免费99久久| 欧美激情综合在线| 一区二区三区蜜桃网| 日韩国产高清影视| 国内久久婷婷综合| 一本色道久久综合精品竹菊| 欧美亚一区二区| 精品国产人成亚洲区| 国产精品乱码人人做人人爱 | 久久福利视频一区二区| 国产一区久久久| 色综合久久久网| 日韩一区二区不卡| 亚洲欧美怡红院| 麻豆视频观看网址久久| 不卡电影一区二区三区| 欧美日韩国产免费| 国产欧美一区二区三区在线看蜜臀| 国产精品久久影院| 日本系列欧美系列| 99久久精品国产麻豆演员表| 欧美精品第1页| 国产精品网站在线| 免费看日韩精品| 日韩在线一区二区三区| 高清视频一区二区| 制服丝袜av成人在线看| 国产精品久久久久aaaa樱花| 日本成人在线不卡视频| 97se亚洲国产综合在线| 久久婷婷综合激情|