Spaceball pretty much finalized.

This commit is contained in:
Starpelly
2021-12-28 02:38:55 -05:00
parent 75965927d6
commit c653d487ac
24 changed files with 2225 additions and 285 deletions

View File

@ -104,12 +104,21 @@ namespace RhythmHeavenMania
mst_f = mst_f + (Time.deltaTime * framesSinceLastSame) * musicSource.pitch;
if (mst_f < lastMst_F)
if (mst_f <= lastMst_F)
{
mst_f = lastMst_F;
// mst_f = lastMst_F;
float b = lastMst_F + (Time.deltaTime) * musicSource.pitch;
mst_f = b;
// print(b);
// print(mst_f + " " + b + " " + lastMst_F);
}
else if (mst_f < lastTime)
{
Debug.LogError("What the fuck.");
}
print($"{lastMst_F}, {mst_f}");
// print($"{lastMst_F}, {mst_f}");
}
else
{
@ -124,7 +133,7 @@ namespace RhythmHeavenMania
//determine how many beats since the song started
songPositionInBeats = songPosition / secPerBeat;
// print($"{musicSource.time}(AudioSource.time), {Time.frameCount}(Time.fasrameCount)");
// print($"{mst_f}(AudioSource.time), {Time.frameCount}(Time.fasrameCount)");
// print($"{musicSource.time}(0), {mst_f}");

View File

@ -91,6 +91,7 @@ namespace RhythmHeavenMania
new GameAction("shoot", delegate { Spaceball.instance.Shoot(currentBeat, false, currentType); }, true ),
new GameAction("shootHigh", delegate { Spaceball.instance.Shoot(currentBeat, true, currentType); }, true ),
new GameAction("costume", delegate { Spaceball.instance.Costume(currentType); }, true ),
new GameAction("alien", delegate { Spaceball.instance.alien.Show(currentBeat); }, true ),
// new GameAction("cameraZoom", delegate { Spaceball.instance.CameraZoom(currentBeat, currentLength, currentValA); } ),
})
};

View File

@ -0,0 +1,51 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace RhythmHeavenMania.Games.Spaceball
{
public class Alien : MonoBehaviour
{
private Animator anim;
private float showBeat = 0;
private bool isShowing = false;
private void Start()
{
anim = GetComponent<Animator>();
anim.Play("AlienIdle", 0, 0);
}
private void Update()
{
if (Conductor.instance.musicSource.isPlaying && !isShowing)
{
anim.Play("AlienSwing", 0, Conductor.instance.loopPositionInAnalog * 2);
anim.speed = 0;
}
else if (!Conductor.instance.musicSource.isPlaying)
{
anim.Play("AlienIdle", 0, 0);
}
if (isShowing)
{
float normalizedBeat = Conductor.instance.GetLoopPositionFromBeat(showBeat, 1f);
anim.Play("AlienShow", 0, normalizedBeat);
anim.speed = 0;
if (normalizedBeat >= 2)
{
isShowing = false;
}
}
}
public void Show(float showBeat)
{
isShowing = true;
this.showBeat = showBeat;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fdd5be636e18a974c94d01c287c07dd7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -25,6 +25,8 @@ namespace RhythmHeavenMania.Games.Spaceball
private List<Beatmap.Entity> allCameraEvents = new List<Beatmap.Entity>();
public Alien alien;
public static Spaceball instance { get; set; }
public override void OnGameSwitch()

View File

@ -25,6 +25,9 @@ namespace RhythmHeavenMania.Games.Spaceball
anim = GetComponent<Animator>();
e.gameObject = this.gameObject;
float rot = Random.Range(0, 360);
Sprite.gameObject.transform.eulerAngles = new Vector3(0, 0, rot);
}
private void Update()
@ -80,10 +83,6 @@ namespace RhythmHeavenMania.Games.Spaceball
Instantiate(Spaceball.instance.Dust, Spaceball.instance.Dust.transform.parent).SetActive(true);
Destroy(this.gameObject);
}
else if (Conductor.instance.songPositionInBeats < startBeat)
{
Destroy(this.gameObject);
}
}
public void MakeEligible(bool early, bool perfect, bool late)

View File

@ -57,12 +57,14 @@ namespace RhythmHeavenMania.Games.Spaceball
public void Swing()
{
bool canHit = (EligibleHits.Count > 0) && (currentHitInList < EligibleHits.Count);
if (canHit)
{
if (EligibleHits[currentHitInList].perfect)
{
Jukebox.PlayOneShotGame("spaceball/hit");
EligibleHits[currentHitInList].gameObject.GetComponent<SpaceballBall>().Holder.transform.DOLocalMove(new Vector3(Random.Range(0, 8), 0, -600), 5f);
EligibleHits[currentHitInList].gameObject.GetComponent<SpaceballBall>().Holder.transform.DOLocalMove(new Vector3(Random.Range(0, 25), 0, -600), 7f).SetEase(Ease.Linear);
EligibleHits[currentHitInList].gameObject.GetComponent<SpaceballBall>().Holder.transform.GetChild(0).gameObject.AddComponent<Rotate>().rotateSpeed = -95;
EligibleHits[currentHitInList].gameObject.GetComponent<SpaceballBall>().enabled = false;
EligibleHits[currentHitInList].gameObject.GetComponent<Animator>().enabled = false;