Spaceball costumes

This commit is contained in:
Starpelly
2021-12-26 02:25:17 -05:00
parent 95ac1306d4
commit 4b3bfeda1b
12 changed files with 649 additions and 141 deletions

View File

@ -14,6 +14,17 @@ namespace RhythmHeavenMania.Games.Spaceball
public List<Minigame.Eligible> EligibleHits = new List<Minigame.Eligible>();
[SerializeField] private int currentHitInList = 0;
public int costume;
public SpriteRenderer PlayerSprite;
public List<SpriteSheet> PlayerSpriteSheets = new List<SpriteSheet>();
[System.Serializable]
public class SpriteSheet
{
public List<Sprite> sprites;
}
public static SpaceballPlayer instance { get; set; }
private void Awake()
@ -37,6 +48,12 @@ namespace RhythmHeavenMania.Games.Spaceball
}
}
public void SetCostume(int costume)
{
this.costume = costume;
anim.Play("Idle", 0, 0);
}
public void Swing()
{
bool canHit = (EligibleHits.Count > 0) && (currentHitInList < EligibleHits.Count);
@ -70,9 +87,15 @@ namespace RhythmHeavenMania.Games.Spaceball
}
else
Jukebox.PlayOneShotGame("spaceball/swing");
anim.Play("Swing", 0, 0);
}
public void SetSprite(int id)
{
PlayerSprite.sprite = PlayerSpriteSheets[costume].sprites[id];
}
private void RemoveBall()
{
if (currentHitInList < EligibleHits.Count)