Mr Upbeat Programming progress

Autoplay works but it doesn't work otherwise
This commit is contained in:
Carson Kompon 2022-03-04 17:03:57 -05:00
parent 6d4a283eff
commit d22009e79c
8 changed files with 485 additions and 19 deletions

View file

@ -533,9 +533,8 @@ MonoBehaviour:
EligibleHits: [] EligibleHits: []
firstEnable: 0 firstEnable: 0
metronome: {fileID: 3862020474253857803} metronome: {fileID: 3862020474253857803}
animator: {fileID: 2256168985014220240} man: {fileID: 8160414645038680372}
blipAnimator: {fileID: 1614535701461294964} nextBeat: 0
shadows: []
--- !u!1 &8412912829583803381 --- !u!1 &8412912829583803381
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -627,6 +626,7 @@ GameObject:
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 862280508089709600} - component: {fileID: 862280508089709600}
- component: {fileID: 8160414645038680372}
m_Layer: 0 m_Layer: 0
m_Name: MrUpbeat m_Name: MrUpbeat
m_TagString: Untagged m_TagString: Untagged
@ -650,6 +650,35 @@ Transform:
m_Father: {fileID: 7248900333300803150} m_Father: {fileID: 7248900333300803150}
m_RootOrder: 2 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 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 --- !u!1 &8963803634876878173
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View file

@ -62,7 +62,7 @@ AnimatorStateMachine:
m_Position: {x: 360, y: 0, z: 0} m_Position: {x: 360, y: 0, z: 0}
- serializedVersion: 1 - serializedVersion: 1
m_State: {fileID: -5338859024521178731} m_State: {fileID: -5338859024521178731}
m_Position: {x: 350, y: 90, z: 0} m_Position: {x: 340, y: 90, z: 0}
m_ChildStateMachines: [] m_ChildStateMachines: []
m_AnyStateTransitions: [] m_AnyStateTransitions: []
m_EntryTransitions: [] m_EntryTransitions: []

View file

@ -14,24 +14,71 @@ AnimationClip:
m_RotationCurves: [] m_RotationCurves: []
m_CompressedRotationCurves: [] m_CompressedRotationCurves: []
m_EulerCurves: [] 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_ScaleCurves: []
m_FloatCurves: [] 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_SampleRate: 60
m_WrapMode: 0 m_WrapMode: 0
m_Bounds: m_Bounds:
m_Center: {x: 0, y: 0, z: 0} m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0} m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant: m_ClipBindingConstant:
genericBindings: [] genericBindings:
pptrCurveMapping: [] - 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: m_AnimationClipSettings:
serializedVersion: 2 serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0} m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0 m_AdditiveReferencePoseTime: 0
m_StartTime: 0 m_StartTime: 0
m_StopTime: 1 m_StopTime: 0.016666668
m_OrientationOffsetY: 0 m_OrientationOffsetY: 0
m_Level: 0 m_Level: 0
m_CycleOffset: 0 m_CycleOffset: 0
@ -46,7 +93,91 @@ AnimationClip:
m_KeepOriginalPositionXZ: 0 m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0 m_HeightFromFeet: 0
m_Mirror: 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_EulerEditorCurves: []
m_HasGenericRootTransform: 0 m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0 m_HasMotionFloatCurves: 0

View file

@ -14,24 +14,86 @@ AnimationClip:
m_RotationCurves: [] m_RotationCurves: []
m_CompressedRotationCurves: [] m_CompressedRotationCurves: []
m_EulerCurves: [] 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_ScaleCurves: []
m_FloatCurves: [] 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_SampleRate: 60
m_WrapMode: 0 m_WrapMode: 0
m_Bounds: m_Bounds:
m_Center: {x: 0, y: 0, z: 0} m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0} m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant: m_ClipBindingConstant:
genericBindings: [] genericBindings:
pptrCurveMapping: [] - 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: m_AnimationClipSettings:
serializedVersion: 2 serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0} m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0 m_AdditiveReferencePoseTime: 0
m_StartTime: 0 m_StartTime: 0
m_StopTime: 1 m_StopTime: 0.050000004
m_OrientationOffsetY: 0 m_OrientationOffsetY: 0
m_Level: 0 m_Level: 0
m_CycleOffset: 0 m_CycleOffset: 0
@ -46,7 +108,118 @@ AnimationClip:
m_KeepOriginalPositionXZ: 0 m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0 m_HeightFromFeet: 0
m_Mirror: 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_EulerEditorCurves: []
m_HasGenericRootTransform: 0 m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0 m_HasMotionFloatCurves: 0

View file

@ -12,9 +12,11 @@ namespace RhythmHeavenMania.Games.MrUpbeat
{ {
[Header("References")] [Header("References")]
public GameObject metronome; public GameObject metronome;
public Animator animator; public UpbeatMan man;
public Animator blipAnimator;
public GameObject[] shadows; public float nextBeat;
public bool canGo = false;
public static MrUpbeat instance; public static MrUpbeat instance;
@ -23,6 +25,29 @@ namespace RhythmHeavenMania.Games.MrUpbeat
instance = this; instance = this;
} }
private void Update()
{
List<Beatmap.Entity> gos = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "mrUpbeat/go");
for(int i=0; i<gos.Count; i++)
{
if ((gos[i].beat - 0.15f) <= Conductor.instance.songPositionInBeats && (gos[i].beat + gos[i].length) - 0.15f > 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;
}
} }

View file

@ -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);
}
}
}

View file

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

View file

@ -17,6 +17,7 @@ using RhythmHeavenMania.Games.BuiltToScaleDS;
using RhythmHeavenMania.Games.TapTrial; using RhythmHeavenMania.Games.TapTrial;
using RhythmHeavenMania.Games.CropStomp; using RhythmHeavenMania.Games.CropStomp;
using RhythmHeavenMania.Games.WizardsWaltz; using RhythmHeavenMania.Games.WizardsWaltz;
using RhythmHeavenMania.Games.MrUpbeat;
namespace RhythmHeavenMania 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("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 GameAction("go", delegate { }, 4f, true),
}),
/*new Minigame("spaceDance", "Space Dance", "B888F8", new List<GameAction>() /*new Minigame("spaceDance", "Space Dance", "B888F8", new List<GameAction>()
{ {
}), }),