diff --git a/Assets/Scripts/Games/KarateMan/KarateMan.cs b/Assets/Scripts/Games/KarateMan/KarateMan.cs index 31891d6c..cf94d1d9 100644 --- a/Assets/Scripts/Games/KarateMan/KarateMan.cs +++ b/Assets/Scripts/Games/KarateMan/KarateMan.cs @@ -8,6 +8,15 @@ namespace RhythmHeavenMania.Games.KarateMan { public class KarateMan : Minigame { + + public enum HitType + { + Pot = 0, + Rock = 2, + Ball = 3, + TacoBell = 6 + } + public enum LightBulbType { Normal, diff --git a/Assets/Scripts/LevelEditor/EventSelector/EventPropertyPrefab.cs b/Assets/Scripts/LevelEditor/EventSelector/EventPropertyPrefab.cs index ce4fc5ff..3f3c31a7 100644 --- a/Assets/Scripts/LevelEditor/EventSelector/EventPropertyPrefab.cs +++ b/Assets/Scripts/LevelEditor/EventSelector/EventPropertyPrefab.cs @@ -99,11 +99,11 @@ namespace RhythmHeavenMania.Editor dropDownData.Add(optionData); } dropdown.AddOptions(dropDownData); - dropdown.value = ((int)Enum.Parse(objType, parameterManager.entity[propertyName].ToString())); + dropdown.value = Array.IndexOf(Enum.GetValues(objType), Enum.GetValues(objType).GetValue((int)parameterManager.entity[propertyName])); dropdown.onValueChanged.AddListener(delegate { - parameterManager.entity[propertyName] = Enum.ToObject(objType, dropdown.value); + parameterManager.entity[propertyName] = (int)Enum.GetValues(objType).GetValue(dropdown.value); }); } else if (objType == typeof(Color)) diff --git a/Assets/Scripts/LevelEditor/EventSelector/GridGameSelector.cs b/Assets/Scripts/LevelEditor/EventSelector/GridGameSelector.cs index 7f57ac61..0138c515 100644 --- a/Assets/Scripts/LevelEditor/EventSelector/GridGameSelector.cs +++ b/Assets/Scripts/LevelEditor/EventSelector/GridGameSelector.cs @@ -120,7 +120,7 @@ namespace RhythmHeavenMania.Editor for (int i = 0; i < mg.actions.Count; i++) { - if (mg.actions[i].actionName == "switchGame") continue; + if (mg.actions[i].actionName == "switchGame" || mg.actions[i].hidden) continue; GameObject g = Instantiate(EventRef, eventsParent); g.GetComponent().text = mg.actions[i].actionName; g.SetActive(true); diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index 72e0798a..c50dbef0 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -49,14 +49,20 @@ namespace RhythmHeavenMania public float defaultLength; public bool resizable; public List parameters; + public bool hidden; - public GameAction(string actionName, EventCallback function, float defaultLength = 1, bool resizable = false, List parameters = null) + /* If you want to add additional arguments to GameAction, leave `bool hidden = false` as the last parameter + * You can specify an action as hidden by adding `hidden: value` as the final parameter in your call + * (Even if you haven't used all prior arguments) + */ + public GameAction(string actionName, EventCallback function, float defaultLength = 1, bool resizable = false, List parameters = null, bool hidden = false) { this.actionName = actionName; this.function = function; this.defaultLength = defaultLength; this.resizable = resizable; this.parameters = parameters; + this.hidden = hidden; } } @@ -235,7 +241,13 @@ namespace RhythmHeavenMania new Minigame("karateman", "Karate Man", "70A8D8", false, false, new List() { new GameAction("bop", delegate { KarateMan.instance.Bop(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 0.5f, true), - new GameAction("pot", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 0); }, 2), + new GameAction("hit", delegate + { + KarateMan.instance.Shoot(eventCaller.currentEntity.beat, eventCaller.currentEntity.type); + }, 2, false, new List() + { + new Param("type", KarateMan.HitType.Pot, "Object") + }), new GameAction("bulb", delegate { var e = eventCaller.currentEntity; var c = KarateMan.instance.LightBulbColors[e.type]; @@ -246,8 +258,6 @@ namespace RhythmHeavenMania new Param("type", KarateMan.LightBulbType.Normal, "Type"), new Param("colorA", new Color(), "Custom Color") }), - new GameAction("rock", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 2); }, 2), - new GameAction("ball", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 3); }, 2), new GameAction("kick", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 4); }, 4.5f), new GameAction("combo", delegate { KarateMan.instance.Combo(eventCaller.currentEntity.beat); }, 4f), new GameAction("hit3", delegate { KarateMan.instance.Hit3(eventCaller.currentEntity.beat); }), @@ -267,7 +277,11 @@ namespace RhythmHeavenMania new Param("colorA", new Color(), "Custom Background Color"), new Param("colorB", new Color(), "Custom Shadow Color") }), - new GameAction("tacobell", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 6); }, 2), + // These are still here for backwards-compatibility but are hidden in the editor + new GameAction("pot", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 0); }, 2, hidden: true), + new GameAction("rock", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 2); }, 2, hidden: true), + new GameAction("ball", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 3); }, 2, hidden: true), + new GameAction("tacobell", delegate { KarateMan.instance.Shoot(eventCaller.currentEntity.beat, 6); }, 2, hidden: true), }), new Minigame("spaceSoccer", "Space Soccer", "B888F8", false, false, new List() {