Fully functional and animated Mr. Upbeat

This commit is contained in:
Carson Kompon 2022-03-06 14:37:50 -05:00
parent d5b800bb5b
commit b389cd7589
10 changed files with 504 additions and 79 deletions

View File

@ -646,6 +646,62 @@ SpriteRenderer:
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
m_MaskInteraction: 0 m_MaskInteraction: 0
m_SpriteSortPoint: 0 m_SpriteSortPoint: 0
--- !u!1 &5666021292044047195
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7622419266367956722}
- component: {fileID: 4157362534770189002}
m_Layer: 0
m_Name: Beat
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &7622419266367956722
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5666021292044047195}
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: 8301537147055126447}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &4157362534770189002
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5666021292044047195}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 671722aab5d7ff34da139a076534caf4, type: 3}
m_Name:
m_EditorClassIdentifier:
inList: 0
lastState: 0
state:
gameObject: {fileID: 0}
early: 0
perfect: 0
late: 0
createBeat: 0
eligibleHitsList: []
aceTimes: 0
isEligible: 0
triggersAutoplay: 1
startBeat: 0
--- !u!1 &6060117916978306099 --- !u!1 &6060117916978306099
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -761,6 +817,7 @@ Transform:
- {fileID: 3332517713256108722} - {fileID: 3332517713256108722}
- {fileID: 5608637247423934025} - {fileID: 5608637247423934025}
- {fileID: 8709428748473264351} - {fileID: 8709428748473264351}
- {fileID: 2744998194819868968}
m_Father: {fileID: 1584121333826078951} m_Father: {fileID: 1584121333826078951}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -929,6 +986,7 @@ Transform:
- {fileID: 8701843541313247389} - {fileID: 8701843541313247389}
- {fileID: 7821851253613277009} - {fileID: 7821851253613277009}
- {fileID: 862280508089709600} - {fileID: 862280508089709600}
- {fileID: 8301537147055126447}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -948,6 +1006,7 @@ MonoBehaviour:
firstEnable: 0 firstEnable: 0
metronome: {fileID: 3862020474253857803} metronome: {fileID: 3862020474253857803}
man: {fileID: 8160414645038680372} man: {fileID: 8160414645038680372}
bt: {fileID: 5666021292044047195}
canGo: 0 canGo: 0
beatCount: 0 beatCount: 0
--- !u!1 &8412912829583803381 --- !u!1 &8412912829583803381
@ -1078,18 +1137,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: e4fa18aec69a2e949a7e2d4e33bdd2b9, type: 3} m_Script: {fileID: 11500000, guid: e4fa18aec69a2e949a7e2d4e33bdd2b9, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
inList: 0
lastState: 0
state:
gameObject: {fileID: 0}
early: 0
perfect: 0
late: 0
createBeat: 0
eligibleHitsList: []
aceTimes: 0
isEligible: 0
triggersAutoplay: 1
game: {fileID: 8728962026160321644} game: {fileID: 8728962026160321644}
animator: {fileID: 2256168985014220240} animator: {fileID: 2256168985014220240}
blipAnimator: {fileID: 1614535701461294964} blipAnimator: {fileID: 1614535701461294964}
@ -1098,6 +1145,88 @@ MonoBehaviour:
- {fileID: 2066794384027118212} - {fileID: 2066794384027118212}
targetBeat: 0.25 targetBeat: 0.25
stepTimes: 0 stepTimes: 0
--- !u!1 &8959999179820051615
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2744998194819868968}
- component: {fileID: 4164580634482561143}
m_Layer: 0
m_Name: ShadowFall
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &2744998194819868968
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8959999179820051615}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.523, y: 0.016, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1584116570229233278}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &4164580634482561143
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8959999179820051615}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: -2
m_Sprite: {fileID: -5599596391108488658, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1.9583334, y: 1.6041666}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &8963803634876878173 --- !u!1 &8963803634876878173
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1180,3 +1309,34 @@ SpriteRenderer:
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
m_MaskInteraction: 0 m_MaskInteraction: 0
m_SpriteSortPoint: 0 m_SpriteSortPoint: 0
--- !u!1 &9090607052953291167
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8301537147055126447}
m_Layer: 0
m_Name: Beats
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8301537147055126447
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9090607052953291167}
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:
- {fileID: 7622419266367956722}
m_Father: {fileID: 7248900333300803150}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View File

@ -116,6 +116,25 @@ AnimationClip:
path: Body/FallFX path: Body/FallFX
classID: 1 classID: 1
script: {fileID: 0} script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Body/ShadowFall
classID: 1
script: {fileID: 0}
m_PPtrCurves: m_PPtrCurves:
- curve: - curve:
- time: 0 - time: 0
@ -123,7 +142,7 @@ AnimationClip:
- time: 0.016666668 - time: 0.016666668
value: {fileID: 7267509016467870925, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} value: {fileID: 7267509016467870925, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3}
- time: 0.033333335 - time: 0.033333335
value: {fileID: -5599596391108488658, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} value: {fileID: 4385344229349358626, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3}
- time: 0.05 - time: 0.05
value: {fileID: -3983884386284601651, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} value: {fileID: -3983884386284601651, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3}
attribute: m_Sprite attribute: m_Sprite
@ -167,6 +186,13 @@ AnimationClip:
typeID: 1 typeID: 1
customType: 0 customType: 0
isPPtrCurve: 0 isPPtrCurve: 0
- serializedVersion: 2
path: 326924850
attribute: 2086281974
script: {fileID: 0}
typeID: 1
customType: 0
isPPtrCurve: 0
- serializedVersion: 2 - serializedVersion: 2
path: 2073732236 path: 2073732236
attribute: 0 attribute: 0
@ -184,7 +210,7 @@ AnimationClip:
pptrCurveMapping: pptrCurveMapping:
- {fileID: 910123527689434379, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} - {fileID: 910123527689434379, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3}
- {fileID: 7267509016467870925, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} - {fileID: 7267509016467870925, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3}
- {fileID: -5599596391108488658, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} - {fileID: 4385344229349358626, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3}
- {fileID: -3983884386284601651, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} - {fileID: -3983884386284601651, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3}
- {fileID: 442070513753258848, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} - {fileID: 442070513753258848, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3}
- {fileID: -1641719250182597347, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} - {fileID: -1641719250182597347, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3}
@ -367,6 +393,25 @@ AnimationClip:
path: Body/FallFX path: Body/FallFX
classID: 1 classID: 1
script: {fileID: 0} script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Body/ShadowFall
classID: 1
script: {fileID: 0}
m_EulerEditorCurves: [] m_EulerEditorCurves: []
m_HasGenericRootTransform: 0 m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0 m_HasMotionFloatCurves: 0

View File

@ -41,7 +41,35 @@ AnimationClip:
m_RotationOrder: 4 m_RotationOrder: 4
path: Head path: Head
m_ScaleCurves: [] m_ScaleCurves: []
m_FloatCurves: [] m_FloatCurves:
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.016666668
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Body/ShadowFall
classID: 1
script: {fileID: 0}
m_PPtrCurves: m_PPtrCurves:
- curve: - curve:
- time: 0 - time: 0
@ -57,6 +85,13 @@ AnimationClip:
m_Extent: {x: 0, y: 0, z: 0} m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant: m_ClipBindingConstant:
genericBindings: genericBindings:
- serializedVersion: 2
path: 326924850
attribute: 2086281974
script: {fileID: 0}
typeID: 1
customType: 0
isPPtrCurve: 0
- serializedVersion: 2 - serializedVersion: 2
path: 2073732236 path: 2073732236
attribute: 0 attribute: 0
@ -178,6 +213,34 @@ AnimationClip:
path: Head path: Head
classID: 4 classID: 4
script: {fileID: 0} script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.016666668
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Body/ShadowFall
classID: 1
script: {fileID: 0}
m_EulerEditorCurves: [] m_EulerEditorCurves: []
m_HasGenericRootTransform: 0 m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0 m_HasMotionFloatCurves: 0

View File

@ -125,6 +125,34 @@ AnimationClip:
path: Body/StepSmearFoot path: Body/StepSmearFoot
classID: 1 classID: 1
script: {fileID: 0} script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.050000004
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Body/ShadowFall
classID: 1
script: {fileID: 0}
m_PPtrCurves: m_PPtrCurves:
- curve: - curve:
- time: 0 - time: 0
@ -165,6 +193,13 @@ AnimationClip:
typeID: 1 typeID: 1
customType: 0 customType: 0
isPPtrCurve: 0 isPPtrCurve: 0
- serializedVersion: 2
path: 326924850
attribute: 2086281974
script: {fileID: 0}
typeID: 1
customType: 0
isPPtrCurve: 0
- serializedVersion: 2 - serializedVersion: 2
path: 2073732236 path: 2073732236
attribute: 0 attribute: 0
@ -382,6 +417,34 @@ AnimationClip:
path: Body/StepSmearFoot path: Body/StepSmearFoot
classID: 1 classID: 1
script: {fileID: 0} script: {fileID: 0}
- curve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.050000004
value: 0
inSlope: Infinity
outSlope: Infinity
tangentMode: 103
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
attribute: m_IsActive
path: Body/ShadowFall
classID: 1
script: {fileID: 0}
m_EulerEditorCurves: [] m_EulerEditorCurves: []
m_HasGenericRootTransform: 0 m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0 m_HasMotionFloatCurves: 0

View File

@ -61,10 +61,10 @@ TextureImporter:
second: mrupbeat_fall_1 second: mrupbeat_fall_1
- first: - first:
213: -5599596391108488658 213: -5599596391108488658
second: mrupbeat_fall_2 second: mrupbeat_shadow_fall
- first: - first:
213: -1109266650601169752 213: -1109266650601169752
second: mrupbeat_fall_2 second: mrupbeat_shadow_fall
- first: - first:
213: -3983884386284601651 213: -3983884386284601651
second: mrupbeat_fall_3 second: mrupbeat_fall_3
@ -597,6 +597,27 @@ TextureImporter:
indices: indices:
edges: [] edges: []
weights: [] weights: []
- serializedVersion: 2
name: mrupbeat_shadow_fall
rect:
serializedVersion: 2
x: 353
y: 209
width: 102
height: 37
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
physicsShape: []
tessellationDetail: 0
bones: []
spriteID: e225b6e00cc3a42b0800000000000000
internalID: -5599596391108488658
vertices: []
indices:
edges: []
weights: []
outline: [] outline: []
physicsShape: [] physicsShape: []
bones: [] bones: []

View File

@ -13,9 +13,9 @@ namespace RhythmHeavenMania.Games.MrUpbeat
[Header("References")] [Header("References")]
public GameObject metronome; public GameObject metronome;
public UpbeatMan man; public UpbeatMan man;
public GameObject bt;
public GameEvent beat = new GameEvent(); public GameEvent beat = new GameEvent();
public GameEvent offbeat = new GameEvent();
public bool canGo = false; public bool canGo = false;
public int beatCount = 0; public int beatCount = 0;
@ -31,6 +31,8 @@ namespace RhythmHeavenMania.Games.MrUpbeat
canGo = false; canGo = false;
man.stepTimes = 0; man.stepTimes = 0;
SetInterval(0); SetInterval(0);
var pos = Conductor.instance.songPositionInBeats;
StartCoroutine(Upbeat(pos - Mathf.Round(pos)));
} }
private void Update() private void Update()
@ -53,27 +55,24 @@ namespace RhythmHeavenMania.Games.MrUpbeat
metronome.transform.eulerAngles = new Vector3(0, 0, 270 - Mathf.Cos(Mathf.PI * Conductor.instance.songPositionInBeats) * 75); metronome.transform.eulerAngles = new Vector3(0, 0, 270 - Mathf.Cos(Mathf.PI * Conductor.instance.songPositionInBeats) * 75);
} }
if (Conductor.instance.ReportBeat(ref beat.lastReportedBeat) && canGo) if (Conductor.instance.ReportBeat(ref beat.lastReportedBeat))
{
StartCoroutine(Upbeat());
if (canGo)
{ {
if (beatCount % 2 == 0) if (beatCount % 2 == 0)
Jukebox.PlayOneShotGame("mrUpbeat/metronomeRight"); Jukebox.PlayOneShotGame("mrUpbeat/metronomeRight");
else else
Jukebox.PlayOneShotGame("mrUpbeat/metronomeLeft"); Jukebox.PlayOneShotGame("mrUpbeat/metronomeLeft");
beatCount++; Beat(Mathf.Round(Conductor.instance.songPositionInBeats));
} }
if (Conductor.instance.ReportBeat(ref offbeat.lastReportedBeat, 0.25f, true))
{
man.Blip();
if(canGo) man.targetBeat = offbeat.lastReportedBeat + 1f;
} }
} }
public void SetInterval(float beat) public void SetInterval(float beat)
{ {
beatCount = 0; beatCount = 0;
offbeat.startBeat = beat;
man.targetBeat = beat + 320f; man.targetBeat = beat + 320f;
man.Idle(); man.Idle();
} }
@ -84,5 +83,21 @@ namespace RhythmHeavenMania.Games.MrUpbeat
} }
public void Beat(float beat)
{
beatCount++;
GameObject _beat = Instantiate(bt);
_beat.transform.parent = bt.transform.parent;
_beat.SetActive(true);
UpbeatStep s = _beat.GetComponent<UpbeatStep>();
s.startBeat = beat;
}
private IEnumerator Upbeat(float offset = 0)
{
yield return new WaitForSeconds(Conductor.instance.secPerBeat * 0.5f - offset);
man.Blip();
}
} }
} }

View File

@ -8,7 +8,7 @@ using RhythmHeavenMania.Util;
namespace RhythmHeavenMania.Games.MrUpbeat namespace RhythmHeavenMania.Games.MrUpbeat
{ {
public class UpbeatMan : PlayerActionObject public class UpbeatMan : MonoBehaviour
{ {
[Header("References")] [Header("References")]
public MrUpbeat game; public MrUpbeat game;
@ -19,46 +19,16 @@ namespace RhythmHeavenMania.Games.MrUpbeat
public float targetBeat = 0.25f; public float targetBeat = 0.25f;
public int stepTimes = 0; public int stepTimes = 0;
private bool stepped = false; private bool stepped = false;
private bool onGround = false;
public GameEvent blip = new GameEvent(); public GameEvent blip = new GameEvent();
private void Update() private void Update()
{ {
float normalizedBeat = Conductor.instance.GetPositionFromMargin(targetBeat, 0.5f);
StateCheck(normalizedBeat);
if(game.canGo && normalizedBeat > Minigame.LateTime())
{
if ((game.beatCount % 2 == 0 && stepTimes % 2 == 0) || (game.beatCount % 2 == 1 && stepTimes % 2 == 1))
{
Fall();
}
targetBeat += 100f;
return;
}
if (PlayerInput.Pressed()) if (PlayerInput.Pressed())
{
if (state.perfect)
{ {
Step(); Step();
} }
else if(state.notPerfect())
{
Fall();
}
else
{
Step();
}
}
}
public override void OnAce()
{
if (!game.canGo) return;
Step();
} }
public void Idle() public void Idle()
@ -75,6 +45,29 @@ namespace RhythmHeavenMania.Games.MrUpbeat
animator.Play("Step", 0, 0); animator.Play("Step", 0, 0);
Jukebox.PlayOneShotGame("mrUpbeat/step"); Jukebox.PlayOneShotGame("mrUpbeat/step");
onGround = false;
CheckShadows();
}
public void Fall()
{
animator.Play("Fall", 0, 0);
Jukebox.PlayOneShot("miss");
shadows[0].SetActive(false);
shadows[1].SetActive(false);
onGround = true;
}
public void Blip()
{
Jukebox.PlayOneShotGame("mrUpbeat/blip");
blipAnimator.Play("Blip", 0, 0);
}
private void CheckShadows()
{
if (onGround) return;
if (stepTimes % 2 == 1) if (stepTimes % 2 == 1)
{ {
shadows[0].SetActive(false); shadows[0].SetActive(false);
@ -88,18 +81,6 @@ namespace RhythmHeavenMania.Games.MrUpbeat
} }
} }
public void Fall()
{
animator.Play("Fall", 0, 0);
Jukebox.PlayOneShot("miss");
}
public void Blip()
{
Jukebox.PlayOneShotGame("mrUpbeat/blip");
blipAnimator.Play("Blip", 0, 0);
}
} }
} }

View File

@ -0,0 +1,66 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using Starpelly;
using RhythmHeavenMania.Util;
namespace RhythmHeavenMania.Games.MrUpbeat
{
public class UpbeatStep : PlayerActionObject
{
public float startBeat;
private bool passedFirst = false;
private void Start()
{
PlayerActionInit(gameObject, startBeat);
}
public override void OnAce()
{
Hit(true, true);
}
private void Update()
{
if (Conductor.instance.GetPositionFromBeat(startBeat, 0.35f) >= 1 && !passedFirst)
{
if(MrUpbeat.instance.man.stepTimes % 2 != startBeat % 2)
Hit(false);
passedFirst = true;
}
if (Conductor.instance.GetPositionFromBeat(startBeat, 0.65f) >= 1)
Hit(false);
float normalizedBeat = Conductor.instance.GetPositionFromBeat(startBeat, 0.5f);
StateCheck(normalizedBeat);
if (PlayerInput.Pressed())
{
if (state.perfect)
{
Hit(true);
} else if (state.notPerfect())
{
Hit(false);
}
}
}
public void Hit(bool hit, bool force = false)
{
if (force) MrUpbeat.instance.man.Step();
else if (!hit) MrUpbeat.instance.man.Fall();
CleanUp();
}
public void CleanUp()
{
Destroy(this.gameObject);
}
}
}

View File

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

View File

@ -374,7 +374,7 @@ namespace RhythmHeavenMania
new GameAction("start interval", delegate { WizardsWaltz.instance.SetIntervalStart(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 4f, true), new GameAction("start interval", delegate { WizardsWaltz.instance.SetIntervalStart(eventCaller.currentEntity.beat, eventCaller.currentEntity.length); }, 4f, true),
new GameAction("plant", delegate { WizardsWaltz.instance.SpawnFlower(eventCaller.currentEntity.beat); }, 0.5f, false), new GameAction("plant", delegate { WizardsWaltz.instance.SpawnFlower(eventCaller.currentEntity.beat); }, 0.5f, false),
}), }),
new Minigame("mrUpbeat", "Mr. Upbeat \n<color=#eb5454>[WIP don't use]</color>", "FFFFFF", false, false, new List<GameAction>() new Minigame("mrUpbeat", "Mr. Upbeat", "FFFFFF", false, false, new List<GameAction>()
{ {
new GameAction("prepare", delegate { MrUpbeat.instance.SetInterval(eventCaller.currentEntity.beat); }, 0.5f, true), new GameAction("prepare", delegate { MrUpbeat.instance.SetInterval(eventCaller.currentEntity.beat); }, 0.5f, true),
new GameAction("go", delegate { MrUpbeat.instance.Go(eventCaller.currentEntity.beat); }, 4f, true), new GameAction("go", delegate { MrUpbeat.instance.Go(eventCaller.currentEntity.beat); }, 4f, true),