/// <summary> /// Create The sequence of a bridge is 1,2,3,4,1,2,3,4,1... , 1 is the tallest part and 3 the middle one /// </summary> private List <int> CreateUnEvenSequence(int amount) { List <int> res = new List <int>(); List <int> firstHalf = new List <int>(); List <int> secondHalf = new List <int>(); //1st half int current = 3; firstHalf.Add(current); for (int i = 0; i < (amount - 1) / 2; i++) { current = UMath.GoAround(-1, current, 1, 4); firstHalf.Add(current); } firstHalf.Reverse(); //2nd half current = 4; secondHalf.Add(current); for (int i = 0; i < (amount - 2) / 2; i++) { current = UMath.GoAround(1, current, 1, 4); secondHalf.Add(current); } res.AddRange(firstHalf); res.AddRange(secondHalf); return(res); }
/// <summary> /// Moves to next stage /// </summary> private void MoveToNextStage() { _currentStage = UMath.GoAround(1, _currentStage, 0, 5); if (_currentStage == 0) { //toggle day , night ToggleDayCycle(); } _isOnTransition = true; }
/// <summary> /// A new month was reached /// </summary> void NewMonth() { var oldMonth = _month; _month = UMath.GoAround(1, _month, 1, 12); //if true a new year was reached if (CheckIfNew(oldMonth, _month)) { NewYear(); } }
private void Define4MidPointsOfCorners() { for (int i = 0; i < m.MeshController.wholeMalla.Count; i++) { var v1 = m.MeshController.wholeMalla[i]; var v2 = m.MeshController.wholeMalla[UMath.GoAround(1, i, 0, 3)]; var dist = Vector3.Distance(v1, v2) / 2; var newV = Vector3.MoveTowards(v1, v2, dist); _map8entries.Add(new VectorM(newV, _entry)); } _map8entries = _map8entries.OrderBy(a => a.Distance).ToList(); //UVisHelp.CreateHelpers(_map8entries, Root.largeBlueCube); }
private void CheckIfNewDay() { if (_accumDays > 1f) { //so the one reached is removed and make it zero so we clear all again //to avoid a bugg as years were passing the time was passing faster _accumDays = 0; var oldDay = _day; _day = UMath.GoAround(1, _day, 1, 30); //if true a new month was reached if (CheckIfNew(oldDay, _day)) { NewMonth(); } } }
private void ChangeToNextDir() { _direction = UMath.GoAround(1, _direction, 0, 3); }
/// <summary> /// Called from GUI /// </summary> public void Next() { _currentIndex = UMath.GoAround(1, _currentIndex, 0, _helps.Count - 1); Show(); }
/// <summary> /// Called from GUI /// </summary> public void Prev() { _currentIndex = UMath.GoAround(-1, _currentIndex, 0, _helps.Count - 1); Show(); }