public void Update() { if (_vertexes == null && _building != null && !UMath.nearEqualByDistance(_building.transform.position, new Vector3(), 1f)) { _vertexes = _building.Geometry.GetComponent <MeshFilter>().mesh.vertices; _diff = _building.transform.position - new Vector3(); } if (_count < _vertexes.Length) { var cube = UVisHelp.CreateHelpers(_vertexes[_count] + _diff, Root.cube); GameObject go = new GameObject(); go.transform.SetParent(_container.transform); go.transform.localPosition = new Vector3(); cube.transform.SetParent(go.transform); go.transform.localScale = _building.Geometry.transform.localScale; go.transform.localRotation = _building.Geometry.transform.localRotation; go.transform.localPosition = _building.Geometry.transform.localPosition; _show.Add(cube); _empties.Add(go); _count++; } }
/// <summary> /// Collision with the rest of the obj and bounds update for all types of ways (not including bridges) /// </summary> void CollideUpdatePrevForAllWays(List <Vector3> _verticPathP, List <Vector3> _horPathP) { if (_verticPathP.Count > 0) { //if is a DraggableSquare will not create the prev way if (Category != Ca.DraggableSquare) { _prevWayVertic = UVisHelp.CreatePreviewWay(_verticPathP, _previewRoot, _previewCellRadius); } UpdateVerticBound(); IsWayColliding = CheckIfBoundsCollide(_boundsVertic); } if (_horPathP.Count > 0) { //if is a DraggableSquare will not create the prev way if (Category != Ca.DraggableSquare) { _prevWayHor = UVisHelp.CreatePreviewWay(_horPathP, _previewRoot, _previewCellRadius); } UpdateHorizBound(); if (!IsWayColliding) { IsWayColliding = CheckIfBoundsCollide(_boundsHoriz); } } }
private List <Lot> FindTheLots(List <Vector3> pathP) { List <Lot> lots = Program.gameScene.controllerMain.MeshController.Malla.Lots; List <Vector3> firstAndSecondPoints = ReturnFirstAndLastPointOnShore(pathP, 0.3f, pathP[0].y); UVisHelp.CreateHelpers(firstAndSecondPoints, Root.redSphereHelp); List <int> indexes = UMesh.ReturnIndexesContainDistinct(firstAndSecondPoints, lots); string msg = ""; for (int i = 0; i < indexes.Count; i++) { msg += indexes[i] + "\n"; } print(msg + "Count:" + indexes.Count); List <Lot> res = new List <Lot>(); for (int i = 0; i < indexes.Count; i++) { for (int j = 0; j < lots.Count; j++) { if (lots[j].Index == indexes[i]) { res.Add(lots[j]); } } } return(res); }
/// <summary> /// Find the initial position of prime _a1 and _b1 /// </summary> private void InitPrimes() { var midHelp = UVisHelp.CreateHelpers(_mid, Root.yellowCube); var a1Help = UVisHelp.CreateHelpers(_a, Root.yellowCube); var b1Help = UVisHelp.CreateHelpers(_b, Root.yellowCube); a1Help.transform.SetParent(midHelp.transform); b1Help.transform.SetParent(midHelp.transform); midHelp.transform.Rotate(0, 90, 0); _a1 = a1Help.transform.position; _b1 = b1Help.transform.position; var dist = Vector3.Distance(_mid, _a1); var times = 3;//8 for mountains was working ok //pushe them aaway another step as big as the dist btw them initialiliy and middle * times _a1 = Vector3.MoveTowards(_a1, _mid, -dist * times); _b1 = Vector3.MoveTowards(_b1, _mid, -dist * times); midHelp.Destroy(); a1Help.Destroy(); b1Help.Destroy(); }
void Debugg(Vector3 pt) { if (deb != null) { deb.Destroy(); } deb = UVisHelp.CreateHelpers(pt, Root.redCube); }
//use only now to show last row of ScanTerra() elements void CheckIfStopScanning(List <Vector3> newLot, int polyX, int polyZ, Vector3 start) { if (newLot.Count < polyX * polyZ) { UVisHelp.CreateHelpers(start, Root.blueCubeBig); } }
private void DebugLoc() { //UVisHelp.CreateHelpers(_legs, Root.yellowCube); for (int i = 0; i < _legs.Count; i++) { UVisHelp.CreateText(_legs[i].Position, i + ""); } }
private void Debugg(Vector3 point) { if (deb != null) { deb.Destroy(); } deb = UVisHelp.CreateHelpers(point, Root.yellowCube); deb.name = "Yellow > " + _person.MyId; }
private void ShowEach(DebugCrystal each) { var locPos = each._position; var locInf = each.Info; var yDebug = m.IniTerr.MathCenter.y + 0.2f; var pos3 = new Vector3(locPos.x, yDebug, locPos.y); gameObjects.Add(UVisHelp.CreateHelpers(pos3, Root.largeBlueCube)); gameObjects.Add(UVisHelp.CreateText(pos3, locInf, 15)); }
private void Start() { Map(); init = true; //Initialize(); UVisHelp.CreateHelpers(Program.gameScene.controllerMain.MeshController.wholeMalla, Root.redSphereHelp); StartCoroutine("A2sUpdate"); }
/// <summary> /// Will show names on game /// </summary> private void DebugShowNames() { for (int i = 0; i < _current.LinkRects.Count; i++) { // //Debug.Log(_current.LinkRects[i].Name); UVisHelp.CreateText(U2D.FromV2ToV3(_current.LinkRects[i].Position), _current.LinkRects[i].Name, 150); } for (int i = 0; i < _landZones.Count; i++) { // //Debug.Log(_current.LinkRects[i].Name); UVisHelp.CreateText(U2D.FromV2ToV3(_landZones[i].CalcPosition()) + new Vector3(0, 15, 0), _landZones[i].LandZoneName, 1400); } }
private void ConformRect() { var poly = Registro.FromALotOfVertexToPolyMathCenterY(_eaten); //ShowDebug(poly, Root.blueCube); //expanding the rect //Expands this rect a bit to be linked to others thru with .Contain poly = UPoly.ScalePoly(poly, _rectForcedGrow); _rect = Registro.FromALotOfVertexToRect(poly); UVisHelp.CreateDebugLines(_rect, Color.yellow); FinalizeBaseProps(); }
/// <summary> /// Will tell u if can route /// /// Defines too : _closerMapEntryReachable /// </summary> /// <param name="entry"></param> /// <returns></returns> public bool CanRoute(Vector3 entry, bool addDebugHelp = false) { for (int i = 0; i < _map8entries.Count; i++) { Line line = new Line(_map8entries[i].Point, entry, 50f); //if a can reach 1 then I can use that one if (!MeshController.CrystalManager1.DoIIntersectAnyLine(line, H.WaterObstacle)) { _closerMapEntryReachable = _map8entries[i].Point; if (addDebugHelp) { UVisHelp.CreateHelpers(_closerMapEntryReachable, Root.yellowSphereHelp); } return(true); } } return(false); }
/// <summary> /// Adding a polygon type of object to crystalss used for Buildings and StillElement /// </summary> /// <param name="anchors"></param> /// <param name="parentId"></param> private void AddPoly(List <Vector3> anchors, string parentId, bool debug = false) { var lines = U2D.FromPolyToLines(anchors); var scale = PassAnchorsGetPositionForCrystals(anchors); if (debug) { Debug.Log("crystal added by:" + parentId); UVisHelp.CreateHelpers(scale, Root.yellowCube); } for (int i = 0; i < lines.Count; i++) { CreateAndAddPolyCrystal(scale[i], lines[i], parentId, i); } SetSiblings(); }
public void RightClickDebugShowHelp() { DeleteAllDrawDebug(); if (Input.GetKey(KeyCode.LeftAlt)) { debuger = UVisHelp.CreateHelpers(m.CurrentHoverVertices, Root.blueCube); } else if (Input.GetKey(KeyCode.LeftControl)) { debuger = UVisHelp.CreateHelpers(m.Malla.Lots[localDebugCounter + 0].LotVertices, Root.blueCube); debuger.AddRange(UVisHelp.CreateHelpers(m.Malla.Lots[localDebugCounter + 10].LotVertices, Root.yellowSphereHelp)); debuger.AddRange(UVisHelp.CreateHelpers(m.Malla.Lots[localDebugCounter + 20].LotVertices, Root.blueSphereHelp)); localDebugCounter += 1; } }
private void Debug() { var pos = new Vector3(_position.x, yDebug, _position.y); if (Vector3.Distance(oldPos, pos) < 0.2f) { yDebug += 0.2f; } else { yDebug = m.IniTerr.MathCenter.y + 0.2f; } pos = new Vector3(_position.x, yDebug, _position.y); oldPos = pos; UVisHelp.CreateHelpers(pos, Root.largeBlueCube); UVisHelp.CreateText(pos, _calcWeight.ToString("F1"), 40); }
/// <summary> /// /// </summary> /// <param name="ini"></param> /// <param name="end"></param> /// <param name="minimuSize">must have one side with a mimunum side like 10f /// this is to allow Mountain Routing to happen</param> /// <param name="grow">The grow of the rect on scale to make sure contain first and last </param> public CryRect(Vector3 ini, Vector3 end, float grow, bool minimuSize = true, float debugDuration = 20f) { _a = U2D.FromV3ToV2(ini); var poly = Registro.FromALotOfVertexToPolyMathCenterY(new List <Vector3>() { ini, end }); poly = UPoly.ScalePoly(poly, grow); _theRect = Registro.FromALotOfVertexToRect(poly); _c = U2D.FromV3ToV2(end); _b = FindB(); _d = FindD(); //so Rect Grows //so way routing works //PushThemAway(); if (minimuSize) { //when calling this is really importat bz this solved the Mountain Routing problem //Dec 26 2015 ApplyMinimumSize(); } var newPoly = new List <Vector3>() { U2D.FromV2ToV3(_a), U2D.FromV2ToV3(_b), U2D.FromV2ToV3(_c), U2D.FromV2ToV3(_d) }; _theRect = Registro.FromALotOfVertexToRect(newPoly); //RectifyCorners(poly); UVisHelp.CreateDebugLines(TheRect, Color.magenta, debugDuration); SetCrystals(); }
/// <summary> /// Collision with the rest of the obj and bounds update for only bridges) /// </summary> private void CollideUpdatePrevForBridges(List <Vector3> _verticPathP, List <Vector3> _horPathP) { if (_dominantSide == H.Vertic) { _prevWayVertic = UVisHelp.CreatePreviewWay(_verticPathP, _previewRoot, _previewCellRadius); UpdateVerticBound(); IsWayColliding = CheckIfBoundsCollide(_boundsVertic); BoundsHoriz = null; } else if (_dominantSide == H.Horiz) { _prevWayHor = UVisHelp.CreatePreviewWay(_horPathP, _previewRoot, _previewCellRadius); UpdateHorizBound(); IsWayColliding = CheckIfBoundsCollide(_boundsHoriz); BoundsVertic = null; } }
public static bool IsOnTerrainManipulateTerrainSize(Vector3 a, float manipulateBy) { //bz kkeeps getting smaller //if (terrainPolyScaled == null) //{ //bz was referencing that List var array = Program.gameScene.controllerMain.MeshController.wholeMalla.ToArray(); terrainPolyScaled = UPoly.ScalePoly(array.ToList(), manipulateBy); //} Rect terra = U2D.FromPolyToRect(terrainPolyScaled); terra = U2D.ReturnRectYInverted(terra);//must be inverted to be on same Y values UVisHelp.CreateDebugLines(terra, Color.yellow); if (terra.Contains(new Vector2(a.x, a.z))) { return(true); } return(false); }
public void AddGameObjInPosition(Vector3 pos, string root) { gameObjects.Add(UVisHelp.CreateHelpers(pos, root)); }
public void DebugHere() { UVisHelp.CreateDebugLines(Region, Color.cyan); UVisHelp.CreateText(U2D.FromV2ToV3(Region.center), Index + "|" + WhatAudioIReport, 300); }
private void ShowDebug(List <Vector3> list, string root) { _debug.AddRange(UVisHelp.CreateHelpers(list, root)); }
public void MakeDebugRed() { UVisHelp.CreateDebugLines(_rect, Color.red); }