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

@ -16,7 +16,7 @@ namespace RhythmHeavenMania
public int track;
public float length;
public float valA;
public string type;
public int type;
public string datamodel;
public object Clone()

View File

@ -19,7 +19,7 @@ namespace RhythmHeavenMania
private float currentLength;
private float currentValA;
private string currentSwitchGame;
private string currentType;
private int currentType;
public delegate void EventCallback();
@ -90,6 +90,7 @@ namespace RhythmHeavenMania
{
new GameAction("shoot", delegate { Spaceball.instance.Shoot(currentBeat, false, currentType); }, true ),
new GameAction("shootHigh", delegate { Spaceball.instance.Shoot(currentBeat, true, currentType); }, true ),
new GameAction("costume", delegate { Spaceball.instance.Costume(currentType); }, true ),
// new GameAction("cameraZoom", delegate { Spaceball.instance.CameraZoom(currentBeat, currentLength, currentValA); } ),
})
};

View File

@ -106,8 +106,6 @@ namespace RhythmHeavenMania.Games.Spaceball
float dist = allCameraEvents[currentZoomIndex].valA * -1;
print(dist);
if (dist > 0)
currentZoomCamDistance = 0;
else
@ -115,12 +113,13 @@ namespace RhythmHeavenMania.Games.Spaceball
}
}
public void Shoot(float beat, bool high, string type)
public void Shoot(float beat, bool high, int type)
{
GameObject ball = Instantiate(Ball);
ball.transform.parent = Ball.transform.parent;
ball.SetActive(true);
ball.GetComponent<SpaceballBall>().startBeat = beat;
if (high)
{
ball.GetComponent<SpaceballBall>().high = true;
@ -131,12 +130,17 @@ namespace RhythmHeavenMania.Games.Spaceball
Jukebox.PlayOneShotGame("spaceball/shoot");
}
if (type == "riceball")
if (type == 1)
{
ball.GetComponent<SpaceballBall>().Sprite.sprite = Balls[1];
}
Dispenser.GetComponent<Animator>().Play("DispenserShoot", 0, 0);
}
public void Costume(int type)
{
SpaceballPlayer.instance.SetCostume(type);
}
}
}

View File

@ -35,9 +35,11 @@ namespace RhythmHeavenMania.Games.Spaceball
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(startBeat, beatLength + 0.2f);
if (high)
anim.Play("BallHigh", -1, normalizedBeatAnim);
anim.Play("BallHigh", 0, normalizedBeatAnim);
else
anim.Play("BallLow", -1, normalizedBeatAnim);
anim.Play("BallLow", 0, normalizedBeatAnim);
anim.speed = 0;
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(startBeat, beatLength);

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)