diff --git a/Assets/Resources/Games/mrUpbeat.prefab b/Assets/Resources/Games/mrUpbeat.prefab index 26d8e6d6..6874555f 100644 --- a/Assets/Resources/Games/mrUpbeat.prefab +++ b/Assets/Resources/Games/mrUpbeat.prefab @@ -533,9 +533,8 @@ MonoBehaviour: EligibleHits: [] firstEnable: 0 metronome: {fileID: 3862020474253857803} - animator: {fileID: 2256168985014220240} - blipAnimator: {fileID: 1614535701461294964} - shadows: [] + man: {fileID: 8160414645038680372} + nextBeat: 0 --- !u!1 &8412912829583803381 GameObject: m_ObjectHideFlags: 0 @@ -627,6 +626,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 862280508089709600} + - component: {fileID: 8160414645038680372} m_Layer: 0 m_Name: MrUpbeat m_TagString: Untagged @@ -650,6 +650,35 @@ Transform: m_Father: {fileID: 7248900333300803150} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &8160414645038680372 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8472146464158439961} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e4fa18aec69a2e949a7e2d4e33bdd2b9, 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 + game: {fileID: 8728962026160321644} + animator: {fileID: 2256168985014220240} + blipAnimator: {fileID: 1614535701461294964} + shadows: [] + stepTimes: 0 --- !u!1 &8963803634876878173 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Resources/Sprites/Games/MrUpbeat/Animations/BlipAnimator.controller b/Assets/Resources/Sprites/Games/MrUpbeat/Animations/BlipAnimator.controller index 1d560d6d..38358668 100644 --- a/Assets/Resources/Sprites/Games/MrUpbeat/Animations/BlipAnimator.controller +++ b/Assets/Resources/Sprites/Games/MrUpbeat/Animations/BlipAnimator.controller @@ -62,7 +62,7 @@ AnimatorStateMachine: m_Position: {x: 360, y: 0, z: 0} - serializedVersion: 1 m_State: {fileID: -5338859024521178731} - m_Position: {x: 350, y: 90, z: 0} + m_Position: {x: 340, y: 90, z: 0} m_ChildStateMachines: [] m_AnyStateTransitions: [] m_EntryTransitions: [] diff --git a/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Idle.anim b/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Idle.anim index c89c1003..2e6e7c3e 100644 --- a/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Idle.anim +++ b/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Idle.anim @@ -14,24 +14,71 @@ AnimationClip: m_RotationCurves: [] m_CompressedRotationCurves: [] m_EulerCurves: [] - m_PositionCurves: [] + m_PositionCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: {x: -0.675, y: 1.31, z: 0} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 0.016666668 + value: {x: -0.675, y: 1.31, z: 0} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + path: Head m_ScaleCurves: [] m_FloatCurves: [] - m_PPtrCurves: [] + m_PPtrCurves: + - curve: + - time: 0 + value: {fileID: -4373096660332669510, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} + attribute: m_Sprite + path: Body + classID: 212 + script: {fileID: 0} m_SampleRate: 60 m_WrapMode: 0 m_Bounds: m_Center: {x: 0, y: 0, z: 0} m_Extent: {x: 0, y: 0, z: 0} m_ClipBindingConstant: - genericBindings: [] - pptrCurveMapping: [] + genericBindings: + - serializedVersion: 2 + path: 2073732236 + attribute: 0 + script: {fileID: 0} + typeID: 212 + customType: 23 + isPPtrCurve: 1 + - serializedVersion: 2 + path: 130111906 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + pptrCurveMapping: + - {fileID: -4373096660332669510, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} m_AnimationClipSettings: serializedVersion: 2 m_AdditiveReferencePoseClip: {fileID: 0} m_AdditiveReferencePoseTime: 0 m_StartTime: 0 - m_StopTime: 1 + m_StopTime: 0.016666668 m_OrientationOffsetY: 0 m_Level: 0 m_CycleOffset: 0 @@ -46,7 +93,91 @@ AnimationClip: m_KeepOriginalPositionXZ: 0 m_HeightFromFeet: 0 m_Mirror: 0 - m_EditorCurves: [] + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -0.675 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.016666668 + value: -0.675 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.x + path: Head + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1.31 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.016666668 + value: 1.31 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.y + path: Head + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.016666668 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.z + path: Head + classID: 4 + script: {fileID: 0} m_EulerEditorCurves: [] m_HasGenericRootTransform: 0 m_HasMotionFloatCurves: 0 diff --git a/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Step.anim b/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Step.anim index f1c1fef1..43f18c4c 100644 --- a/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Step.anim +++ b/Assets/Resources/Sprites/Games/MrUpbeat/Animations/Step.anim @@ -14,24 +14,86 @@ AnimationClip: m_RotationCurves: [] m_CompressedRotationCurves: [] m_EulerCurves: [] - m_PositionCurves: [] + m_PositionCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: {x: -0.675, y: 1.08, z: 0} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 0.016666668 + value: {x: -0.675, y: 1.23, z: 0} + inSlope: {x: 0, y: 6.8999968, z: 0} + outSlope: {x: 0, y: 6.8999968, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 0.033333335 + value: {x: -0.675, y: 1.31, z: 0} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + path: Head m_ScaleCurves: [] m_FloatCurves: [] - m_PPtrCurves: [] + m_PPtrCurves: + - curve: + - time: 0 + value: {fileID: 684874922003494188, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} + - time: 0.016666668 + value: {fileID: -2016408372270893465, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} + - time: 0.033333335 + value: {fileID: -4373096660332669510, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} + attribute: m_Sprite + path: Body + classID: 212 + script: {fileID: 0} m_SampleRate: 60 m_WrapMode: 0 m_Bounds: m_Center: {x: 0, y: 0, z: 0} m_Extent: {x: 0, y: 0, z: 0} m_ClipBindingConstant: - genericBindings: [] - pptrCurveMapping: [] + genericBindings: + - serializedVersion: 2 + path: 130111906 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + - serializedVersion: 2 + path: 2073732236 + attribute: 0 + script: {fileID: 0} + typeID: 212 + customType: 23 + isPPtrCurve: 1 + pptrCurveMapping: + - {fileID: 684874922003494188, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} + - {fileID: -2016408372270893465, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} + - {fileID: -4373096660332669510, guid: 2781bda31bd88924b9bc88f6c301b1d9, type: 3} m_AnimationClipSettings: serializedVersion: 2 m_AdditiveReferencePoseClip: {fileID: 0} m_AdditiveReferencePoseTime: 0 m_StartTime: 0 - m_StopTime: 1 + m_StopTime: 0.050000004 m_OrientationOffsetY: 0 m_Level: 0 m_CycleOffset: 0 @@ -46,7 +108,118 @@ AnimationClip: m_KeepOriginalPositionXZ: 0 m_HeightFromFeet: 0 m_Mirror: 0 - m_EditorCurves: [] + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -0.675 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.016666668 + value: -0.675 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.033333335 + value: -0.675 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.x + path: Head + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1.08 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.016666668 + value: 1.23 + inSlope: 6.8999968 + outSlope: 6.8999968 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.033333335 + value: 1.31 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.y + path: Head + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.016666668 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 0.033333335 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.z + path: Head + classID: 4 + script: {fileID: 0} m_EulerEditorCurves: [] m_HasGenericRootTransform: 0 m_HasMotionFloatCurves: 0 diff --git a/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs b/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs index 6ac611b4..505deaeb 100644 --- a/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs +++ b/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs @@ -12,9 +12,11 @@ namespace RhythmHeavenMania.Games.MrUpbeat { [Header("References")] public GameObject metronome; - public Animator animator; - public Animator blipAnimator; - public GameObject[] shadows; + public UpbeatMan man; + + public float nextBeat; + public bool canGo = false; + public static MrUpbeat instance; @@ -23,6 +25,29 @@ namespace RhythmHeavenMania.Games.MrUpbeat instance = this; } + private void Update() + { + List gos = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "mrUpbeat/go"); + for(int i=0; i Conductor.instance.songPositionInBeats) + { + canGo = true; + break; + } else + { + canGo = false; + } + } + + float normalizedBeat = Conductor.instance.GetPositionFromBeat(nextBeat, 0.5f); + //StateCheck(normalizedBeat); + } + + public void SetInterval(float beat) + { + nextBeat = beat; + } } diff --git a/Assets/Scripts/Games/MrUpbeat/UpbeatMan.cs b/Assets/Scripts/Games/MrUpbeat/UpbeatMan.cs new file mode 100644 index 00000000..4455894c --- /dev/null +++ b/Assets/Scripts/Games/MrUpbeat/UpbeatMan.cs @@ -0,0 +1,92 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using System; +using Starpelly; + +using RhythmHeavenMania.Util; + +namespace RhythmHeavenMania.Games.MrUpbeat +{ + public class UpbeatMan : PlayerActionObject + { + [Header("References")] + public MrUpbeat game; + public Animator animator; + public Animator blipAnimator; + public GameObject[] shadows; + + public int stepTimes = 0; + + public GameEvent blip = new GameEvent(); + + private void Update() + { + float normalizedBeat = Conductor.instance.GetPositionFromBeat(game.nextBeat, 0.5f); + StateCheck(normalizedBeat); + CheckIfFall(normalizedBeat); + + if (PlayerInput.Pressed(true)) + { + if (state.perfect) + { + Step(); + } else if (state.notPerfect()) + { + Fall(); + } + } + } + + public void ProgressBeat() + { + game.nextBeat += 1f; + Blip(); + } + + public override void OnAce() + { + Step(); + } + + public void Step() + { + if (!game.canGo) return; + + stepTimes++; + + Jukebox.PlayOneShotGame("mrUpbeat/step"); + + if (stepTimes % 2 == 1) + transform.localScale = new Vector3(-1, 1); + else + transform.localScale = new Vector3(1, 1); + + ProgressBeat(); + } + + public void Fall() + { + if (!game.canGo) return; + + Jukebox.PlayOneShot("miss"); + } + + private void CheckIfFall(float normalizedBeat) + { + if (normalizedBeat > Minigame.LateTime()) + { + Fall(); + ProgressBeat(); + } + } + + public void Blip() + { + Jukebox.PlayOneShotGame("mrUpbeat/blip"); + blipAnimator.Play("Blip", 0, 0); + } + + + } +} \ No newline at end of file diff --git a/Assets/Scripts/Games/MrUpbeat/UpbeatMan.cs.meta b/Assets/Scripts/Games/MrUpbeat/UpbeatMan.cs.meta new file mode 100644 index 00000000..36b78110 --- /dev/null +++ b/Assets/Scripts/Games/MrUpbeat/UpbeatMan.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e4fa18aec69a2e949a7e2d4e33bdd2b9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index 1f973204..9237b010 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -17,6 +17,7 @@ using RhythmHeavenMania.Games.BuiltToScaleDS; using RhythmHeavenMania.Games.TapTrial; using RhythmHeavenMania.Games.CropStomp; using RhythmHeavenMania.Games.WizardsWaltz; +using RhythmHeavenMania.Games.MrUpbeat; namespace RhythmHeavenMania { @@ -373,6 +374,10 @@ namespace RhythmHeavenMania 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 Minigame("mrUpbeat", "Mr. Upbeat \n[WIP don't use]", "FFFFFF", false, false, new List() + { + new GameAction("go", delegate { }, 4f, true), + }), /*new Minigame("spaceDance", "Space Dance", "B888F8", new List() { }),