mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-23 18:15:13 +00:00
Merge pull request #47 from minenice55/set-mii
Drumming Practice: ability to set each Mii Character separately
This commit is contained in:
commit
5cb45ac82e
4 changed files with 42 additions and 13 deletions
|
@ -21,6 +21,8 @@ namespace RhythmHeavenMania
|
||||||
{
|
{
|
||||||
public float beat;
|
public float beat;
|
||||||
public int track;
|
public int track;
|
||||||
|
|
||||||
|
// consideration: use arrays instead of hardcoding fixed parameter names
|
||||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float length;
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float length;
|
||||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valA;
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valA;
|
||||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valB;
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valB;
|
||||||
|
@ -28,6 +30,7 @@ namespace RhythmHeavenMania
|
||||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public bool toggle;
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public bool toggle;
|
||||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type;
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type;
|
||||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type2;
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type2;
|
||||||
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type3;
|
||||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public EasingFunction.Ease ease;
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public EasingFunction.Ease ease;
|
||||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorA;
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorA;
|
||||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorB;
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorB;
|
||||||
|
|
|
@ -23,6 +23,9 @@ namespace RhythmHeavenMania.Games.DrummingPractice
|
||||||
|
|
||||||
private bool hitting = false;
|
private bool hitting = false;
|
||||||
|
|
||||||
|
// in the future: use the MiiStudio API to render any mii from a nintendo account / MNMS / Mii Studio code?
|
||||||
|
// figure out how to call the API from unity?
|
||||||
|
// used expressions: "normal", "smile", "sorrow"
|
||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
public class MiiFace
|
public class MiiFace
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,6 +12,7 @@ namespace RhythmHeavenMania.Games.DrummingPractice
|
||||||
{
|
{
|
||||||
public enum MiiType
|
public enum MiiType
|
||||||
{
|
{
|
||||||
|
Random = -1,
|
||||||
GuestA,
|
GuestA,
|
||||||
GuestB,
|
GuestB,
|
||||||
GuestC,
|
GuestC,
|
||||||
|
@ -43,7 +44,7 @@ namespace RhythmHeavenMania.Games.DrummingPractice
|
||||||
// TODO: Move this to OnGameSwitch() when functional?
|
// TODO: Move this to OnGameSwitch() when functional?
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
SetMiis(UnityEngine.Random.Range(0, player.miiFaces.Count));
|
SetMiis();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
|
@ -96,27 +97,47 @@ namespace RhythmHeavenMania.Games.DrummingPractice
|
||||||
rightDrummer.SetFace(type);
|
rightDrummer.SetFace(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetMiis(int playerFace, bool all = false)
|
public void SetMiis(int playerFace = (int) MiiType.Random, int leftFace = (int) MiiType.Random, int rightFace = (int) MiiType.Random, bool all = false)
|
||||||
{
|
{
|
||||||
player.mii = playerFace;
|
if (playerFace == (int) MiiType.Random)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
player.mii = UnityEngine.Random.Range(0, player.miiFaces.Count);
|
||||||
|
}
|
||||||
|
while (player.mii == leftFace || player.mii == rightFace);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
player.mii = playerFace;
|
||||||
|
|
||||||
if (all)
|
if (all && playerFace != -1)
|
||||||
{
|
{
|
||||||
leftDrummer.mii = playerFace;
|
leftDrummer.mii = playerFace;
|
||||||
rightDrummer.mii = playerFace;
|
rightDrummer.mii = playerFace;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
do
|
if (leftFace == (int) MiiType.Random)
|
||||||
{
|
{
|
||||||
leftDrummer.mii = UnityEngine.Random.Range(0, leftDrummer.miiFaces.Count);
|
do
|
||||||
|
{
|
||||||
|
leftDrummer.mii = UnityEngine.Random.Range(0, player.miiFaces.Count);
|
||||||
|
}
|
||||||
|
while (leftDrummer.mii == player.mii);
|
||||||
}
|
}
|
||||||
while (leftDrummer.mii == player.mii);
|
else
|
||||||
do
|
leftDrummer.mii = leftFace;
|
||||||
|
|
||||||
|
if (rightFace == (int) MiiType.Random)
|
||||||
{
|
{
|
||||||
rightDrummer.mii = UnityEngine.Random.Range(0, rightDrummer.miiFaces.Count);
|
do
|
||||||
|
{
|
||||||
|
rightDrummer.mii = UnityEngine.Random.Range(0, player.miiFaces.Count);
|
||||||
|
}
|
||||||
|
while (rightDrummer.mii == leftDrummer.mii || rightDrummer.mii == player.mii);
|
||||||
}
|
}
|
||||||
while (rightDrummer.mii == leftDrummer.mii || rightDrummer.mii == player.mii);
|
else
|
||||||
|
rightDrummer.mii = rightFace;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetFaces(0);
|
SetFaces(0);
|
||||||
|
|
|
@ -413,10 +413,12 @@ namespace RhythmHeavenMania
|
||||||
{
|
{
|
||||||
new Param("toggle", true, "Applause", "Whether or not an applause should be played on a successful hit")
|
new Param("toggle", true, "Applause", "Whether or not an applause should be played on a successful hit")
|
||||||
}),
|
}),
|
||||||
new GameAction("set mii", delegate { var e = eventCaller.currentEntity; DrummingPractice.instance.SetMiis(e.type, e.toggle); }, 0.5f, parameters: new List<Param>()
|
new GameAction("set mii", delegate { var e = eventCaller.currentEntity; DrummingPractice.instance.SetMiis(e.type, e.type2, e.type3, e.toggle); }, 0.5f, parameters: new List<Param>()
|
||||||
{
|
{
|
||||||
new Param("type", DrummingPractice.MiiType.GuestA, "Mii", "The Mii that the player will control"),
|
new Param("type", DrummingPractice.MiiType.Random, "Player Mii", "The Mii that the player will control"),
|
||||||
new Param("toggle", false, "Set All", "Whether all Miis should be set")
|
new Param("type2", DrummingPractice.MiiType.Random, "Left Mii", "The Mii on the left"),
|
||||||
|
new Param("type3", DrummingPractice.MiiType.Random, "Right Mii", "The Mii on the right"),
|
||||||
|
new Param("toggle", false, "Set All to Player", "Sets all Miis to the Player's Mii")
|
||||||
}),
|
}),
|
||||||
|
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Reference in a new issue