public AudioSplinePoint RemovePoint(int index) { AudioSplinePoint result = pts[index]; pts = MyArray <AudioSplinePoint> .RemoveAt(pts, index); RefreshPointNames(); return(result); }
public void AddPoint(int index, AudioSplinePoint point) { index++; pts = MyArray <AudioSplinePoint> .InsertAt(pts, index, point); if (pts[index - 1] != null && pts[index + 1] != null) { Vector3 position = Vector3.Lerp(pts[index - 1].transform.position, pts[index + 1].transform.position, 0.5f); point.transform.position = position; } RefreshPointNames(); }
public void InitialiseRandomComponent(RandomComponentPlayMode playMode) { if (playMode == RandomComponentPlayMode.Random) { InitialiseWeights(); UpdateWeights(); _shareRandomNoRepeatHistory = false; return; } _randomNoRepeatIndexes = new int[_components.Count]; for (int i = 0; i < _randomNoRepeatIndexes.Length; i++) { _randomNoRepeatIndexes[i] = i; } MyArray <int> .Shuffle(_randomNoRepeatIndexes, _randomComponents); }
private int GetNextRandomNoRepeatIndex() { int result = 0; if (_randomNoRepeatIndexes.Length > 1) { if (_randomNoRepeatIndex == -1 || _randomNoRepeatIndex >= _components.Count) { int num = _randomNoRepeatIndexes[_randomNoRepeatIndexes.Length - 1]; MyArray <int> .Shuffle(_randomNoRepeatIndexes, _randomComponents); if (num == _randomNoRepeatIndexes[0]) { int num2 = _randomNoRepeatIndexes[0]; _randomNoRepeatIndexes[0] = _randomNoRepeatIndexes[1]; _randomNoRepeatIndexes[1] = num2; } _randomNoRepeatIndex = 0; } result = _randomNoRepeatIndexes[_randomNoRepeatIndex++]; } return(result); }