コード例 #1
0
		public void _CompleteDeployment(){
			if(!_IsDeploymentComplete()) return;
			
			for(int i=0; i<deployedUnitList.Count; i++){
				deployedUnitList[i].factionID=factionList[deployingFactionID].ID;
				factionList[deployingFactionID].allUnitList.Add(deployedUnitList[i]);
			}
			
			deployedUnitList=new List<Unit>();
			deployingUnitID=-1;	
			
			GridManager.FactionDeploymentComplete();
			
			//iterate thru all faction, get the next faction needs unit deployment
			for(int i=deployingFactionID+1; i<factionList.Count; i++){
				if(factionList[i].startingUnitList.Count>0){
					if(factionList[i].isPlayerFaction){
						deployingFactionID=i;
						deployingUnitID=0;	//set to >=0 to indicate there's a player faction needs deployment
						break;
					}
					else{	//if it's an AI faction, automatically deploy it
						AutoDeployFaction(i);
						
						for(int n=0; n<deployedUnitList.Count; n++){
							//deployedUnitList[n].factionID=factionList[i].ID;
							factionList[i].allUnitList.Add(deployedUnitList[n]);
						}
					}
				}
			}
			
			if(deployingUnitID==-1){	//no more faction needs deloyment, start the game
				GameControl.StartGame();
				//if(onUnitDeploymentPhaseE!=null) onUnitDeploymentPhaseE(false);
				TBTK.OnUnitDeployment(false);
			}
			else{							//another player's faction needs deloyment, initiate the process
				GridManager.DeployingFaction(deployingFactionID);
				//if(onUnitDeploymentPhaseE!=null) onUnitDeploymentPhaseE(true);
				TBTK.OnUnitDeployment(true);
			}
		}