mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 08:27:40 +02:00
Rhythm Rally: Animations baybeeeeeeeeee
This commit is contained in:
@ -2,15 +2,28 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using RhythmHeavenMania.Util;
|
||||
namespace RhythmHeavenMania.Games.RhythmRally
|
||||
{
|
||||
public class RhythmRally : MonoBehaviour
|
||||
public class RhythmRally : Minigame
|
||||
{
|
||||
public Transform cameraPos;
|
||||
|
||||
public GameObject ball;
|
||||
public NaughtyBezierCurves.BezierCurve3D curve3D;
|
||||
|
||||
public Animator playerAnim;
|
||||
public Animator opponentAnim;
|
||||
|
||||
public GameEvent bop = new GameEvent();
|
||||
|
||||
public static RhythmRally instance;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
@ -18,13 +31,38 @@ namespace RhythmHeavenMania.Games.RhythmRally
|
||||
GameCamera.instance.camera.transform.rotation = cameraPos.rotation;
|
||||
GameCamera.instance.camera.fieldOfView = 41f;
|
||||
GameCamera.instance.camera.backgroundColor = Color.white;
|
||||
|
||||
playerAnim.Play("Idle", 0, 0);
|
||||
opponentAnim.Play("Idle", 0, 0);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
ball.transform.position = curve3D.GetPoint(Mathf.Clamp(Conductor.instance.GetPositionFromBeat(0, 2f), 0, 1));
|
||||
var cond = Conductor.instance;
|
||||
|
||||
ball.transform.position = curve3D.GetPoint(Mathf.Clamp(cond.GetPositionFromBeat(0, 2f), 0, 1));
|
||||
ball.transform.GetChild(0).transform.position = new Vector3(ball.transform.position.x, -0.399f, ball.transform.position.z);
|
||||
|
||||
if (cond.ReportBeat(ref bop.lastReportedBeat, bop.startBeat % 1))
|
||||
{
|
||||
if (cond.songPositionInBeats >= bop.startBeat && cond.songPositionInBeats < bop.startBeat + bop.length)
|
||||
{
|
||||
var playerState = playerAnim.GetCurrentAnimatorStateInfo(0);
|
||||
if (playerAnim.IsAnimationNotPlaying() || playerState.IsName("Idle") || playerState.IsName("Beat"))
|
||||
playerAnim.Play("Beat", 0, 0);
|
||||
|
||||
var opponentState = opponentAnim.GetCurrentAnimatorStateInfo(0);
|
||||
if (opponentAnim.IsAnimationNotPlaying() || opponentState.IsName("Idle") || opponentState.IsName("Beat"))
|
||||
opponentAnim.Play("Beat", 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Bop(float beat, float length)
|
||||
{
|
||||
bop.length = length;
|
||||
bop.startBeat = beat;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user