Started work on merging the karate man events

This breaks enum dropdowns but I'll fix that tomorrow
This commit is contained in:
Carson Kompon 2022-03-01 03:17:06 -05:00
parent 25e90b0b39
commit 267d9f6bdd
4 changed files with 31 additions and 8 deletions

View File

@ -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,

View File

@ -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))

View File

@ -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<TMP_Text>().text = mg.actions[i].actionName;
g.SetActive(true);

View File

@ -49,14 +49,20 @@ namespace RhythmHeavenMania
public float defaultLength;
public bool resizable;
public List<Param> parameters;
public bool hidden;
public GameAction(string actionName, EventCallback function, float defaultLength = 1, bool resizable = false, List<Param> 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<Param> 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<GameAction>()
{
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<Param>()
{
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<GameAction>()
{