Highball added to Spaceball + event types added.

This commit is contained in:
Starpelly
2021-12-25 08:32:52 -05:00
parent 866c8c80be
commit 6729eec8dc
12 changed files with 854 additions and 41 deletions

View File

@ -25,7 +25,7 @@ namespace RhythmHeavenMania
private void Update()
{
Vector3 pos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Vector3 pos = GameManager.instance.CursorCam.ScreenToWorldPoint(Input.mousePosition);
if (follow)
{

View File

@ -16,10 +16,11 @@ namespace RhythmHeavenMania
private TMP_Text BPM;
private TMP_Text currEvent;
private TMP_Text eventLength;
private TMP_Text eventType;
private void Start()
{
for (int i = 0; i < 4; i++)
for (int i = 0; i < 5; i++)
{
GameObject debug = Instantiate(Template, Template.transform.parent);
debug.SetActive(true);
@ -39,6 +40,9 @@ namespace RhythmHeavenMania
case 3:
eventLength = debug.transform.GetChild(0).GetComponent<TMP_Text>();
break;
case 4:
eventType = debug.transform.GetChild(0).GetComponent<TMP_Text>();
break;
}
}
}
@ -52,11 +56,13 @@ namespace RhythmHeavenMania
{
currEvent.text = $"CurrentEvent: {GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent - 1].datamodel}";
eventLength.text = $"Event Length: {GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent - 1].length}";
}
eventType.text = $"Event Type: {GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent - 1].type}";
}
else
{
currEvent.text = $"CurrentEvent: {GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent].datamodel}";
eventLength.text = $"Event Length: {GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent].length}";
eventType.text = $"Event Type: {GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent].type}";
}
}
}

View File

@ -85,7 +85,7 @@ namespace RhythmHeavenMania
}),
new MiniGame("spaceball", new List<GameAction>()
{
new GameAction("shoot", delegate { Spaceball.instance.Shoot(currentBeat); }, true )
new GameAction("shoot", delegate { Spaceball.instance.Shoot(currentBeat, currentType); }, true )
})
};
@ -125,6 +125,7 @@ namespace RhythmHeavenMania
try
{
currentLength = GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent].length;
currentType = GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent].type;
if (details.Length > 2) currentSwitchGame = details[2];

View File

@ -24,7 +24,7 @@ namespace RhythmHeavenMania
public float startOffset;
public Camera GameCamera;
public Camera GameCamera, CursorCam;
[Header("Games")]
Coroutine currentGameSwitchIE;

View File

@ -9,6 +9,7 @@ namespace RhythmHeavenMania.Games.Spaceball
public class Spaceball : Minigame
{
public GameObject Ball;
public GameObject BallsHolder;
public GameObject Dispenser;
public GameObject Dust;
@ -17,6 +18,8 @@ namespace RhythmHeavenMania.Games.Spaceball
public override void OnGameSwitch()
{
for (int i = 1; i < BallsHolder.transform.childCount; i++)
Destroy(BallsHolder.transform.GetChild(i).gameObject);
GameManager.instance.GameCamera.orthographic = false;
}
@ -39,13 +42,21 @@ namespace RhythmHeavenMania.Games.Spaceball
}
}
public void Shoot(float beat)
public void Shoot(float beat, string type)
{
Jukebox.PlayOneShotGame("spaceball/shoot");
GameObject ball = Instantiate(Ball);
ball.transform.parent = Ball.transform.parent;
ball.SetActive(true);
ball.GetComponent<SpaceballBall>().startBeat = beat;
if (type == "high")
{
ball.GetComponent<SpaceballBall>().high = true;
Jukebox.PlayOneShotGame("spaceball/longShoot");
}
else
{
Jukebox.PlayOneShotGame("spaceball/shoot");
}
Dispenser.GetComponent<Animator>().Play("DispenserShoot", 0, 0);
}

View File

@ -13,6 +13,8 @@ namespace RhythmHeavenMania.Games.Spaceball
private int lastState;
private bool inList = false;
public bool high;
private Minigame.Eligible e = new Minigame.Eligible();
public GameObject Holder;
@ -26,10 +28,17 @@ namespace RhythmHeavenMania.Games.Spaceball
private void Update()
{
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(startBeat, 1.25f);
anim.Play("BallLow", -1, normalizedBeatAnim);
float beatLength = 1f;
if (high) beatLength = 2f;
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(startBeat, 1f);
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(startBeat, beatLength + 0.25f);
if (high)
anim.Play("BallHigh", -1, normalizedBeatAnim);
else
anim.Play("BallLow", -1, normalizedBeatAnim);
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(startBeat, beatLength);
if (normalizedBeat > Minigame.EarlyTime() && normalizedBeat < Minigame.PerfectTime() && lastState == 0)
{
@ -53,9 +62,12 @@ namespace RhythmHeavenMania.Games.Spaceball
MakeInEligible();
}
if (normalizedBeat > 1.25f && lastState == 3)
// too lazy to make a proper fix for this
float endTime = 1.25f;
if (high) endTime = 1.15f;
if (normalizedBeat > endTime)
{
lastState++;
Jukebox.PlayOneShotGame("spaceball/fall");
Instantiate(Spaceball.instance.Dust, Spaceball.instance.Dust.transform.parent).SetActive(true);
Destroy(this.gameObject);