Merge pull request #26 from CarsonKompon/clappy-trio-variable-lions

Added "Change Lion Count" event to Clappy Trio
This commit is contained in:
Jenny Crowe 2022-02-28 18:14:17 -07:00 committed by GitHub
commit 23ad747483
2 changed files with 31 additions and 23 deletions

View file

@ -32,32 +32,26 @@ namespace RhythmHeavenMania.Games.ClappyTrio
private void Start() private void Start()
{ {
float maxWidth = 9.2f; float startPos = -3.066667f;
float minus = 0; float maxWidth = 12.266668f;
float newSpacing = maxWidth / lionCount; for (int i = 0; i < lionCount; i++)
if (lionCount > 3)
{ {
Lion[0].transform.localPosition = new Vector3(-1.5f, 0); GameObject lion;
maxWidth = 6.2f; if (i == 0)
minus = 1.5f; lion = Lion[0];
} else
lion = Instantiate(Lion[0], Lion[0].transform.parent);
for (int i = 1; i < lionCount; i++) lion.transform.localPosition = new Vector3(startPos + ((maxWidth / (lionCount + 1)) * (i + 1)), 0);
{
GameObject lion = Instantiate(Lion[0], Lion[0].transform.parent);
// lion.transform.localPosition = new Vector3(Lion[0].transform.localPosition.x + (1.0333f * lionCount) - i, 0); if (i > 0)
lion.transform.localPosition = new Vector3((newSpacing) * (i) - minus, 0);
Lion.Add(lion); Lion.Add(lion);
if (i == lionCount - 1) if (i == lionCount - 1)
{
ClappyTrioPlayer = lion.AddComponent<ClappyTrioPlayer>(); ClappyTrioPlayer = lion.AddComponent<ClappyTrioPlayer>();
} }
} }
}
private void Update() private void Update()
{ {
@ -86,8 +80,7 @@ namespace RhythmHeavenMania.Games.ClappyTrio
isClapping = false; isClapping = false;
currentClappingLength = 0; currentClappingLength = 0;
ClappyTrioPlayer.clapStarted = false; ClappyTrioPlayer.clapStarted = false;
} } else
else
{ {
SetFace(i, 4); SetFace(i, 4);
Lion[i].GetComponent<Animator>().Play("Clap", 0, 0); Lion[i].GetComponent<Animator>().Play("Clap", 0, 0);
@ -135,8 +128,7 @@ namespace RhythmHeavenMania.Games.ClappyTrio
{ {
SetFace(i, 1); SetFace(i, 1);
} }
} } else
else
{ {
var a = EventCaller.GetAllInGameManagerList("clappyTrio", new string[] { "clap" }); var a = EventCaller.GetAllInGameManagerList("clappyTrio", new string[] { "clap" });
var b = a.FindAll(c => c.beat < beat); var b = a.FindAll(c => c.beat < beat);
@ -148,8 +140,7 @@ namespace RhythmHeavenMania.Games.ClappyTrio
if (i == Lion.Count - 1) if (i == Lion.Count - 1)
{ {
SetFace(i, 0); SetFace(i, 0);
} } else
else
{ {
SetFace(i, 2); SetFace(i, 2);
} }
@ -159,6 +150,19 @@ namespace RhythmHeavenMania.Games.ClappyTrio
PlayAnimationAll("Bop"); PlayAnimationAll("Bop");
} }
public void ChangeLionCount(int lions)
{
for(int i=1; i<lionCount; i++)
{
Destroy(Lion[i]);
}
Lion.RemoveRange(1, lionCount - 1);
lionCount = lions;
SetFace(0, 0);
Start();
PlayAnimationAll("Idle");
}
private void PlayAnimationAll(string anim) private void PlayAnimationAll(string anim)
{ {
for (int i = 0; i < Lion.Count; i++) for (int i = 0; i < Lion.Count; i++)

View file

@ -211,6 +211,10 @@ namespace RhythmHeavenMania
new GameAction("bop", delegate { ClappyTrio.instance.Bop(eventCaller.currentEntity.beat); } ), new GameAction("bop", delegate { ClappyTrio.instance.Bop(eventCaller.currentEntity.beat); } ),
new GameAction("prepare", delegate { ClappyTrio.instance.Prepare(0); } ), new GameAction("prepare", delegate { ClappyTrio.instance.Prepare(0); } ),
new GameAction("prepare_alt", delegate { ClappyTrio.instance.Prepare(3); } ), new GameAction("prepare_alt", delegate { ClappyTrio.instance.Prepare(3); } ),
new GameAction("change lion count", delegate { ClappyTrio.instance.ChangeLionCount((int)eventCaller.currentEntity.valA); }, 0.5f, false, new List<Param>()
{
new Param("valA", new EntityTypes.Integer(1, 8, 3), "Lion Count")
}),
}), }),
new Minigame("spaceball", "Spaceball", "00A518", false, false, new List<GameAction>() new Minigame("spaceball", "Spaceball", "00A518", false, false, new List<GameAction>()
{ {