You can now press whenever you want on Space Soccer

This commit is contained in:
Braedon 2022-02-01 20:11:42 -05:00
parent 919320470b
commit a7c1359f97
9 changed files with 143 additions and 42 deletions

View file

@ -0,0 +1,32 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &8070718553788868724
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3337760827311893485}
m_Layer: 0
m_Name: rhythmRally
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3337760827311893485
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8070718553788868724}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 7bec9e492a887fe45bb9d0452341ce2d
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1998,7 +1998,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 45eb7daf344474546ba5079bf18eae01, type: 3}
m_Name:
m_EditorClassIdentifier:
scrollSpeedX: 1
scrollSpeedX: 4
scrollSpeedY: -10
lengthX: 24.2
lengthY: 43.20976

Binary file not shown.

View file

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: c5b69d92c2cd27b47a1c75f093dcddc7
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View file

@ -18,9 +18,11 @@ namespace RhythmHeavenMania
public float secPerBeat;
// Current song position, in seconds
private float songPos; // for Conductor use only
public float songPosition;
// Current song position, in beats
private float songPosBeat; // for Conductor use only
public float songPositionInBeats;
// Current time of the song
@ -76,7 +78,7 @@ namespace RhythmHeavenMania
public void Play(float beat)
{
this.time = GetSongPosFromBeat(beat);
songPositionInBeats = GetSongPosFromBeat(beat) / secPerBeat;
songPosBeat = GetSongPosFromBeat(beat) / secPerBeat;
isPlaying = true;
isPaused = false;
@ -101,11 +103,13 @@ namespace RhythmHeavenMania
public void Stop(float time)
{
this.time = time;
songPositionInBeats = time / secPerBeat;
songPosBeat = 0;
songPositionInBeats = 0;
isPlaying = false;
isPaused = false;
musicSource.Stop();
}
float test;
@ -116,11 +120,13 @@ namespace RhythmHeavenMania
if (isPlaying)
{
time += Time.deltaTime * musicSource.pitch;
time += Time.unscaledDeltaTime * musicSource.pitch;
songPosition = time - firstBeatOffset;
songPos = time;
songPosition = songPos;
songPositionInBeats += ((Time.deltaTime * musicSource.pitch) - firstBeatOffset) / secPerBeat;
songPosBeat += ((Time.unscaledDeltaTime * musicSource.pitch) / secPerBeat);
songPositionInBeats = songPosBeat;
// songPositionInBeats = Time.deltaTime / secPerBeat;
if (metronome)

View file

@ -103,6 +103,8 @@ namespace RhythmHeavenMania
Beatmap = JsonConvert.DeserializeObject<Beatmap>(json);
Conductor.instance.SetBpm(Beatmap.bpm);
Stop(0);
SetCurrentEventToClosest(0);
if (Beatmap.entities.Count >= 1)
{

View file

@ -56,6 +56,8 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
kickTimes++;
aceTimes = 0;
Jukebox.PlayOneShotGame("spaceSoccer/kick");
if (highKick)
{
if (kickLeft)
@ -78,15 +80,19 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
anim.Play("KickRight", 0, 0);
}
}
if (ball == null) return;
if (highKick == false)
{
if (ball != null && hit)
ball.Kick();
}
else
{
kickPrepare = true;
}
Jukebox.PlayOneShotGame("spaceSoccer/kick");
ResetState();
}
@ -94,15 +100,6 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
{
kickTimes++;
if (hit)
{
Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe1_hit");
}
else
{
Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe1");
}
if (kickLeft)
{
anim.Play("HighKickLeft_0", 0, 0);
@ -112,21 +109,21 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
anim.Play("HighKickRight_0", 0, 0);
}
if (ball && hit)
{
Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe1_hit");
ball.HighKick();
}
else
{
Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe1");
}
ResetState();
}
public void Toe(bool hit)
{
if (hit)
{
Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe3_hit");
}
else
{
Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe3");
}
if (kickLeft)
{
anim.Play("ToeLeft", 0, 0);
@ -136,13 +133,23 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
anim.Play("ToeRight", 0, 0);
}
if (hit && ball)
{
Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe3_hit");
ball.Toe();
}
else
{
Jukebox.PlayOneShotGame("spaceSoccer/highkicktoe3");
}
kickPrepare = false;
ResetState();
}
private void Update()
{
if (kickTimes % 2 == 0)
{
kickLeft = false;
@ -193,7 +200,11 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
{
if (state.perfect)
{
KickCheck();
KickCheck(true);
}
else
{
KickCheck(false, true);
}
}
}
@ -207,7 +218,11 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
{
if (state.perfect)
{
KickCheck();
KickCheck(true);
}
else
{
KickCheck(false, true);
}
}
}
@ -228,12 +243,18 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
else
{
StateCheck(normalizedBeat);
CheckIfFall(normalizedBeat);
if (PlayerInput.AltPressedUp())
{
if (state.perfect)
{
Toe(true);
}
else
{
Toe(false);
}
}
}
}
@ -247,34 +268,45 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
{
if (state.perfect)
{
KickCheck();
KickCheck(true);
}
else
{
KickCheck(false, true);
}
}
}
}
else
{
if (PlayerInput.Pressed())
{
// Kick(false);
KickCheck(false, true);
}
}
}
private void KickCheck()
private void KickCheck(bool hit, bool overrideState = false)
{
if (canHighKick)
{
HighKick(true);
HighKick(hit);
}
else if (canKick)
{
Kick(true);
Kick(hit);
}
else if (!canKick && !canHighKick && overrideState)
{
Kick(hit);
}
}
private void CheckIfFall(float normalizedBeat)
{
if (normalizedBeat > 1.45f)
if (normalizedBeat > 1.05f)
{
Jukebox.PlayOneShotGame("spaceSoccer/missNeutral");
ball = null;
ResetState();
}