Stars background + Camera zooming *UNFINISHED*

This commit is contained in:
Starpelly
2021-12-25 20:04:23 -05:00
parent 6729eec8dc
commit 417986c08c
17 changed files with 5239 additions and 31 deletions

View File

@ -14,6 +14,14 @@ namespace RhythmHeavenMania.Games.Spaceball
public GameObject Dispenser;
public GameObject Dust;
private float lastCamDistance;
private bool zoomingCamera = false;
private float lastZoomCamBeat;
private float lastZoomCamLength;
private float lastZoomCamDistance;
public Sprite[] Balls;
public static Spaceball instance { get; set; }
public override void OnGameSwitch()
@ -21,6 +29,7 @@ namespace RhythmHeavenMania.Games.Spaceball
for (int i = 1; i < BallsHolder.transform.childCount; i++)
Destroy(BallsHolder.transform.GetChild(i).gameObject);
GameManager.instance.GameCamera.orthographic = false;
SpaceballPlayer.instance.EligibleHits.RemoveRange(0, SpaceballPlayer.instance.EligibleHits.Count);
}
private void Awake()
@ -40,15 +49,40 @@ namespace RhythmHeavenMania.Games.Spaceball
Dispenser.GetComponent<Animator>().Play("DispenserPrepare", 0, 0);
}
}
if (zoomingCamera)
{
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(lastZoomCamBeat, lastZoomCamLength);
float newPosZ = Mathf.Lerp(lastCamDistance, lastZoomCamDistance, normalizedBeat);
GameManager.instance.GameCamera.transform.localPosition = new Vector3(0, 0, newPosZ);
}
}
public void Shoot(float beat, string type)
public void CameraZoom(float beat, float length, float distance)
{
lastZoomCamBeat = beat;
lastZoomCamLength = length;
float dist = distance;
dist = dist * -1;
if (dist > 0)
lastZoomCamDistance = 0;
else
lastZoomCamDistance = dist;
zoomingCamera = true;
lastCamDistance = GameManager.instance.GameCamera.transform.localPosition.z;
}
public void Shoot(float beat, bool high, string type)
{
GameObject ball = Instantiate(Ball);
ball.transform.parent = Ball.transform.parent;
ball.SetActive(true);
ball.GetComponent<SpaceballBall>().startBeat = beat;
if (type == "high")
if (high)
{
ball.GetComponent<SpaceballBall>().high = true;
Jukebox.PlayOneShotGame("spaceball/longShoot");
@ -58,6 +92,11 @@ namespace RhythmHeavenMania.Games.Spaceball
Jukebox.PlayOneShotGame("spaceball/shoot");
}
if (type == "riceball")
{
ball.GetComponent<SpaceballBall>().Sprite.sprite = Balls[1];
}
Dispenser.GetComponent<Animator>().Play("DispenserShoot", 0, 0);
}
}