亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
91成人免费在线视频| 久久久噜噜噜久久人人看| 欧美成人bangbros| 亚洲精品视频一区| 国产综合久久久久影院| 欧美日韩亚洲综合| 中文字幕日本乱码精品影院| 日韩电影在线观看电影| 色综合中文字幕国产| 精品日韩欧美一区二区| 亚洲电影一级片| 欧美在线不卡一区| 国产精品久久久久久久浪潮网站| 蜜臀国产一区二区三区在线播放 | 亚洲网友自拍偷拍| 风间由美一区二区三区在线观看| 欧美精品视频www在线观看| 一色桃子久久精品亚洲| 国产精品资源网| 日韩亚洲欧美成人一区| 亚洲国产精品一区二区久久恐怖片| 国产91高潮流白浆在线麻豆| www国产精品av| 激情文学综合网| 777亚洲妇女| 视频一区二区国产| 欧美日韩另类国产亚洲欧美一级| 一区二区在线免费观看| 97超碰欧美中文字幕| 亚洲视频免费在线观看| 99精品在线观看视频| 亚洲视频 欧洲视频| 91在线视频官网| 中文字幕制服丝袜成人av| 国产一区 二区| 国产欧美精品区一区二区三区| 国产一区二区三区免费播放 | 国产精品夜夜嗨| 久久青草国产手机看片福利盒子| 麻豆一区二区三区| 精品久久一区二区三区| 国产一区不卡在线| 中文字幕av一区 二区| 成人18视频在线播放| 亚洲色图清纯唯美| 欧美日韩电影一区| 久久精工是国产品牌吗| 国产性做久久久久久| 99精品欧美一区二区三区小说| 亚洲天堂网中文字| 欧美老女人第四色| 国产在线精品免费| 最新国产の精品合集bt伙计| 欧美在线综合视频| 九九热在线视频观看这里只有精品| 久久―日本道色综合久久| 99久久精品99国产精品| 日韩专区在线视频| 久久综合色之久久综合| 成人免费视频播放| 日韩一区欧美小说| 在线观看成人免费视频| 亚洲va国产天堂va久久en| 成人精品视频一区二区三区尤物| 欧美国产日本韩| 91免费国产在线| 亚洲影视资源网| 91.xcao| 美腿丝袜亚洲一区| 久久久久九九视频| av电影一区二区| 亚瑟在线精品视频| 91福利国产成人精品照片| 亚洲欧美区自拍先锋| 色综合久久六月婷婷中文字幕| 色猫猫国产区一区二在线视频| 高潮精品一区videoshd| 99精品欧美一区二区蜜桃免费| 欧美一级免费大片| 欧美精品一卡二卡| 国产精品国产自产拍高清av | 视频一区视频二区中文字幕| 成人黄色在线看| 日韩理论片在线| 51精品秘密在线观看| 成人免费黄色在线| 亚洲成人精品影院| www久久久久| 色婷婷狠狠综合| 久久不见久久见免费视频7| 伊人色综合久久天天人手人婷| 日韩美女在线视频| 波多野结衣在线一区| 人妖欧美一区二区| 国产精品三级av| 正在播放亚洲一区| 91视频在线观看免费| 亚洲成人资源在线| 亚洲综合男人的天堂| 亚洲精品一区二区三区在线观看| 99精品视频中文字幕| 久久成人免费网站| 一区二区三区.www| 国产偷国产偷亚洲高清人白洁| 欧美日韩精品免费观看视频| 国产成人免费xxxxxxxx| 日韩电影在线观看一区| 中文一区二区在线观看| 欧美激情在线看| 日韩欧美国产午夜精品| 欧美午夜片在线看| 高潮精品一区videoshd| 蜜桃一区二区三区在线观看| 一区二区三区产品免费精品久久75| 久久久久久久久久久久久久久99 | 国产成人亚洲综合色影视| 丝袜美腿高跟呻吟高潮一区| 亚洲欧美偷拍卡通变态| 中文久久乱码一区二区| 欧美精品亚洲一区二区在线播放| 9色porny自拍视频一区二区| 国产在线精品一区二区| 狠狠狠色丁香婷婷综合激情| 亚洲成人av电影在线| 亚洲一区国产视频| 亚洲三级理论片| 亚洲天堂2016| 亚洲欧美日韩久久| 伊人一区二区三区| 亚洲综合色成人| 亚洲一区国产视频| 亚洲6080在线| 亚洲美女偷拍久久| 婷婷综合五月天| 舔着乳尖日韩一区| 午夜不卡在线视频| 首页亚洲欧美制服丝腿| 日韩av电影免费观看高清完整版 | 一区二区三区.www| 一区二区三区免费网站| 国产精品成人一区二区三区夜夜夜| 亚洲精品乱码久久久久久| 一区二区三区在线观看视频| 亚洲一区二区三区四区在线观看| 尤物在线观看一区| 偷拍一区二区三区| 热久久一区二区| 国产在线不卡视频| 波多野结衣在线aⅴ中文字幕不卡| 99麻豆久久久国产精品免费优播| 99riav久久精品riav| 91福利视频网站| 日韩欧美在线1卡| 国产视频一区在线播放| 中文字幕日韩av资源站| 亚洲资源在线观看| 男女激情视频一区| 日韩综合在线视频| 91一区一区三区| 欧美剧情片在线观看| 精品盗摄一区二区三区| 欧美激情中文不卡| 亚洲一区二区精品3399| 精品一区二区精品| 豆国产96在线|亚洲| 69成人精品免费视频| 欧美国产欧美综合| 性久久久久久久久| 国产剧情一区二区三区| 欧亚一区二区三区| 精品久久久久久亚洲综合网| 亚洲天天做日日做天天谢日日欢| 亚洲精品亚洲人成人网在线播放| 国产麻豆精品一区二区| 欧美色老头old∨ideo| 久久久午夜电影| 亚洲专区一二三| 国产成人精品一区二| 欧美视频在线一区| 日韩无一区二区| 视频一区中文字幕| 91小视频免费观看| 精品久久久三级丝袜| 亚洲国产一区二区a毛片| 成人一区二区三区在线观看| 欧美美女喷水视频| 亚洲欧美日韩国产另类专区| 天堂精品中文字幕在线| 欧美最猛性xxxxx直播| 国产欧美日韩久久| 久久国产精品色婷婷| 欧美性受xxxx| 中文字幕精品三区| 久久99国产精品久久99果冻传媒| 在线观看av不卡| 亚洲三级在线免费观看| 国产精品一区在线观看你懂的| 在线电影院国产精品| 亚洲一区自拍偷拍| 成人自拍视频在线观看|