mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 10:17:37 +02:00
Spaceball cleanup and small bug fix (#236)
* Spaceball cleanup and small bug fix * Replace old hit sound in spaceball
This commit is contained in:
@ -1,5 +1,3 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HeavenStudio.Games.Scripts_Spaceball
|
||||
@ -11,28 +9,32 @@ namespace HeavenStudio.Games.Scripts_Spaceball
|
||||
private float showBeat = 0;
|
||||
private bool isShowing = false;
|
||||
|
||||
const string IdleAnim = "AlienIdle";
|
||||
const string SwingAnim = "AlienSwing";
|
||||
const string ShowAnim = "AlienShow";
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
anim = GetComponent<Animator>();
|
||||
anim.Play("AlienIdle", 0, 0);
|
||||
anim.Play(IdleAnim, 0, 0);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Conductor.instance.isPlaying && !isShowing)
|
||||
{
|
||||
anim.Play("AlienSwing", 0, Conductor.instance.GetLoopPositionFromBeat(0, 1f));
|
||||
anim.Play(SwingAnim, 0, Conductor.instance.GetLoopPositionFromBeat(0, 1f));
|
||||
anim.speed = 0;
|
||||
}
|
||||
else if (!Conductor.instance.isPlaying)
|
||||
{
|
||||
anim.Play("AlienIdle", 0, 0);
|
||||
anim.Play(IdleAnim, 0, 0);
|
||||
}
|
||||
|
||||
if (isShowing)
|
||||
{
|
||||
float normalizedBeat = Conductor.instance.GetPositionFromBeat(showBeat, 1f);
|
||||
anim.Play("AlienShow", 0, normalizedBeat);
|
||||
anim.Play(ShowAnim, 0, normalizedBeat);
|
||||
anim.speed = 0;
|
||||
|
||||
if (normalizedBeat >= 2)
|
||||
|
Reference in New Issue
Block a user