public void Centre_HighlightMap(HighlightCritera criteria) { Transform regions = GameObject.Find("Regions").transform; //Darken the whole map first Centre_InitialiseMap(HighLightMode.Darken); switch (criteria) { case HighlightCritera.BuildableRegions: for (int count = 0; count < 12; count++) { RegionCore targetRegion = regions.GetChild(count).GetComponent <RegionCore>(); if (targetRegion) { if (targetRegion.owner == playerCore.playerID) { if (targetRegion.ownedBuildings.Count < 2) { Centre_HighlightMap(count, HighLightMode.Lighten); } else { Centre_HighlightMap(count, HighLightMode.Reden); } } } } break; } }
public void TravelToNextPoint() { if (pathInstructionSet.Count != 0) { while (true) { if (Helper.ConvertRegionNameToID(currentLocation) != pathInstructionSet[0]) { previousInstruction = pathInstructionSet[0]; transform.position = regionT.GetChild(pathInstructionSet[0]).position + new Vector3(100, 0, 100); currentLocation = regionT.GetChild(pathInstructionSet[0]).name; pathInstructionSet.Remove(pathInstructionSet[0]); //hudInstructionSet.Remove(hudInstructionSet[0]); if (pathInstructionSet.Count == 0) { //BUILDERS if (Helper.ConvertUnitTypeToInt(type) >= 3 && Helper.ConvertUnitTypeToInt(type) <= 5 && !beginConstruction && previousInstruction != 0) { RegionCore targetRegion = regionT.GetChild(Helper.ConvertRegionNameToID(currentLocation)).GetComponent <RegionCore>(); if (targetRegion.owner == menu.playerCore.playerID && targetRegion.ownedBuildings.Count < 2) { beginConstruction = true; Debug.Log(this + " Builders have begun construction!"); } } } break; } else { previousInstruction = pathInstructionSet[0]; pathInstructionSet.Remove(pathInstructionSet[0]); //hudInstructionSet.Remove(hudInstructionSet[0]); Debug.LogWarning("Removed an instruction!"); } } } }
void OnTriggerEnter(Collider collision) { if (collision.tag == "RegionEnter") { if (currentRegion != null && currentRegion.playersInRegion.Contains(this)) { if (currentRegion.capturer == playerID && currentRegion.owner != playerID) { RpcPingCaptureTimer(true); } currentRegion.playersInRegion.Remove(this); } RegionCore thisRegionCore = collision.transform.parent.GetComponent <RegionCore>(); currentLocation = thisRegionCore.regionHandle; currentRegion = thisRegionCore; RpcPingLocation(thisRegionCore.owner, thisRegionCore.nonCore, thisRegionCore.regionHandle); if (!thisRegionCore.playersInRegion.Contains(this)) { thisRegionCore.playersInRegion.Add(this); } if (!thisRegionCore.nonCore) { thisRegionCore.SpawnCritters(); } //Update Music //music.UpdateTrack(Helper.ConvertRegionNameToID(collision.transform.parent.name)); //Log event Debug.Log("Player has moved to " + currentLocation); //Update Fog Of War //UpdateFogOfWar(); } }