Slightly functional Mr. Upbeat

This commit is contained in:
Carson Kompon 2022-03-04 22:10:10 -05:00
parent d22009e79c
commit 5c3730cf9d
5 changed files with 275 additions and 36 deletions

View file

@ -133,7 +133,7 @@ Transform:
- {fileID: 1584116570229233278}
- {fileID: 6950861003573010513}
m_Father: {fileID: 862280508089709600}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!95 &2256168985014220240
Animator:
@ -154,6 +154,88 @@ Animator:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!1 &2066794384027118212
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4285463118267461702}
- component: {fileID: 5137804451209053898}
m_Layer: 0
m_Name: ShadowR
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &4285463118267461702
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2066794384027118212}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.561, y: 0.026, z: 0}
m_LocalScale: {x: -1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 862280508089709600}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &5137804451209053898
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2066794384027118212}
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: 3055091234304763100, 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 &3862020474253857803
GameObject:
m_ObjectHideFlags: 0
@ -534,7 +616,7 @@ MonoBehaviour:
firstEnable: 0
metronome: {fileID: 3862020474253857803}
man: {fileID: 8160414645038680372}
nextBeat: 0
canGo: 0
--- !u!1 &8412912829583803381
GameObject:
m_ObjectHideFlags: 0
@ -546,7 +628,7 @@ GameObject:
- component: {fileID: 7864236320873353852}
- component: {fileID: 6548992874688888731}
m_Layer: 0
m_Name: Shadow
m_Name: ShadowL
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -646,6 +728,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 7864236320873353852}
- {fileID: 4285463118267461702}
- {fileID: 1584121333826078951}
m_Father: {fileID: 7248900333300803150}
m_RootOrder: 2
@ -677,7 +760,9 @@ MonoBehaviour:
game: {fileID: 8728962026160321644}
animator: {fileID: 2256168985014220240}
blipAnimator: {fileID: 1614535701461294964}
shadows: []
shadows:
- {fileID: 8412912829583803381}
- {fileID: 2066794384027118212}
stepTimes: 0
--- !u!1 &8963803634876878173
GameObject:

View file

@ -0,0 +1,108 @@
fileFormatVersion: 2
guid: 2387f6ba3501b5041bd7085fcd046301
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View file

@ -14,9 +14,10 @@ namespace RhythmHeavenMania.Games.MrUpbeat
public GameObject metronome;
public UpbeatMan man;
public float nextBeat;
public GameEvent beat = new GameEvent();
public GameEvent offbeat = new GameEvent();
public bool canGo = false;
private int beatCount = 0;
public static MrUpbeat instance;
@ -27,6 +28,11 @@ namespace RhythmHeavenMania.Games.MrUpbeat
private void Update()
{
if (canGo)
metronome.transform.eulerAngles = new Vector3(0, 0, 270 - Mathf.Cos(Mathf.PI * Conductor.instance.songPositionInBeats) * 75);
//else
// metronome.transform.eulerAngles = new Vector3(0, 0, 200);
List<Beatmap.Entity> gos = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "mrUpbeat/go");
for(int i=0; i<gos.Count; i++)
{
@ -40,13 +46,42 @@ namespace RhythmHeavenMania.Games.MrUpbeat
}
}
float normalizedBeat = Conductor.instance.GetPositionFromBeat(nextBeat, 0.5f);
//StateCheck(normalizedBeat);
if (Conductor.instance.ReportBeat(ref beat.lastReportedBeat) && canGo)
{
if(beatCount % 2 == 0)
Jukebox.PlayOneShotGame("mrUpbeat/metronomeRight");
else
Jukebox.PlayOneShotGame("mrUpbeat/metronomeLeft");
beatCount++;
}
if (Conductor.instance.ReportBeat(ref offbeat.lastReportedBeat, 0.25f, true))
{
man.Blip();
if(canGo) man.targetBeat = offbeat.lastReportedBeat + 1f;
}
}
public override void OnGameSwitch()
{
base.OnGameSwitch();
canGo = false;
man.stepTimes = 0;
SetInterval(0);
}
public void SetInterval(float beat)
{
nextBeat = beat;
beatCount = 0;
offbeat.startBeat = beat;
man.targetBeat = beat + 320f;
man.Idle();
}
public void Go(float beat)
{
beatCount = 0;
}

View file

@ -16,71 +16,81 @@ namespace RhythmHeavenMania.Games.MrUpbeat
public Animator blipAnimator;
public GameObject[] shadows;
public float targetBeat = 0.25f;
public int stepTimes = 0;
private bool stepped = false;
public GameEvent blip = new GameEvent();
private void Update()
{
float normalizedBeat = Conductor.instance.GetPositionFromBeat(game.nextBeat, 0.5f);
float normalizedBeat = Conductor.instance.GetPositionFromMargin(targetBeat, 0.5f);
StateCheck(normalizedBeat);
CheckIfFall(normalizedBeat);
if (PlayerInput.Pressed(true))
if(game.canGo && normalizedBeat > Minigame.LateTime())
{
//Fall();
targetBeat += 100f;
return;
}
if (PlayerInput.Pressed())
{
if (state.perfect)
{
Step();
} else if (state.notPerfect())
}
else if(state.notPerfect())
{
Fall();
}
else
{
Step();
}
}
}
public void ProgressBeat()
{
game.nextBeat += 1f;
Blip();
}
public override void OnAce()
{
if (!game.canGo) return;
Step();
}
public void Idle()
{
stepTimes = 0;
transform.localScale = new Vector3(1, 1);
animator.Play("Idle", 0, 0);
}
public void Step()
{
if (!game.canGo) return;
stepTimes++;
animator.Play("Step", 0, 0);
Jukebox.PlayOneShotGame("mrUpbeat/step");
if (stepTimes % 2 == 1)
{
shadows[0].SetActive(false);
shadows[1].SetActive(true);
transform.localScale = new Vector3(-1, 1);
else
} else
{
shadows[0].SetActive(true);
shadows[1].SetActive(false);
transform.localScale = new Vector3(1, 1);
ProgressBeat();
}
}
public void Fall()
{
if (!game.canGo) return;
animator.Play("Fall", 0, 0);
Jukebox.PlayOneShot("miss");
}
private void CheckIfFall(float normalizedBeat)
{
if (normalizedBeat > Minigame.LateTime())
{
Fall();
ProgressBeat();
}
}
public void Blip()
{
Jukebox.PlayOneShotGame("mrUpbeat/blip");

View file

@ -376,7 +376,8 @@ namespace RhythmHeavenMania
}),
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 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 Minigame("spaceDance", "Space Dance", "B888F8", new List<GameAction>()
{