Exemplo n.º 1
0
	public void unitToAct(UnitScript unit){
		if(unit != null){
			if(unit.getNumberOfActionsInQueue() != 0){
				if(unit.IsActing){
					Debug.LogWarning("Unit is already acting!"); 
				} else{
					//Check if unit is already in queue.
					bool unitInQueue = false;
					foreach( UnitActingScript uas in unitActingQueue.actingQueue ){
						if(uas.unit == unit)
							unitInQueue = true;
						break;
					}
					if(unitInQueue){
						Debug.LogWarning("Unit is already in unit queue!");
						return;
					}
					if(Player.Instance.workingOnline == true){
						GridLocation cU_Locaiton = unit.getCurrentBlockHeadLocation().gridLocation;
						Player.Instance.thisPlayersNetworkHelper.sendAUnitsActingQueueToAllClients((ushort)cU_Locaiton.x, (ushort)cU_Locaiton.y);
					} else{
						unitActingQueue.addToUnitActing(unit);
					}
				}
			} else{
				Debug.LogWarning("Unit does not have any actions queued!"); 
			}
		} else{
			//TODO Give user feedback of this
			Debug.LogWarning("No unit selected!");
		}
	}