public override void OnInspectorGUI() { BeatLevelManager _myBeatLevelManager = (BeatLevelManager)target; DrawDefaultInspector(); List <Vector4> list = _myBeatLevelManager.beatList; if (GUILayout.Button("Add new beat")) { Debug.Log("Button pressed."); //以下为新增 list.Add(_myBeatLevelManager.Beat); int max = list.Count - 1; //Debug.Log(max); Vector3 x = new Vector3(); /* * for (int i = 0; i < max; i++) * { * if (list[max - i].y < list[max - i - 1].y) * { * x = list[max - i]; * list[max - i] = list[max - i - 1]; * list[max - i - 1] = x; * } * else * { * Debug.Log("New Beat Inserted as: Element " + (max-i)); * break; * } * * //_myBeatLevelManager.beatList = list; * } */ } if (GUILayout.Button("Delete beat")) { list.Remove(list[_myBeatLevelManager.RemoveBeatNumber]); } }
public float timeSinceRoundStarted = 0; // for the death text / scoreboard private void Awake() { timeSinceRoundStarted = 0; if (BeatLevelManager.instance == null) { instance = this; } m_BeatChannels = new List <BeatChannel>(); foreach (Organ organ in m_levelConfig.levelOrgans) { Organ tempOrgan = organ; BeatChannel channel = new BeatChannel(() => { return(tempOrgan); }); channel.lastBeatTime = Time.time - channel.beatIntervalSeconds; m_NameToBeatChannel.Add(organ.organName, channel); StartCoroutine(updateRoutine(channel)); } m_BeatChannels.AddRange(m_NameToBeatChannel.Values); }