mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 08:37:37 +02:00
Stars background + Camera zooming *UNFINISHED*
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user