mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 08:17:38 +02:00
Spaceball swing + low ball throw + perspective camera
This commit is contained in:
@ -8,9 +8,46 @@ namespace RhythmHeavenMania.Games.Spaceball
|
||||
{
|
||||
public class Spaceball : Minigame
|
||||
{
|
||||
private void Start()
|
||||
public GameObject Ball;
|
||||
|
||||
public GameObject Dispenser;
|
||||
public GameObject Dust;
|
||||
|
||||
public static Spaceball instance { get; set; }
|
||||
|
||||
public override void OnGameSwitch()
|
||||
{
|
||||
Debug.Log("Spaceball");
|
||||
GameManager.instance.GameCamera.orthographic = false;
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var allPlayerActions = EventCaller.GetAllPlayerEntities("spaceball");
|
||||
int currentPlayerEvent = GameManager.instance.currentPlayerEvent - EventCaller.GetAllPlayerEntitiesExceptBeforeBeat("spaceball", Conductor.instance.songPositionInBeats).Count;
|
||||
|
||||
if (currentPlayerEvent < allPlayerActions.Count)
|
||||
{
|
||||
if (Conductor.instance.songPositionInBeats > allPlayerActions[currentPlayerEvent].beat - 1)
|
||||
{
|
||||
Dispenser.GetComponent<Animator>().Play("DispenserPrepare", 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Shoot(float beat)
|
||||
{
|
||||
Jukebox.PlayOneShotGame("spaceball/shoot");
|
||||
GameObject ball = Instantiate(Ball);
|
||||
ball.transform.parent = Ball.transform.parent;
|
||||
ball.SetActive(true);
|
||||
ball.GetComponent<SpaceballBall>().startBeat = beat;
|
||||
|
||||
Dispenser.GetComponent<Animator>().Play("DispenserShoot", 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user