mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 13:47:38 +02:00
Stars background + Camera zooming *UNFINISHED*
This commit is contained in:
@ -15,6 +15,7 @@ namespace RhythmHeavenMania
|
||||
public float beat;
|
||||
public int track;
|
||||
public float length;
|
||||
public float valA;
|
||||
public string type;
|
||||
public string datamodel;
|
||||
|
||||
|
@ -14,7 +14,7 @@ namespace RhythmHeavenMania
|
||||
[Header("DSGuy")]
|
||||
[SerializeField] private GameObject Eyes;
|
||||
[SerializeField] private GameObject OuterCircle;
|
||||
[SerializeField] private GameObject InnerCircle;
|
||||
public GameObject InnerCircle;
|
||||
[SerializeField] private GameObject Circle;
|
||||
private Tween outerCircleTween, eyesTween;
|
||||
|
||||
|
@ -17,6 +17,7 @@ namespace RhythmHeavenMania
|
||||
public Transform GamesHolder;
|
||||
private float currentBeat;
|
||||
private float currentLength;
|
||||
private float currentValA;
|
||||
private string currentSwitchGame;
|
||||
private string currentType;
|
||||
|
||||
@ -30,12 +31,14 @@ namespace RhythmHeavenMania
|
||||
public class MiniGame
|
||||
{
|
||||
public string name;
|
||||
public string color;
|
||||
public GameObject holder;
|
||||
public List<GameAction> actions = new List<GameAction>();
|
||||
|
||||
public MiniGame(string name, List<GameAction> actions)
|
||||
public MiniGame(string name, string color, List<GameAction> actions)
|
||||
{
|
||||
this.name = name;
|
||||
this.color = color;
|
||||
this.actions = actions;
|
||||
}
|
||||
}
|
||||
@ -58,12 +61,12 @@ namespace RhythmHeavenMania
|
||||
{
|
||||
minigames = new List<MiniGame>()
|
||||
{
|
||||
new MiniGame("gameManager", new List<GameAction>()
|
||||
new MiniGame("gameManager", "", new List<GameAction>()
|
||||
{
|
||||
new GameAction("end", delegate { Debug.Log("end"); }),
|
||||
new GameAction("switchGame", delegate { GameManager.instance.SwitchGame(currentSwitchGame); })
|
||||
}),
|
||||
new MiniGame("forkLifter", new List<GameAction>()
|
||||
new MiniGame("forkLifter", "FFFFFF", new List<GameAction>()
|
||||
{
|
||||
new GameAction("pea", delegate { ForkLifter.instance.Flick(currentBeat, 0); }, true ),
|
||||
new GameAction("topbun", delegate { ForkLifter.instance.Flick(currentBeat, 1); }, true ),
|
||||
@ -73,7 +76,7 @@ namespace RhythmHeavenMania
|
||||
new GameAction("gulp", delegate { ForkLifterPlayer.instance.Eat(); }),
|
||||
new GameAction("sigh", delegate { Jukebox.PlayOneShot("sigh"); })
|
||||
}),
|
||||
new MiniGame("clappyTrio", new List<GameAction>()
|
||||
new MiniGame("clappyTrio", "29E7FF", new List<GameAction>()
|
||||
{
|
||||
// Claps
|
||||
new GameAction("clap", delegate { ClappyTrio.instance.Clap(currentBeat, currentLength); }, true ),
|
||||
@ -83,9 +86,11 @@ namespace RhythmHeavenMania
|
||||
new GameAction("prepare", delegate { ClappyTrio.instance.Prepare(0); } ),
|
||||
new GameAction("prepare_alt", delegate { ClappyTrio.instance.Prepare(3); } ),
|
||||
}),
|
||||
new MiniGame("spaceball", new List<GameAction>()
|
||||
new MiniGame("spaceball", "00A518", new List<GameAction>()
|
||||
{
|
||||
new GameAction("shoot", delegate { Spaceball.instance.Shoot(currentBeat, currentType); }, true )
|
||||
new GameAction("shoot", delegate { Spaceball.instance.Shoot(currentBeat, false, currentType); }, true ),
|
||||
new GameAction("shootHigh", delegate { Spaceball.instance.Shoot(currentBeat, true, currentType); }, true ),
|
||||
new GameAction("cameraZoom", delegate { Spaceball.instance.CameraZoom(currentBeat, currentLength, currentValA); } ),
|
||||
})
|
||||
};
|
||||
|
||||
@ -126,6 +131,7 @@ namespace RhythmHeavenMania
|
||||
{
|
||||
currentLength = GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent].length;
|
||||
currentType = GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent].type;
|
||||
currentValA = GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent].valA;
|
||||
|
||||
if (details.Length > 2) currentSwitchGame = details[2];
|
||||
|
||||
|
@ -25,10 +25,11 @@ namespace RhythmHeavenMania
|
||||
public float startOffset;
|
||||
|
||||
public Camera GameCamera, CursorCam;
|
||||
public CircleCursor CircleCursor;
|
||||
|
||||
[Header("Games")]
|
||||
Coroutine currentGameSwitchIE;
|
||||
private string currentGame;
|
||||
public string currentGame;
|
||||
|
||||
|
||||
private void Awake()
|
||||
@ -53,7 +54,7 @@ namespace RhythmHeavenMania
|
||||
|
||||
StartCoroutine(Begin());
|
||||
|
||||
currentGame = eventCaller.GamesHolder.GetComponentsInChildren<Transform>()[1].name;
|
||||
SetCurrentGame(eventCaller.GamesHolder.transform.GetComponentsInChildren<Transform>()[1].name);
|
||||
}
|
||||
|
||||
private IEnumerator Begin()
|
||||
@ -116,21 +117,37 @@ namespace RhythmHeavenMania
|
||||
{
|
||||
this.GetComponent<SpriteRenderer>().enabled = true;
|
||||
|
||||
eventCaller.minigames.Find(c => c.name == currentGame).holder.SetActive(false);
|
||||
eventCaller.minigames.Find(c => c.name == game).holder.SetActive(true);
|
||||
GetGame(currentGame).holder.GetComponent<Minigame>().OnGameSwitch();
|
||||
|
||||
GetGame(currentGame).holder.SetActive(false);
|
||||
GetGame(game).holder.SetActive(true);
|
||||
|
||||
GameCamera.orthographic = true;
|
||||
eventCaller.minigames.Find(c => c.name == game).holder.GetComponent<Minigame>().OnGameSwitch();
|
||||
currentGame = game;
|
||||
|
||||
GetGame(game).holder.GetComponent<Minigame>().OnGameSwitch();
|
||||
|
||||
SetCurrentGame(game);
|
||||
|
||||
yield return new WaitForSeconds(0.1666f);
|
||||
|
||||
|
||||
this.GetComponent<SpriteRenderer>().enabled = false;
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
public EventCaller.MiniGame GetGame(string name)
|
||||
{
|
||||
// GUI.Box(new Rect(0, 0, 300, 50), $"SongPosInBeats: {Conductor.instance.songPositionInBeats}");
|
||||
return eventCaller.minigames.Find(c => c.name == name);
|
||||
}
|
||||
|
||||
// never gonna use this
|
||||
public EventCaller.MiniGame GetCurrentGame()
|
||||
{
|
||||
return eventCaller.minigames.Find(c => c.name == transform.GetComponentsInChildren<Transform>()[1].name);
|
||||
}
|
||||
|
||||
public void SetCurrentGame(string game)
|
||||
{
|
||||
currentGame = game;
|
||||
CircleCursor.InnerCircle.GetComponent<SpriteRenderer>().color = Colors.Hex2RGB(GetGame(currentGame).color);
|
||||
}
|
||||
}
|
||||
}
|
@ -37,6 +37,7 @@ namespace RhythmHeavenMania.Games.ForkLifter
|
||||
{
|
||||
ForkLifterHand.CheckNextFlick();
|
||||
ForkLifterPlayer.instance.RemoveObjFromFork();
|
||||
ForkLifterHand.GetComponent<Animator>().Play("Hand_Idle", 0, 0);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
|
@ -50,7 +50,7 @@ namespace RhythmHeavenMania.Games.ForkLifter
|
||||
public void Prepare()
|
||||
{
|
||||
Jukebox.PlayOneShotGame("forkLifter/flickPrepare");
|
||||
GetComponent<Animator>().Play("Hand_Prepare");
|
||||
GetComponent<Animator>().Play("Hand_Prepare", 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ namespace RhythmHeavenMania.Games.Spaceball
|
||||
private Minigame.Eligible e = new Minigame.Eligible();
|
||||
|
||||
public GameObject Holder;
|
||||
public SpriteRenderer Sprite;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
@ -31,7 +32,7 @@ namespace RhythmHeavenMania.Games.Spaceball
|
||||
float beatLength = 1f;
|
||||
if (high) beatLength = 2f;
|
||||
|
||||
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(startBeat, beatLength + 0.25f);
|
||||
float normalizedBeatAnim = Conductor.instance.GetLoopPositionFromBeat(startBeat, beatLength + 0.2f);
|
||||
|
||||
if (high)
|
||||
anim.Play("BallHigh", -1, normalizedBeatAnim);
|
||||
@ -63,8 +64,8 @@ namespace RhythmHeavenMania.Games.Spaceball
|
||||
}
|
||||
|
||||
// too lazy to make a proper fix for this
|
||||
float endTime = 1.25f;
|
||||
if (high) endTime = 1.15f;
|
||||
float endTime = 1.2f;
|
||||
if (high) endTime = 1.1f;
|
||||
|
||||
if (normalizedBeat > endTime)
|
||||
{
|
||||
|
@ -51,7 +51,8 @@ namespace RhythmHeavenMania.Util
|
||||
|
||||
public static void PlayOneShotGame(string name)
|
||||
{
|
||||
PlayOneShot($"games/{name}");
|
||||
if (GameManager.instance.currentGame == name.Split('/')[0])
|
||||
PlayOneShot($"games/{name}");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user