void UpdateBigBoxesPrev() { InitializeBigBoxPrev(); float diffYVertic = UMath.ReturnDiffBetwMaxAndMin(_verticPathNew, H.Y); float diffYHoriz = UMath.ReturnDiffBetwMaxAndMin(_horPathNew, H.Y); float biggestDiff = UMath.ReturnMax(diffYVertic, diffYHoriz); List <float> yS = UList.ReturnAxisList(_verticPathNew, H.Y); yS.AddRange(UList.ReturnAxisList(_horPathNew, H.Y)); float maxY = UMath.ReturnMax(yS); if (_dominantSide == H.Vertic) { var locVertBound = MakeListYVal(BoundsVertic, maxY); verticBigBox.UpdatePos(locVertBound, biggestDiff + 0.5f); verticBigBox.CheckAndSwitchColor(_isWayOK); } else if (_dominantSide == H.Horiz) { var locHorBound = MakeListYVal(BoundsHoriz, maxY); horizBigBox.UpdatePos(locHorBound, biggestDiff + 0.5f); horizBigBox.CheckAndSwitchColor(_isWayOK); } //this is for all but bridges and DraggableSquare. Dominant Side here is None else if (_dominantSide == H.None && !HType.ToString().Contains("Bridge") && Category != Ca.DraggableSquare) { UpdateBigBoxesPrevForAllButBridges(maxY, biggestDiff); } TogglePrevBigBoxesVisible(); }
/// <summary> /// Define with path of a bridge is the longest used /// </summary> void DefineBridgeDominantSide() { if (_verticPathNew.Count == 0 || _horPathNew.Count == 0) { return; } float verticYDiff = UMath.ReturnDiffBetwMaxAndMin(_verticPathNew, H.Y); float horYDiff = UMath.ReturnDiffBetwMaxAndMin(_horPathNew, H.Y); if (verticYDiff > horYDiff) { _dominantSide = H.Vertic; } else if (verticYDiff < horYDiff) { _dominantSide = H.Horiz; } else { _dominantSide = H.Same_Length_Both_Sides; IsWayEven = false; print("Unable to place bridge here Way.cs both side are the same or bridge is on the floor"); } }
/// <summary> /// Updates Farm preview /// </summary> void UpdateFarmPrev() { float diffY = UMath.ReturnDiffBetwMaxAndMin(OnScreenPoly, H.Y); var locPoly = EnlargePolyTowards(Dir.NE, OnScreenPoly, m.SubDivide.XSubStep, m.SubDivide.ZSubStep); farmPrev.UpdatePos(locPoly, diffY + 0.5f, corretMinimuScaleOnBigBoxP: true); ChecksCollSizeCallsColor(); }
/// <summary> /// Will let u knw if a bridge is tall enought so can be built. THi is to avoid bridge on flat terrain /// </summary> /// <returns></returns> bool IsBrideTallEnought(float minHeight) { bool res = false; if (_dominantSide == H.Vertic) { if (UMath.ReturnDiffBetwMaxAndMin(_verticPathNew, H.Y) > minHeight) { res = true; } } else if (_dominantSide == H.Horiz) { if (UMath.ReturnDiffBetwMaxAndMin(_horPathNew, H.Y) > minHeight) { res = true; } } return(res); }