public Vector3 ReturnTownIniPos() { if (_inLands == null) { _inLands = CrystalRegions.Where(a => a.WhatAudioIReport == "InLand").ToList(); } var indexA = UMath.GiveRandom(0, _inLands.Count); var point = _inLands[indexA].Position(); var realIndex = _inLands[indexA].Index; //UVisHelp.CreateHelpers(point, Root.yellowCube); var inTerrain = UTerra.IsOnTerrainManipulateTerrainSize(point, -40f);//-1 if (!inTerrain || !IsAdjacentToShore(realIndex)) { if (count1 > 500) { throw new Exception("500 times ReturnTownIniPos() CrystalManager"); } count1++; _inLands.RemoveAt(indexA); return(ReturnTownIniPos()); } Debug.Log("Count1: " + count1 + " ..ReturnTownIniPos() CrystalManager"); count1 = 0; _initialRegionIndex = realIndex; return(point); }
/// <summary> /// Created to Report Ambience Sound. I need to see how many diff crsytals are /// to detect River, Ocean shore and Full Ocean /// </summary> /// <returns></returns> private string DefineWhichAudioIReport() { //106 ocean shore, 84 river , 64 riv if (Index == 106 || Index == 84 || Index == 64) { var a = 1; } if (Index == 51) { var a = 1; } var myCrsytals = ReturnDiffCrystalsNames(); //crystals that are seaType var seaTypes = myCrsytals.Where(a => a.Type1 == H.WaterObstacle).ToList(); var mountTypes = myCrsytals.Where(a => a.Type1 == H.MountainObstacle).ToList(); var linkTypes = myCrsytals.Where(a => a.Type1 == H.LinkRect).ToList(); var uniqueZones = ReturnDiffCrystals(linkTypes, H.LinkRect); if (myCrsytals.Count == 1) { return("InLand"); } else if (mountTypes.Count > 0) { return("Mountain"); } else if (myCrsytals.Count > 1 && uniqueZones.Count == 0) { return("Later");//OceanSHore } else if (myCrsytals.Count > 1 && uniqueZones.Count == 1) { //this ones will find later if have a Full Ocean around if they do that //it is OceanShore. Otherwise is River return("Later"); } else if (myCrsytals.Count > 1 && uniqueZones.Count > 1) { return("River"); } if (!UTerra.IsOnTerrain(U2D.FromV2ToV3(Region.center))) { return("OutOfTerrain"); } return("FullOcean"); }
private float step = 10f;//3f was working ok for mountain private void DefinePositionsToCheck(Vector3 primeVector) { positionsToCheck.Clear(); float dist = Vector3.Distance(primeVector, _mid);//sp it goes twice as far to check Vector3 t = _mid; for (float i = 0; i < dist; i = i + step) { t = Vector3.MoveTowards(t, primeVector, step); //if is not on Terrain will break loop so wont add antyhing else towards that Prime //bz sim,ply after that is just out of terrain. In this way I will never RayCast a point //out of terrain if (!UTerra.IsOnTerrain(t)) { //Debug.Log("not on terrain Delta DefinePositionsToCheck()"); break; } step *= 2f; positionsToCheck.Add(t); } //_person.DebugList.AddRange(UVisHelp.CreateHelpers(positionsToCheck, Root.blueSphereHelp)); step = 10f; }