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

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

?? base.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 java.awt.Color;
import java.awt.event.*;
import netwar.game.unit.*;
import netwar.settings.*;
import netwar.Netwar;
import netwar.utils.*;
import netwar.utils.vectorgraphics.*;

/** Large immobile GameObject which creates Units.
 * This object occupies seven hexes, is immobile, and has no weapon.
 * The official victory conditions state that losing your Base means you
 * lose the game, last player with a Base wins.
 * Implementation of that victory condition are being delayed during this
 * phase of development/testing.
 * @author Group N2 - Project Netwar
 * @author Daniel Grund
 */
public class Base extends GameObject {
	private int health;
	private Unit uToMake = null;
	private Unit making[] = new Unit[6];
	private int buildSequence[] = new int[6];
	//zol is the base itself.
	//concrete is the global concrete model
	//vcgt is the virtual copy of the concrete
	//cps is the set of points for vcgt
	//doors abd halls are for the animation
	//basePoints is for building the main base model
	private ZOrderedList zol = null;
	private static ZOrderedList concrete = null;
	private static CoherentPointSet cps = null;
	private GraphicThing vcgt = null;
	private CoherentPointSet doors[] = new CoherentPointSet[6];
	private CoherentPointSet halls[] = new CoherentPointSet[6];
	private static Point3D basePoints[] = new Point3D[25];
	private static Point3D temp = new Point3D();
        final private int MAXHEALTH = 1000;
        final private String NAME = "HeadQuarters";
        final private int ARMOR = 5;
	
       /** This constructor is and should only be used by a Base object that is to
         *  be used in comparing. Hex's getMinimapColor() uses a Base object created
         *  with this constuctor to see if the occupant of that hes is a Base.
         */
        public Base() {}
	/** Reserves the region occupied by the base. The hex coordinates passed,
	 * (X,Y), are the bottom center hex of the 7-hex region occupied by the base.
	 */
	public Base(int X, int Y) {
		x = X;
		y = Y;
		Hex.getHex(X,Y).reserve();
		Hex.getHex(X-1,Y).reserve();
		Hex.getHex(X-1,Y+1).reserve();
		Hex.getHex(X,Y+1).reserve();
		Hex.getHex(X,Y+2).reserve();
		Hex.getHex(X+1,Y+1).reserve();
		Hex.getHex(X+1,Y+2).reserve();
		Hex.getHex(X,Y).enter(this);
		Hex.getHex(X-1,Y).enter(this);
		Hex.getHex(X-1,Y+1).enter(this);
		Hex.getHex(X,Y+1).enter(this);
		Hex.getHex(X,Y+2).enter(this);
		Hex.getHex(X+1,Y+1).enter(this);
		Hex.getHex(X+1,Y+2).enter(this);
		
		health = 1000;
	}
	/** If the base is not already trying to make a Unit, this will cause it to
	 * begin attempting to make a unit. A Unit currently takes one frame of the
	 * Base's time to make, unless the Base has no available locations to build the
	 * Unit.
	 */
	public void spawnUnit(int uNumber, int numberOfPlayerWhoBuiltThisUnit) {
		if(uToMake != null)
			return;
                try {
                    UnitSet us = GameSettings.currentSettings.players[numberOfPlayerWhoBuiltThisUnit-1].unitSet;
                    uToMake = (Unit)(Class.forName(us.getUnitClassNames()[uNumber]).newInstance());
                } catch(Exception e) {
                    System.out.println("Problem making unit!");
                }

		if(uToMake.cost() > myPlayer.getCash())
			uToMake = null;
		else {
			myPlayer.addToCash(-uToMake.cost());
                        ((netwar.gui.NetwarPanel)netwar.Netwar.netwar.getDataViewer()).unitAdded(numberOfPlayerWhoBuiltThisUnit); // This tells the gui panel that another unit has been made
                }
	}
	//Make a unit in the specified space. If successful, set uToMake to null.
	private void makeUnit(int X, int Y, int F) {
		Hex buildHex = Hex.getHex(X, Y);
		if(buildHex.reserve()) {
			if(buildHex.isEmpty() && buildSequence[F] == 0) {
				buildSequence[F] = 40;
				making[F] = uToMake;
				uToMake = null;
			}else{
				buildHex.unreserve();
			}
		}
	}
	
	//The remaining over-ride the Unit defaults
	/** Perform operations for this time step.
	 * Specifically, perform the Point3D transforms for any/all animations, and
	 * attempt to make a unit if a unit creation was requested.
	 */
	protected void update() {
		if(health <= 0) {
			if(frame > 0)
				animateDie();
			return;
		}
		if(uToMake != null) {
			makeUnit(x, y-1, 4);
			if(uToMake != null) {
				makeUnit(x+2, y+1, 5);
				if(uToMake != null) {
					makeUnit(x+2, y+3, 0);
					if(uToMake != null) {
						makeUnit(x, y+3, 1);
						if(uToMake != null) {
							makeUnit(x-2, y+1, 2);
							if(uToMake != null) {
								makeUnit(x-2, y-1, 3);
							}
						}
					}
				}
			}
		}
		for(int i = 0; i < 6; i++) {
			if(buildSequence[i] > 0) {
				if(buildSequence[i] > 30) {
					temp.set(2 * Trig.cos(30 + i * 60),2 * Trig.sin(30 + i * 60),0);
					halls[i].translate(temp);
					doors[i].translate(temp);
				}else if(buildSequence[i] > 20) {
					temp = doors[i].getPoint(2).getDifference(doors[i].getPoint(5));
					doors[i].rotate(doors[i].getPoint(2), temp, 351);
				}else if(buildSequence[i] > 10) {
					temp.set(-2 * Trig.cos(30 + i * 60),-2 * Trig.sin(30 + i * 60),0);
					halls[i].translate(temp);
					doors[i].translate(temp);
				}else{
					temp = doors[i].getPoint(2).getDifference(doors[i].getPoint(5));
					doors[i].rotate(doors[i].getPoint(2), temp, 9);
				}
				 ZListNode zln;
				 int n=0;
				 for(zln = zol.zNode; zln != null; zln = zln.getNext()) {
					n++;
				 }
				 ZListNode zlna[] = new ZListNode[n];
				 n=0;
				 for(zln = zol.zNode; zln != null; zln = zln.getNext()) {
					 zlna[n++] = zln;
				 }
				 for(n=0;n<zlna.length;n++) {
					 zlna[n].getThing().update();
				 }
				buildSequence[i]--;
				if(buildSequence[i] == 30) {
					Unit.newGameObject(making[i],
					x + ((i == 0 || i == 5) ? (2) : ((i == 2 || i == 3) ? (-2) : (0))),
					y + ((i == 0 || i == 1) ? (3) : ((i == 3 || i == 4) ? (-1) : (1))),
					i, myPlayer);
					making[i].setGoal(
					x + ((i == 0 || i == 5) ? (4) : ((i == 2 || i == 3) ? (-4) : (0))),
					y + ((i == 0 || i == 1) ? (5) : ((i == 3 || i == 4) ? (-3) : (1))));
					making[i] = null;
				}
			}
		}
		
	}
	/** Initialize the Point3Ds used for this Base.
	 * These are the location of the ground-center of the Base in game-space, and
	 * the relative locations of the triangle/line vertices relative to that point.
	 */
	protected void createVectors() {
		vr = new Point3D[1];
		
		vr[0] = Hex.getMapPoint(x,y + 1);
		
		if(cps == null) {
			//Make static parts.
			cps = new CoherentPointSet(25);
			cps.add(new SelfConvertingPoint(0,0,0));
			
			cps.add(new SelfConvertingPoint(HexType.m_topLeft.x * 2 - HexType.m_lowerLeft.x, HexType.m_topLeft.y * 2 - HexType.m_lowerLeft.y, 0));
			cps.add(new SelfConvertingPoint(HexType.m_topLeft.x * 3 - HexType.m_lowerLeft.x * 2, HexType.m_topLeft.y * 3 - HexType.m_lowerLeft.y * 2, 0));
			cps.add(new SelfConvertingPoint(HexType.m_topRight.x * 3 - HexType.m_lowerRight.x * 2, HexType.m_topRight.y * 3 - HexType.m_lowerRight.y * 2, 0));
			cps.add(new SelfConvertingPoint(HexType.m_topRight.x * 2 - HexType.m_lowerRight.x, HexType.m_topRight.y * 2 - HexType.m_lowerRight.y, 0));
			
			cps.add(new SelfConvertingPoint(HexType.m_topRight.x * 2 - HexType.m_middleLeft.x, HexType.m_topRight.y * 2 - HexType.m_middleLeft.y, 0));
			cps.add(new SelfConvertingPoint(HexType.m_topRight.x * 3 - HexType.m_middleLeft.x * 2, HexType.m_topRight.y * 3 - HexType.m_middleLeft.y * 2, 0));
			cps.add(new SelfConvertingPoint(HexType.m_middleRight.x * 3 - HexType.m_lowerLeft.x * 2, HexType.m_middleRight.y * 3 - HexType.m_lowerLeft.y * 2, 0));
			cps.add(new SelfConvertingPoint(HexType.m_middleRight.x * 2 - HexType.m_lowerLeft.x, HexType.m_middleRight.y * 2 - HexType.m_lowerLeft.y, 0));
			
			cps.add(new SelfConvertingPoint(HexType.m_middleRight.x * 2 - HexType.m_topLeft.x, HexType.m_middleRight.y * 2 - HexType.m_topLeft.y, 0));
			cps.add(new SelfConvertingPoint(HexType.m_middleRight.x * 3 - HexType.m_topLeft.x * 2, HexType.m_middleRight.y * 3 - HexType.m_topLeft.y * 2, 0));
			cps.add(new SelfConvertingPoint(HexType.m_lowerRight.x * 3 - HexType.m_middleLeft.x * 2, HexType.m_lowerRight.y * 3 - HexType.m_middleLeft.y * 2, 0));
			cps.add(new SelfConvertingPoint(HexType.m_lowerRight.x * 2 - HexType.m_middleLeft.x, HexType.m_lowerRight.y * 2 - HexType.m_middleLeft.y, 0));
			
			cps.add(new SelfConvertingPoint(HexType.m_lowerRight.x * 2 - HexType.m_topRight.x, HexType.m_lowerRight.y * 2 - HexType.m_topRight.y, 0));
			cps.add(new SelfConvertingPoint(HexType.m_lowerRight.x * 3 - HexType.m_topRight.x * 2, HexType.m_lowerRight.y * 3 - HexType.m_topRight.y * 2, 0));
			cps.add(new SelfConvertingPoint(HexType.m_lowerLeft.x * 3 - HexType.m_topLeft.x * 2, HexType.m_lowerLeft.y * 3 - HexType.m_topLeft.y * 2, 0));
			cps.add(new SelfConvertingPoint(HexType.m_lowerLeft.x * 2 - HexType.m_topLeft.x, HexType.m_lowerLeft.y * 2 - HexType.m_topLeft.y, 0));
			
			cps.add(new SelfConvertingPoint(HexType.m_lowerLeft.x * 2 - HexType.m_middleRight.x, HexType.m_lowerLeft.y * 2 - HexType.m_middleRight.y, 0));
			cps.add(new SelfConvertingPoint(HexType.m_lowerLeft.x * 3 - HexType.m_middleRight.x * 2, HexType.m_lowerLeft.y * 3 - HexType.m_middleRight.y * 2, 0));
			cps.add(new SelfConvertingPoint(HexType.m_middleLeft.x * 3 - HexType.m_topRight.x * 2, HexType.m_middleLeft.y * 3 - HexType.m_topRight.y * 2, 0));
			cps.add(new SelfConvertingPoint(HexType.m_middleLeft.x * 2 - HexType.m_topRight.x, HexType.m_middleLeft.y * 2 - HexType.m_topRight.y, 0));
			
			cps.add(new SelfConvertingPoint(HexType.m_middleLeft.x * 2 - HexType.m_lowerRight.x, HexType.m_middleLeft.y * 2 - HexType.m_lowerRight.y, 0));
			cps.add(new SelfConvertingPoint(HexType.m_middleLeft.x * 3 - HexType.m_lowerRight.x * 2, HexType.m_middleLeft.y * 3 - HexType.m_lowerRight.y * 2, 0));
			cps.add(new SelfConvertingPoint(HexType.m_topLeft.x * 3 - HexType.m_middleRight.x * 2, HexType.m_topLeft.y * 3 - HexType.m_middleRight.y * 2, 0));
			cps.add(new SelfConvertingPoint(HexType.m_topLeft.x * 2 - HexType.m_middleRight.x, HexType.m_topLeft.y * 2 - HexType.m_middleRight.y, 0));
			
			concrete = new ZOrderedList(netwar.gui.HexViewer.getHexViewer().getTransform());
			
			concrete.add(new GraphicTriangle( cps.getPoint(0), cps.getPoint(1), cps.getPoint(4), Color.lightGray));
			concrete.add(new GraphicParallelogram( cps.getPoint(1), cps.getPoint(2), cps.getPoint(3), cps.getPoint(4), Color.lightGray));
			concrete.add(new GraphicTriangle( cps.getPoint(0), cps.getPoint(4), cps.getPoint(5), Color.lightGray));
			
			concrete.add(new GraphicTriangle( cps.getPoint(0), cps.getPoint(5), cps.getPoint(8), Color.lightGray));
			concrete.add(new GraphicParallelogram( cps.getPoint(5), cps.getPoint(6), cps.getPoint(7), cps.getPoint(8), Color.lightGray));
			concrete.add(new GraphicTriangle( cps.getPoint(0), cps.getPoint(8), cps.getPoint(9), Color.lightGray));
			
			concrete.add(new GraphicTriangle( cps.getPoint(0), cps.getPoint(9), cps.getPoint(12), Color.lightGray));
			concrete.add(new GraphicParallelogram( cps.getPoint(9), cps.getPoint(10), cps.getPoint(11), cps.getPoint(12), Color.lightGray));
			concrete.add(new GraphicTriangle( cps.getPoint(0), cps.getPoint(12), cps.getPoint(13), Color.lightGray));
			
			concrete.add(new GraphicTriangle( cps.getPoint(0), cps.getPoint(13), cps.getPoint(16), Color.lightGray));
			concrete.add(new GraphicParallelogram( cps.getPoint(13), cps.getPoint(14), cps.getPoint(15), cps.getPoint(16), Color.lightGray));
			concrete.add(new GraphicTriangle( cps.getPoint(0), cps.getPoint(16), cps.getPoint(17), Color.lightGray));
			
			concrete.add(new GraphicTriangle( cps.getPoint(0), cps.getPoint(17), cps.getPoint(20), Color.lightGray));
			concrete.add(new GraphicParallelogram( cps.getPoint(17), cps.getPoint(18), cps.getPoint(19), cps.getPoint(20), Color.lightGray));
			concrete.add(new GraphicTriangle( cps.getPoint(0), cps.getPoint(20), cps.getPoint(21), Color.lightGray));
			
			concrete.add(new GraphicTriangle( cps.getPoint(0), cps.getPoint(21), cps.getPoint(24), Color.lightGray));
			concrete.add(new GraphicParallelogram( cps.getPoint(21), cps.getPoint(22), cps.getPoint(23), cps.getPoint(24), Color.lightGray));
			concrete.add(new GraphicTriangle( cps.getPoint(0), cps.getPoint(24), cps.getPoint(1), Color.lightGray));
			
			basePoints[0] = new Point3D(0,0,24);
			basePoints[1] = new Point3D(0,0,20);
			basePoints[1].doSum(HexType.m_middleRight);
			basePoints[7] = HexType.m_middleRight.getDifference(HexType.m_lowerLeft);
			basePoints[7].doProduct(0.5f);
			basePoints[7].doSum(HexType.m_middleRight);
			basePoints[13] = HexType.m_middleRight.getDifference(HexType.m_topLeft);
			basePoints[13].doProduct(0.5f);
			basePoints[13].doSum(HexType.m_middleRight);
			basePoints[19] = new Point3D(HexType.m_middleRight);
			for(int i = 1; i < 6; i++) {
				basePoints[1 + i] = basePoints[1].getRotate(Point3D.origin, Point3D.unitUp, 60 * i);
				basePoints[7 + i] = basePoints[7].getRotate(Point3D.origin, Point3D.unitUp, 60 * i);
				basePoints[13 + i] = basePoints[13].getRotate(Point3D.origin, Point3D.unitUp, 60 * i);
				basePoints[19 + i] = basePoints[19].getRotate(Point3D.origin, Point3D.unitUp, 60 * i);
			}
		}
		vcgt = new SpoofZ(new VirtualCoherentGraphicThing(concrete, cps, vr[0], 0), -1 * Float.MAX_VALUE);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产91丝袜在线18| 久久婷婷色综合| 99久久伊人网影院| 欧美午夜宅男影院| 久久综合色一综合色88| 亚洲精品成人精品456| 国产精品一区免费在线观看| 91麻豆精品秘密| 久久色中文字幕| 亚洲va欧美va人人爽| 波多野洁衣一区| 欧美成人高清电影在线| 亚洲一区二区三区四区在线| 欧美一区二区三区播放老司机| 欧美一级片在线观看| 国产精品久久久99| 成人激情动漫在线观看| 精品久久久久一区| 午夜国产精品一区| 91亚洲永久精品| 久久久精品黄色| 久久国产三级精品| 欧美一区二区视频在线观看2022| 一区在线观看免费| 成人国产精品视频| wwww国产精品欧美| 久久精品国产在热久久| 91精品婷婷国产综合久久竹菊| 一区二区三区免费网站| 91美女福利视频| 综合av第一页| 国产精品国产自产拍在线| 国产亚洲精久久久久久| 欧美日韩国产高清一区二区三区| 美女在线观看视频一区二区| 国产色产综合色产在线视频| 一区在线观看免费| 丝袜国产日韩另类美女| 国产精品88888| 欧美伊人久久大香线蕉综合69| 欧美一区二区三区不卡| ㊣最新国产の精品bt伙计久久| 午夜激情综合网| 国产精品一区二区久久精品爱涩| 色欧美乱欧美15图片| 日韩视频国产视频| 亚洲欧美日韩人成在线播放| 久久国产尿小便嘘嘘| 91国偷自产一区二区三区观看| 精品噜噜噜噜久久久久久久久试看 | 精品久久久久久久人人人人传媒 | 一区二区三区成人| 激情欧美一区二区| 欧美日韩一级黄| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 亚洲视频每日更新| 激情国产一区二区| 欧美日韩高清影院| 一区二区三区四区不卡在线| 国产精品亚洲一区二区三区妖精 | 精品一区二区影视| 欧美精品丝袜中出| 亚洲高清免费在线| 在线观看日韩毛片| 1024亚洲合集| 成人av午夜电影| 中文字幕第一区综合| 国产综合色在线| 欧美大片一区二区| 日韩国产精品大片| 欧美军同video69gay| 亚洲第一搞黄网站| 欧美日韩一区二区三区免费看| 1024亚洲合集| 在线一区二区三区| 一区二区三区精品视频在线| 91蜜桃在线免费视频| 亚洲视频小说图片| 色屁屁一区二区| 亚洲国产日韩a在线播放性色| 99国内精品久久| 亚洲视频免费在线观看| 色综合天天综合网天天狠天天| 国产精品视频你懂的| av电影一区二区| 亚洲男人的天堂一区二区| 91在线观看污| 亚洲影院久久精品| 91.xcao| 久久99精品国产91久久来源 | 国产黄色精品视频| 国产欧美精品一区| 99精品国产91久久久久久| 亚洲精品五月天| 欧美日韩国产精品成人| 麻豆一区二区三| 国产欧美日本一区视频| 91免费看`日韩一区二区| 亚洲综合小说图片| 日韩精品资源二区在线| 国产老妇另类xxxxx| 国产精品福利一区| 欧美午夜精品一区二区蜜桃 | 精品少妇一区二区三区在线播放| 久久不见久久见免费视频7| 国产亚洲美州欧州综合国| 北岛玲一区二区三区四区| 亚洲一区二区三区中文字幕| 欧美群妇大交群的观看方式| 激情欧美一区二区| 亚洲精品国产第一综合99久久 | 国产精品中文有码| 777午夜精品视频在线播放| 国产在线一区观看| 激情综合网激情| 精品中文字幕一区二区| 美女视频黄a大片欧美| 日韩高清在线电影| 免费人成在线不卡| 在线观看欧美黄色| 麻豆91小视频| 亚洲综合一区二区| 青青青爽久久午夜综合久久午夜| 天天影视色香欲综合网老头| 日韩在线一区二区| 精品一区二区精品| 91精品国产一区二区三区蜜臀| 欧美日韩一区在线观看| 26uuu精品一区二区在线观看| 中文字幕亚洲在| 国产亚洲精品aa午夜观看| 日韩天堂在线观看| 日韩一级二级三级精品视频| 制服丝袜一区二区三区| 日韩欧美一级二级三级久久久| 精品嫩草影院久久| 欧美激情一区二区三区在线| 亚洲国产精品成人综合| 亚洲欧美日韩一区二区| 亚洲国产精品久久人人爱蜜臀| 亚洲成av人片www| 奇米777欧美一区二区| 国产一区二区视频在线播放| 国产成人精品网址| 在线一区二区观看| 日韩一区二区三区在线| 欧美国产成人在线| av成人免费在线| 国产欧美精品国产国产专区| 精品视频一区二区三区免费| 欧美三级日韩三级| 日韩一区和二区| 国产精品乱码久久久久久| 一区二区欧美视频| 麻豆精品一区二区综合av| 粉嫩久久99精品久久久久久夜 | 色诱亚洲精品久久久久久| 欧美日韩一区二区欧美激情| 26uuu精品一区二区| 亚洲精品视频在线观看免费| 日本亚洲三级在线| 91小视频免费看| 精品国产乱码久久久久久久久| 亚洲人成电影网站色mp4| 毛片av中文字幕一区二区| 972aa.com艺术欧美| 精品久久一区二区三区| 一二三区精品福利视频| 国产成人av一区| 欧美一级在线视频| 成人欧美一区二区三区1314| 精品一区二区三区免费播放| 在线观看日韩一区| 国产精品理论片在线观看| 蜜桃视频在线观看一区二区| 色屁屁一区二区| 欧美日韩一级二级| 91免费版在线看| 欧美一级一区二区| 欧美激情一区二区三区蜜桃视频| 中文字幕一区av| 五月激情综合婷婷| 久久66热re国产| 盗摄精品av一区二区三区| 色欧美日韩亚洲| 日韩精品综合一本久道在线视频| 国产精品天天摸av网| 亚洲午夜电影在线观看| 国产一区二区三区在线观看免费 | 亚洲成人www| 国产在线视频精品一区| 91偷拍与自偷拍精品| 日韩午夜在线播放| 国产精品国产精品国产专区不片| 亚洲6080在线| 成人av在线一区二区| 日韩视频在线一区二区| 亚洲人一二三区| 国产毛片精品国产一区二区三区| 97久久精品人人做人人爽|