void InitSlider() { Vector3 left_sliders_pos = new Vector3(-4f, 0, 3f); RevolvingBoxSlider rSlider = new RevolvingBoxSlider( boxSliderPrefab, SliderType_BeatSaber.LEFT_BEGIN, CutEffectPlayer.DIRECTION_NUM, 3f, SliderValueChanged ); rSlider.Move(left_sliders_pos); sliders[(int)SliderType_BeatSaber.LEFT_DOWN] = rSlider; Vector3 right_sliders_pos = new Vector3(4f, 0, 3f); rSlider = new RevolvingBoxSlider( boxSliderPrefab, SliderType_BeatSaber.RIGHT_BEGIN, CutEffectPlayer.DIRECTION_NUM, 3f, SliderValueChanged ); rSlider.Move(right_sliders_pos); sliders[(int)SliderType_BeatSaber.RIGHT_DOWN] = rSlider; /* * boxSlider = Instantiate(boxSliderPrefab, new Vector3(2f, 0, 0), Quaternion.identity); * slider = boxSlider.GetComponent<BoxSlider>(); * slider.Init(cNote.NoteRight, BoxSlider.Slider_Type.RIGHT_DOWN); * slider.ValueChanged += SliderValueChanged; * sliders[(int)BoxSlider.Slider_Type.RIGHT_DOWN] = slider; */ GameObject boxSlider = Instantiate(boxSliderPrefab, new Vector3(0, 0, 0), Quaternion.identity); BoxSlider_BeatSaber slider = boxSlider.GetComponent <BoxSlider_BeatSaber>(); slider.Init(SliderType_BeatSaber.MASTER); slider.ValueChanged += SliderValueChanged; masterSlider = slider; }
public RevolvingBoxSlider(GameObject boxSliderPrefab, SliderType_BeatSaber type, int sliderCnt = 8, float radius = 3f, EventHandler SliderValueChanged = null) { float radian = 2f * Mathf.PI / (float)sliderCnt; float angle = 360f / (float)sliderCnt; sliders = new BoxSlider_BeatSaber[sliderCnt]; for (int i = 0; i < sliderCnt; i++) { Vector3 slider_pos = new Vector3(radius * Mathf.Sin(i * radian), 0, radius * (-Mathf.Cos(i * radian))); GameObject boxSlider = GameObject.Instantiate(boxSliderPrefab, slider_pos, Quaternion.identity); BoxSlider_BeatSaber slider = boxSlider.GetComponent <BoxSlider_BeatSaber>(); slider.Init(type + i + 1); boxSlider.transform.rotation = Quaternion.Euler(0, i * 45, 0); slider.ValueChanged += SliderValueChanged; sliders[i] = slider; } }