Timeline entities added

This commit is contained in:
Braedon 2022-01-08 11:42:48 -05:00
parent 0208e6c490
commit 9bcb315344
16 changed files with 2510 additions and 1464 deletions

View file

@ -0,0 +1,355 @@
Shader "TextMeshPro/Distance Field External Outline"
{
Properties
{
_FaceTex ("Face Texture", 2D) = "white" {}
_FaceUVSpeedX ("Face UV Speed X", Range(-5, 5)) = 0.0
_FaceUVSpeedY ("Face UV Speed Y", Range(-5, 5)) = 0.0
_FaceColor ("Face Color", Color) = (1,1,1,1)
_FaceDilate ("Face Dilate", Range(-1,1)) = 0
_OutlineColor ("Outline Color", Color) = (0,0,0,1)
_OutlineTex ("Outline Texture", 2D) = "white" {}
_OutlineUVSpeedX ("Outline UV Speed X", Range(-5, 5)) = 0.0
_OutlineUVSpeedY ("Outline UV Speed Y", Range(-5, 5)) = 0.0
_OutlineWidth ("Outline Thickness", Range(0, 1)) = 0
_OutlineSoftness ("Outline Softness", Range(0,1)) = 0
_Bevel ("Bevel", Range(0,1)) = 0.5
_BevelOffset ("Bevel Offset", Range(-0.5,0.5)) = 0
_BevelWidth ("Bevel Width", Range(-.5,0.5)) = 0
_BevelClamp ("Bevel Clamp", Range(0,1)) = 0
_BevelRoundness ("Bevel Roundness", Range(0,1)) = 0
_LightAngle ("Light Angle", Range(0.0, 6.2831853)) = 3.1416
_SpecularColor ("Specular", Color) = (1,1,1,1)
_SpecularPower ("Specular", Range(0,4)) = 2.0
_Reflectivity ("Reflectivity", Range(5.0,15.0)) = 10
_Diffuse ("Diffuse", Range(0,1)) = 0.5
_Ambient ("Ambient", Range(1,0)) = 0.5
_BumpMap ("Normal map", 2D) = "bump" {}
_BumpOutline ("Bump Outline", Range(0,1)) = 0
_BumpFace ("Bump Face", Range(0,1)) = 0
_ReflectFaceColor ("Reflection Color", Color) = (0,0,0,1)
_ReflectOutlineColor("Reflection Color", Color) = (0,0,0,1)
_Cube ("Reflection Cubemap", Cube) = "black" { /* TexGen CubeReflect */ }
_EnvMatrixRotation ("Texture Rotation", vector) = (0, 0, 0, 0)
_UnderlayColor ("Border Color", Color) = (0,0,0, 0.5)
_UnderlayOffsetX ("Border OffsetX", Range(-1,1)) = 0
_UnderlayOffsetY ("Border OffsetY", Range(-1,1)) = 0
_UnderlayDilate ("Border Dilate", Range(-1,1)) = 0
_UnderlaySoftness ("Border Softness", Range(0,1)) = 0
_GlowColor ("Color", Color) = (0, 1, 0, 0.5)
_GlowOffset ("Offset", Range(-1,1)) = 0
_GlowInner ("Inner", Range(0,1)) = 0.05
_GlowOuter ("Outer", Range(0,1)) = 0.05
_GlowPower ("Falloff", Range(1, 0)) = 0.75
_WeightNormal ("Weight Normal", float) = 0
_WeightBold ("Weight Bold", float) = 0.5
_ShaderFlags ("Flags", float) = 0
_ScaleRatioA ("Scale RatioA", float) = 1
_ScaleRatioB ("Scale RatioB", float) = 1
_ScaleRatioC ("Scale RatioC", float) = 1
_MainTex ("Font Atlas", 2D) = "white" {}
_TextureWidth ("Texture Width", float) = 512
_TextureHeight ("Texture Height", float) = 512
_GradientScale ("Gradient Scale", float) = 5.0
_ScaleX ("Scale X", float) = 1.0
_ScaleY ("Scale Y", float) = 1.0
_PerspectiveFilter ("Perspective Correction", Range(0, 1)) = 0.875
_Sharpness ("Sharpness", Range(-1,1)) = 0
_VertexOffsetX ("Vertex OffsetX", float) = 0
_VertexOffsetY ("Vertex OffsetY", float) = 0
_MaskCoord ("Mask Coordinates", vector) = (0, 0, 32767, 32767)
_ClipRect ("Clip Rect", vector) = (-32767, -32767, 32767, 32767)
_MaskSoftnessX ("Mask SoftnessX", float) = 0
_MaskSoftnessY ("Mask SoftnessY", float) = 0
_StencilComp ("Stencil Comparison", Float) = 8
_Stencil ("Stencil ID", Float) = 0
_StencilOp ("Stencil Operation", Float) = 0
_StencilWriteMask ("Stencil Write Mask", Float) = 255
_StencilReadMask ("Stencil Read Mask", Float) = 255
_ColorMask ("Color Mask", Float) = 15
}
CGINCLUDE
#include "UnityCG.cginc"
#include "UnityUI.cginc"
#include "TMPro_Properties.cginc"
#include "TMPro.cginc"
struct vertex_t
{
UNITY_VERTEX_INPUT_INSTANCE_ID
float4 position : POSITION;
float3 normal : NORMAL;
fixed4 color : COLOR;
float2 texcoord0 : TEXCOORD0;
float2 texcoord1 : TEXCOORD1;
};
struct pixel_t
{
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
float4 position : SV_POSITION;
fixed4 color : COLOR;
float2 atlas : TEXCOORD0; // Atlas
float4 param : TEXCOORD1; // alphaClip, scale, bias, weight
float4 mask : TEXCOORD2; // Position in object space(xy), pixel Size(zw)
float3 viewDir : TEXCOORD3;
#if (UNDERLAY_ON || UNDERLAY_INNER)
float4 texcoord2 : TEXCOORD4; // u,v, scale, bias
fixed4 underlayColor : COLOR1;
#endif
float4 textures : TEXCOORD5;
};
float4 _FaceTex_ST;
float4 _OutlineTex_ST;
pixel_t VertShaderOutlined(vertex_t input, float outlineScale)
{
pixel_t output;
UNITY_INITIALIZE_OUTPUT(pixel_t, output);
UNITY_SETUP_INSTANCE_ID(input);
UNITY_TRANSFER_INSTANCE_ID(input, output);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
float bold = step(input.texcoord1.y, 0);
float4 vert = input.position;
vert.x += _VertexOffsetX;
vert.y += _VertexOffsetY;
float4 vPosition = UnityObjectToClipPos(vert);
float2 pixelSize = vPosition.w;
pixelSize /= float2(_ScaleX, _ScaleY) * abs(mul((float2x2)UNITY_MATRIX_P, _ScreenParams.xy));
float scale = rsqrt(dot(pixelSize, pixelSize));
scale *= abs(input.texcoord1.y) * _GradientScale * (_Sharpness + 1);
if (UNITY_MATRIX_P[3][3] == 0)
scale = lerp(abs(scale) * (1 - _PerspectiveFilter), scale,
abs(dot(UnityObjectToWorldNormal(input.normal.xyz),
normalize(WorldSpaceViewDir(vert)))));
float weight = lerp(_WeightNormal, _WeightBold, bold) / 4.0;
weight = (weight + _FaceDilate) * _ScaleRatioA * 0.5;
float bias = (.5 - weight) + (.5 / scale);
float alphaClip = (1.0 - _OutlineWidth * outlineScale * _ScaleRatioA - _OutlineSoftness * _ScaleRatioA);
#if GLOW_ON
alphaClip = min(alphaClip, 1.0 - _GlowOffset * _ScaleRatioB - _GlowOuter * _ScaleRatioB);
#endif
alphaClip = alphaClip / 2.0 - (.5 / scale) - weight;
#if (UNDERLAY_ON || UNDERLAY_INNER)
float4 underlayColor = _UnderlayColor;
underlayColor.rgb *= underlayColor.a;
float bScale = scale;
bScale /= 1 + ((_UnderlaySoftness*_ScaleRatioC) * bScale);
float bBias = (0.5 - weight) * bScale - 0.5 - ((_UnderlayDilate * _ScaleRatioC) * 0.5 * bScale);
float x = -(_UnderlayOffsetX * _ScaleRatioC) * _GradientScale / _TextureWidth;
float y = -(_UnderlayOffsetY * _ScaleRatioC) * _GradientScale / _TextureHeight;
float2 bOffset = float2(x, y);
#endif
// Generate UV for the Masking Texture
float4 clampedRect = clamp(_ClipRect, -2e10, 2e10);
float2 maskUV = (vert.xy - clampedRect.xy) / (clampedRect.zw - clampedRect.xy);
// Support for texture tiling and offset
float2 textureUV = UnpackUV(input.texcoord1.x);
float2 faceUV = TRANSFORM_TEX(textureUV, _FaceTex);
float2 outlineUV = TRANSFORM_TEX(textureUV, _OutlineTex);
output.position = vPosition;
output.color = input.color;
output.atlas = input.texcoord0;
output.param = float4(alphaClip, scale, bias * outlineScale, weight);
output.mask = half4(vert.xy * 2 - clampedRect.xy - clampedRect.zw,
0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + pixelSize.xy));
output.viewDir = mul((float3x3)_EnvMatrix, _WorldSpaceCameraPos.xyz - mul(unity_ObjectToWorld, vert).xyz);
#if (UNDERLAY_ON || UNDERLAY_INNER)
output.texcoord2 = float4(input.texcoord0 + bOffset, bScale, bBias);
output.underlayColor = underlayColor;
#endif
output.textures = float4(faceUV, outlineUV);
return output;
}
fixed4 PixShader(pixel_t input) : SV_Target
{
UNITY_SETUP_INSTANCE_ID(input);
float c = tex2D(_MainTex, input.atlas).a;
#ifndef UNDERLAY_ON
clip(c - input.param.x);
#endif
float scale = input.param.y;
float bias = input.param.z;
float weight = input.param.w;
float sd = (bias - c) * scale;
float outline = (_OutlineWidth * _ScaleRatioA) * scale;
float softness = (_OutlineSoftness * _ScaleRatioA) * scale;
half4 faceColor = _FaceColor;
half4 outlineColor = _OutlineColor;
faceColor.rgb *= input.color.rgb;
faceColor *= tex2D(_FaceTex, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y);
outlineColor *= tex2D(_OutlineTex, input.textures.zw + float2(_OutlineUVSpeedX, _OutlineUVSpeedY) * _Time.y);
faceColor = GetColor(sd, faceColor, outlineColor, outline, softness);
#if BEVEL_ON
float3 dxy = float3(0.5 / _TextureWidth, 0.5 / _TextureHeight, 0);
float3 n = GetSurfaceNormal(input.atlas, weight, dxy);
float3 bump = UnpackNormal(tex2D(_BumpMap, input.textures.xy + float2(_FaceUVSpeedX, _FaceUVSpeedY) * _Time.y)).xyz;
bump *= lerp(_BumpFace, _BumpOutline, saturate(sd + outline * 0.5));
n = normalize(n- bump);
float3 light = normalize(float3(sin(_LightAngle), cos(_LightAngle), -1.0));
float3 col = GetSpecular(n, light);
faceColor.rgb += col*faceColor.a;
faceColor.rgb *= 1-(dot(n, light)*_Diffuse);
faceColor.rgb *= lerp(_Ambient, 1, n.z*n.z);
fixed4 reflcol = texCUBE(_Cube, reflect(input.viewDir, -n));
faceColor.rgb += reflcol.rgb * lerp(_ReflectFaceColor.rgb, _ReflectOutlineColor.rgb, saturate(sd + outline * 0.5)) * faceColor.a;
#endif
#if UNDERLAY_ON
float d = tex2D(_MainTex, input.texcoord2.xy).a * input.texcoord2.z;
faceColor += input.underlayColor * saturate(d - input.texcoord2.w) * (1 - faceColor.a);
#endif
#if UNDERLAY_INNER
float d = tex2D(_MainTex, input.texcoord2.xy).a * input.texcoord2.z;
faceColor += input.underlayColor * (1 - saturate(d - input.texcoord2.w)) * saturate(1 - sd) * (1 - faceColor.a);
#endif
#if GLOW_ON
float4 glowColor = GetGlowColor(sd, scale);
faceColor.rgb += glowColor.rgb * glowColor.a;
#endif
// Alternative implementation to UnityGet2DClipping with support for softness.
#if UNITY_UI_CLIP_RECT
half2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * input.mask.zw);
faceColor *= m.x * m.y;
#endif
#if UNITY_UI_ALPHACLIP
clip(faceColor.a - 0.001);
#endif
return faceColor * input.color.a;
}
ENDCG
SubShader
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
}
Stencil
{
Ref [_Stencil]
Comp [_StencilComp]
Pass [_StencilOp]
ReadMask [_StencilReadMask]
WriteMask [_StencilWriteMask]
}
Cull [_CullMode]
ZWrite Off
Lighting Off
Fog
{
Mode Off
}
ZTest [unity_GUIZTestMode]
Blend One OneMinusSrcAlpha
ColorMask [_ColorMask]
Pass
{
CGPROGRAM
#pragma target 3.0
#pragma vertex VertShader
#pragma fragment PixShader
#pragma shader_feature __ BEVEL_ON
#pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER
#pragma shader_feature __ GLOW_ON
#pragma multi_compile __ UNITY_UI_CLIP_RECT
#pragma multi_compile __ UNITY_UI_ALPHACLIP
// Used by Unity internally to handle Texture Tiling and Offset.
pixel_t VertShader(vertex_t input)
{
return VertShaderOutlined(input, 1);
}
ENDCG
}
Pass
{
CGPROGRAM
#pragma target 3.0
#pragma vertex VertShader
#pragma fragment PixShader
#pragma shader_feature __ BEVEL_ON
#pragma shader_feature __ UNDERLAY_ON UNDERLAY_INNER
#pragma shader_feature __ GLOW_ON
#pragma multi_compile __ UNITY_UI_CLIP_RECT
#pragma multi_compile __ UNITY_UI_ALPHACLIP
pixel_t VertShader(vertex_t input)
{
return VertShaderOutlined(input, 0);
}
ENDCG
}
}
Fallback "TextMeshPro/Mobile/Distance Field"
CustomEditor "TMPro.EditorUtilities.TMP_SDFShaderGUI"
}

View file

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 3cacaa06574c4114f98cbbad61e81a90
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because one or more lines are too long

View file

@ -382,8 +382,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: 0.00005364418, y: 0}
m_SizeDelta: {x: 2, y: 13}
m_AnchoredPosition: {x: 0.00005364418, y: -0.98750305}
m_SizeDelta: {x: 2, y: 13.987503}
m_Pivot: {x: 0.5, y: 0}
--- !u!114 &236484357
MonoBehaviour:
@ -514,6 +514,140 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 238901180}
m_CullTransparentMesh: 1
--- !u!1 &258006091
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 258006092}
- component: {fileID: 258006094}
- component: {fileID: 258006093}
m_Layer: 5
m_Name: EventLabel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &258006092
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 258006091}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.01111111, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 798021449}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 0.6948, y: 0.0000019073486}
m_SizeDelta: {x: 49.5416, y: 44.84}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &258006093
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 258006091}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Event
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: c2df694f599b22b42817910ff570a9df, type: 2}
m_sharedMaterial: {fileID: -5829441969153149921, guid: c2df694f599b22b42817910ff570a9df, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 18.8
m_fontSizeBase: 18.8
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!222 &258006094
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 258006091}
m_CullTransparentMesh: 1
--- !u!1 &355353077
GameObject:
m_ObjectHideFlags: 0
@ -1087,7 +1221,7 @@ RectTransform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 555373788}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: 0, y: 0, z: 1698.25}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2037220114}
@ -1425,7 +1559,7 @@ MonoBehaviour:
m_HandleRect: {fileID: 704039020}
m_Direction: 0
m_Value: 0
m_Size: 0.044000003
m_Size: 0.033000004
m_NumberOfSteps: 0
m_OnValueChanged:
m_PersistentCalls:
@ -1504,6 +1638,118 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -20, y: -20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &660967736
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 660967737}
- component: {fileID: 660967739}
- component: {fileID: 660967738}
m_Layer: 5
m_Name: Block
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &660967737
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 660967736}
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: 1921041735}
m_Father: {fileID: 664843354}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 1, y: 0}
m_Pivot: {x: 0, y: 0.5}
--- !u!114 &660967738
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 660967736}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.14711641, g: 0.5471698, b: 0.24617729, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &660967739
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 660967736}
m_CullTransparentMesh: 1
--- !u!1 &664843353
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 664843354}
m_Layer: 5
m_Name: Blocks
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &664843354
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 664843353}
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: 660967737}
m_Father: {fileID: 798021449}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 1, y: 0}
m_Pivot: {x: 0, y: 0.5}
--- !u!1 &689207019
GameObject:
m_ObjectHideFlags: 0
@ -1810,6 +2056,128 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 770589359}
m_CullTransparentMesh: 1
--- !u!1 &798021448
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 798021449}
- component: {fileID: 798021451}
m_Layer: 5
m_Name: Test
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &798021449
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 798021448}
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: 664843354}
- {fileID: 258006092}
- {fileID: 820032005}
m_Father: {fileID: 1838356727}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 1, y: 50.84}
m_Pivot: {x: 0, y: 1}
--- !u!222 &798021451
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 798021448}
m_CullTransparentMesh: 1
--- !u!1 &820032004
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 820032005}
- component: {fileID: 820032007}
- component: {fileID: 820032006}
m_Layer: 5
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &820032005
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 820032004}
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: 798021449}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -0.314, y: 7.71}
m_SizeDelta: {x: 0.28989, y: 27.263}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &820032006
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 820032004}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &820032007
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 820032004}
m_CullTransparentMesh: 1
--- !u!1 &908855313
GameObject:
m_ObjectHideFlags: 0
@ -2522,8 +2890,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: f86858990a87c764892672104bdaef1f, type: 3}
m_Name:
m_EditorClassIdentifier:
level: {fileID: 4900000, guid: 244c565c8088cfa4597e0ebda9c7de98, type: 3}
music: {fileID: 8300000, guid: e5cf71158cc9bff4a8fbfbca1e73e500, type: 3}
level: {fileID: 4900000, guid: ac276edd56ab99249a2a413e6ac2783d, type: 3}
music: {fileID: 8300000, guid: d6aa7955da64b284589e923dc18c67fb, type: 3}
debugUI: 0
playOnStart: 0
editor: 1
@ -2860,7 +3228,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.7490196, g: 0.24705882, b: 0.24705882, a: 1}
m_Color: {r: 0.24705884, g: 0.7490196, b: 0.37254903, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
@ -3220,6 +3588,42 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 1280, y: 720}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1838356726
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1838356727}
m_Layer: 5
m_Name: EventGrid
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1838356727
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1838356726}
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: 798021449}
m_Father: {fileID: 1852819573}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -84.22006}
m_SizeDelta: {x: 0, y: -87.22}
m_Pivot: {x: 0, y: 1}
--- !u!1 &1852819572
GameObject:
m_ObjectHideFlags: 0
@ -3254,13 +3658,14 @@ RectTransform:
- {fileID: 1747224096}
- {fileID: 1671868846}
- {fileID: 580861938}
- {fileID: 1838356727}
m_Father: {fileID: 547319783}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 0, y: 146.29}
m_SizeDelta: {x: 240, y: 292.58}
m_SizeDelta: {x: 320, y: 292.58}
m_Pivot: {x: 0, y: 1}
--- !u!1 &1861169745
GameObject:
@ -3320,6 +3725,82 @@ MonoBehaviour:
TimelinePlaybackBeat: {fileID: 117889364}
TimelineContent: {fileID: 1852819573}
TimelineSongPosLineRef: {fileID: 580861938}
TestEVENTGO: {fileID: 798021449}
--- !u!1 &1921041734
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1921041735}
- component: {fileID: 1921041737}
- component: {fileID: 1921041736}
m_Layer: 5
m_Name: Image
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1921041735
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1921041734}
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: 660967737}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -0.060000002, y: -6}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1921041736
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1921041734}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.24705882, g: 0.7490196, b: 0.37254903, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1921041737
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1921041734}
m_CullTransparentMesh: 1
--- !u!1 &1928361018
GameObject:
m_ObjectHideFlags: 0

View file

@ -7,7 +7,7 @@ namespace RhythmHeavenMania
public class Beatmap
{
public float bpm;
public List<Entity> entities;
public List<Entity> entities = new List<Entity>();
[Serializable]
public class Entity : ICloneable

View file

@ -23,9 +23,6 @@ namespace RhythmHeavenMania
// Current song position, in beats
public float songPositionInBeats;
// Time that the song paused
private float pauseTime;
// Current time of the song
private float time;
@ -41,8 +38,6 @@ namespace RhythmHeavenMania
public bool isPlaying;
public bool isPaused;
public float currentTime;
// private AudioDspTimeKeeper timeKeeper;
void Awake()
@ -57,47 +52,48 @@ namespace RhythmHeavenMania
secPerBeat = 60f / songBpm;
}
public void SetBeat(float t)
public void SetBeat(float beat)
{
float secFromBeat = secPerBeat * t;
currentTime = secFromBeat;
pauseTime = 0;
float secFromBeat = GetSongPosFromBeat(beat);
if (secFromBeat < musicSource.clip.length)
musicSource.time = secFromBeat;
else
musicSource.time = 0;
GameManager.instance.SetCurrentEventToClosest(t);
GameManager.instance.SetCurrentEventToClosest(beat);
}
public void Play()
public void Play(float beat)
{
time = currentTime + pauseTime;
this.time = GetSongPosFromBeat(beat);
isPlaying = true;
isPaused = false;
musicSource.PlayScheduled(Time.time);
if (SongPosLessThanClipLength(time))
{
musicSource.time = time;
musicSource.PlayScheduled(Time.time);
}
GameManager.instance.SetCurrentEventToClosest(songPositionInBeats);
}
public void Pause()
{
pauseTime = time;
currentTime = 0;
isPlaying = false;
isPaused = true;
musicSource.Pause();
}
public void Stop()
public void Stop(float time)
{
time = 0;
this.time = time;
isPlaying = false;
isPaused = false;
GameManager.instance.SetCurrentEventToClosest(songPositionInBeats);
musicSource.Stop();
}
@ -143,5 +139,10 @@ namespace RhythmHeavenMania
if (!musicSource.clip) return 0;
return musicSource.clip.length / secPerBeat;
}
public bool SongPosLessThanClipLength(float t)
{
return t < musicSource.clip.length;
}
}
}

View file

@ -4,7 +4,7 @@ MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: -20
executionOrder: -45
icon: {instanceID: 0}
userData:
assetBundleName:

View file

@ -0,0 +1,14 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace RhythmHeavenMania
{
public static class Datamodel
{
public static string Split(this string s, int index)
{
return s.Split('/')[index];
}
}
}

View file

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

View file

@ -24,6 +24,8 @@ namespace RhythmHeavenMania
public delegate void EventCallback();
public static EventCaller instance { get; private set; }
public List<MiniGame> minigames = new List<MiniGame>()
{
};
@ -49,62 +51,76 @@ namespace RhythmHeavenMania
public string actionName;
public EventCallback function;
public bool playerAction = false;
public float[] eventBeats = new float[] { 0 };
public float defaultLength;
public bool resizable;
public GameAction(string actionName, EventCallback function, bool playerAction = false)
public GameAction(string actionName, EventCallback function, float[] eventBeats = null, float defaultLength = 1, bool playerAction = false, bool resizable = false)
{
this.actionName = actionName;
this.function = function;
this.playerAction = playerAction;
this.eventBeats = eventBeats;
this.defaultLength = defaultLength;
this.resizable = resizable;
}
}
public MiniGame GetMinigame(string gameName)
{
return minigames.Find(c => c.name == gameName);
}
public GameAction GetGameAction(MiniGame game, string action)
{
return game.actions.Find(c => c.actionName == action);
}
public void Init()
{
instance = this;
minigames = new List<MiniGame>()
{
new MiniGame("gameManager", "", new List<GameAction>()
{
new GameAction("end", delegate { Debug.Log("end"); }),
new GameAction("switchGame", delegate { GameManager.instance.SwitchGame(currentSwitchGame); })
new GameAction("end", delegate { Debug.Log("end"); }),
new GameAction("switchGame", delegate { GameManager.instance.SwitchGame(currentSwitchGame); })
}),
new MiniGame("forkLifter", "FFFFFF", new List<GameAction>()
{
new GameAction("pea", delegate { ForkLifter.instance.Flick(currentBeat, 0); }, true ),
new GameAction("topbun", delegate { ForkLifter.instance.Flick(currentBeat, 1); }, true ),
new GameAction("burger", delegate { ForkLifter.instance.Flick(currentBeat, 2); }, true ),
new GameAction("bottombun", delegate { ForkLifter.instance.Flick(currentBeat, 3); }, true ),
new GameAction("prepare", delegate { ForkLifter.instance.ForkLifterHand.Prepare(); }),
new GameAction("gulp", delegate { ForkLifterPlayer.instance.Eat(); }),
new GameAction("sigh", delegate { Jukebox.PlayOneShot("sigh"); })
new GameAction("pea", delegate { ForkLifter.instance.Flick(currentBeat, 0); }, new float[] { 0, 2 }, 3, true),
new GameAction("topbun", delegate { ForkLifter.instance.Flick(currentBeat, 1); }, new float[] { 0, 2 }, 3, true),
new GameAction("burger", delegate { ForkLifter.instance.Flick(currentBeat, 2); }, new float[] { 0, 2 }, 3, true),
new GameAction("bottombun", delegate { ForkLifter.instance.Flick(currentBeat, 3); }, new float[] { 0, 2 }, 3, true),
new GameAction("prepare", delegate { ForkLifter.instance.ForkLifterHand.Prepare(); }, new float[] { 0 }, 0.5f, true),
new GameAction("gulp", delegate { ForkLifterPlayer.instance.Eat(); }),
new GameAction("sigh", delegate { Jukebox.PlayOneShot("sigh"); })
}),
new MiniGame("clappyTrio", "29E7FF", new List<GameAction>()
{
// Claps
new GameAction("clap", delegate { ClappyTrio.instance.Clap(currentBeat, currentLength); }, true ),
new GameAction("bop", delegate { ClappyTrio.instance.Bop(currentBeat); } ),
new GameAction("prepare", delegate { ClappyTrio.instance.Prepare(0); } ),
new GameAction("prepare_alt", delegate { ClappyTrio.instance.Prepare(3); } ),
new GameAction("clap", delegate { ClappyTrio.instance.Clap(currentBeat, currentLength); }, new float[] { 0 }, 3, true),
new GameAction("bop", delegate { ClappyTrio.instance.Bop(currentBeat); } ),
new GameAction("prepare", delegate { ClappyTrio.instance.Prepare(0); } ),
new GameAction("prepare_alt", delegate { ClappyTrio.instance.Prepare(3); } ),
}),
new MiniGame("spaceball", "00A518", new List<GameAction>()
{
new GameAction("shoot", delegate { Spaceball.instance.Shoot(currentBeat, false, currentType); }, true ),
new GameAction("shootHigh", delegate { Spaceball.instance.Shoot(currentBeat, true, currentType); }, true ),
new GameAction("costume", delegate { Spaceball.instance.Costume(currentType); } ),
new GameAction("alien", delegate { Spaceball.instance.alien.Show(currentBeat); } ),
new GameAction("cameraZoom", delegate { } ),
new GameAction("shoot", delegate { Spaceball.instance.Shoot(currentBeat, false, currentType); }, new float[] { 0, 1 }, 2, true),
new GameAction("shootHigh", delegate { Spaceball.instance.Shoot(currentBeat, true, currentType); }, new float[] { 0, 2 }, 3, true),
new GameAction("costume", delegate { Spaceball.instance.Costume(currentType); } ),
new GameAction("alien", delegate { Spaceball.instance.alien.Show(currentBeat); } ),
new GameAction("cameraZoom", delegate { } ),
}),
new MiniGame("karateman", "70A8D8", new List<GameAction>()
{
new GameAction("bop", delegate { KarateMan.instance.Bop(currentBeat, currentLength); } ),
new GameAction("pot", delegate { KarateMan.instance.Shoot(currentBeat, 0); }, true ),
new GameAction("bulb", delegate { KarateMan.instance.Shoot(currentBeat, 1); }, true ),
new GameAction("rock", delegate { KarateMan.instance.Shoot(currentBeat, 2); }, true ),
new GameAction("ball", delegate { KarateMan.instance.Shoot(currentBeat, 3); }, true ),
new GameAction("kick", delegate { KarateMan.instance.Shoot(currentBeat, 4); }, true ),
new GameAction("bgfxon", delegate { KarateMan.instance.BGFXOn(); } ),
new GameAction("bgfxoff", delegate { KarateMan.instance.BGFXOff(); }),
new GameAction("bop", delegate { KarateMan.instance.Bop(currentBeat, currentLength); }, new float[] { 0 }, 0.5f, true, true),
new GameAction("pot", delegate { KarateMan.instance.Shoot(currentBeat, 0); }, new float[] { 0, 1 }, 2, true),
new GameAction("bulb", delegate { KarateMan.instance.Shoot(currentBeat, 1); }, new float[] { 0, 1 }, 2, true),
new GameAction("rock", delegate { KarateMan.instance.Shoot(currentBeat, 2); }, new float[] { 0, 1 }, 2, true),
new GameAction("ball", delegate { KarateMan.instance.Shoot(currentBeat, 3); }, new float[] { 0, 1 }, 2, true),
new GameAction("kick", delegate { KarateMan.instance.Shoot(currentBeat, 4); }, new float[] { 0, 1, 2 }, 4.5f, true),
new GameAction("bgfxon", delegate { KarateMan.instance.BGFXOn(); } ),
new GameAction("bgfxoff", delegate { KarateMan.instance.BGFXOff(); }),
})
};

View file

@ -15,7 +15,7 @@ namespace RhythmHeavenMania
public static GameManager instance;
private EventCaller eventCaller;
public Beatmap Beatmap;
public Beatmap Beatmap = new Beatmap();
[HideInInspector] public List<Beatmap.Entity> playerEntities = new List<Beatmap.Entity>();
public int currentEvent, currentPlayerEvent;
@ -46,8 +46,7 @@ namespace RhythmHeavenMania
instance = this;
}
// before Start() since this is very important
private void Start()
public void Init()
{
this.transform.localScale = new Vector3(3000, 3000);
SpriteRenderer sp = this.gameObject.AddComponent<SpriteRenderer>();
@ -110,7 +109,7 @@ namespace RhythmHeavenMania
if (currentEvent < Beatmap.entities.Count && currentEvent >= 0)
{
if (Conductor.instance.songPositionInBeats >= entities[currentEvent])
if (Conductor.instance.songPositionInBeats >= entities[currentEvent] && Conductor.instance.GetSongPosFromBeat(Conductor.instance.songPositionInBeats) < Conductor.instance.musicSource.clip.length)
{
// allows for multiple events on the same beat to be executed on the same frame, so no more 1-frame delay
var entitesAtSameBeat = Beatmap.entities.FindAll(c => c.beat == Beatmap.entities[currentEvent].beat && c.datamodel.Split('/')[0] != "gameManager");

View file

@ -4,7 +4,7 @@ MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: -10
executionOrder: -43
icon: {instanceID: 0}
userData:
assetBundleName:

View file

@ -26,8 +26,6 @@ namespace RhythmHeavenMania.Editor
{
instance = this;
Initializer = GetComponent<Initializer>();
MainCanvas.gameObject.SetActive(false);
}
public void Init()
@ -36,8 +34,7 @@ namespace RhythmHeavenMania.Editor
GameManager.instance.CursorCam.targetTexture = ScreenRenderTexture;
Screen.texture = ScreenRenderTexture;
MainCanvas.gameObject.SetActive(true);
GameManager.instance.Init();
Timeline.Init();
}
}

View file

@ -4,7 +4,7 @@ MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: -80
executionOrder: -40
icon: {instanceID: 0}
userData:
assetBundleName:

View file

@ -4,6 +4,7 @@ using UnityEngine;
using UnityEngine.UI;
using TMPro;
using Starpelly;
namespace RhythmHeavenMania.Editor
{
@ -24,10 +25,62 @@ namespace RhythmHeavenMania.Editor
[SerializeField] private RectTransform TimelineSongPosLineRef;
private RectTransform TimelineSongPosLine;
public RectTransform TestEVENTGO;
#region Initializers
public void Init()
{
for (int i = 0; i < GameManager.instance.Beatmap.entities.Count; i++)
{
var entity = GameManager.instance.Beatmap.entities[i];
GameObject g = Instantiate(TestEVENTGO.gameObject, TestEVENTGO.parent);
var e = GameManager.instance.Beatmap.entities[i];
g.transform.localPosition = new Vector3(e.beat, Mathp.Round2Nearest(Random.Range(0, -205.36f), 51.34f));
g.transform.GetChild(1).GetComponent<TMP_Text>().text = e.datamodel.Split('/')[1];
EventCaller.GameAction gameAction = EventCaller.instance.GetGameAction(EventCaller.instance.GetMinigame(e.datamodel.Split(0)), e.datamodel.Split(1));
GameObject blocksHolder = g.transform.GetChild(0).gameObject;
if (gameAction != null)
{
blocksHolder.GetComponent<RectTransform>().sizeDelta = new Vector2(gameAction.defaultLength, blocksHolder.GetComponent<RectTransform>().sizeDelta.y);
if (gameAction.eventBeats != null)
{
if (gameAction.eventBeats.Length > 0)
{
for (int k = 0; k < gameAction.eventBeats.Length; k++)
{
var ind = gameAction.eventBeats[k];
if (gameAction.defaultLength > 0)
{
float length;
if (k + 1 >= gameAction.eventBeats.Length)
length = gameAction.defaultLength - ind;
else
length = gameAction.eventBeats[k + 1];
if (gameAction.resizable)
{
length = entity.length;
}
GameObject block = Instantiate(blocksHolder.transform.GetChild(0).gameObject, blocksHolder.transform);
block.GetComponent<RectTransform>().sizeDelta = new Vector2(length, block.GetComponent<RectTransform>().sizeDelta.y);
block.transform.localPosition = new Vector3(ind, block.transform.localPosition.y);
block.gameObject.SetActive(true);
}
}
}
}
// g.GetComponent<RectTransform>().sizeDelta = new Vector2(gameAction.defaultLength, g.GetComponent<RectTransform>().sizeDelta.y);
}
g.SetActive(true);
}
}
#endregion
@ -51,21 +104,21 @@ namespace RhythmHeavenMania.Editor
{
if (Input.GetKey(KeyCode.LeftShift))
{
PlayCheck(true);
PlayCheck(false);
}
else
{
PlayCheck(false);
PlayCheck(true);
}
}
lastBeatPos = Conductor.instance.songPositionInBeats;
if (Input.GetMouseButtonDown(1) && !Conductor.instance.isPlaying)
if (Input.GetMouseButton(1) && !Conductor.instance.isPlaying)
{
RectTransformUtility.ScreenPointToLocalPointInRectangle(TimelineContent, Input.mousePosition, Editor.instance.EditorCamera, out lastMousePos);
TimelineSlider.localPosition = new Vector3(lastMousePos.x, TimelineSlider.transform.localPosition.y);
TimelineSlider.localPosition = new Vector3(Mathp.Round2Nearest(lastMousePos.x + 0.12f, 0.25f), TimelineSlider.transform.localPosition.y);
Conductor.instance.SetBeat(TimelineSlider.transform.localPosition.x);
}
@ -87,16 +140,21 @@ namespace RhythmHeavenMania.Editor
{
if (fromStart)
{
if (Conductor.instance.isPlaying)
Play(true);
if (!Conductor.instance.isPlaying)
{
Play(false, TimelineSlider.transform.localPosition.x);
}
else
Stop();
{
Stop(TimelineSlider.transform.localPosition.x);
}
}
else
{
if (!Conductor.instance.isPlaying)
{
Play(false);
Play(false, TimelineSongPosLine.transform.localPosition.x);
}
else
{
@ -105,9 +163,9 @@ namespace RhythmHeavenMania.Editor
}
}
public void Play(bool fromStart)
public void Play(bool fromStart, float time)
{
if (fromStart) Stop();
// if (fromStart) Stop();
if (!Conductor.instance.isPaused)
{
@ -115,7 +173,7 @@ namespace RhythmHeavenMania.Editor
TimelineSongPosLine.gameObject.SetActive(true);
}
Conductor.instance.Play();
Conductor.instance.Play(time);
}
public void Pause()
@ -124,7 +182,7 @@ namespace RhythmHeavenMania.Editor
Conductor.instance.Pause();
}
public void Stop()
public void Stop(float time)
{
// isPaused = true;
// timelineSlider.value = 0;
@ -132,7 +190,7 @@ namespace RhythmHeavenMania.Editor
if (TimelineSongPosLine != null)
Destroy(TimelineSongPosLine.gameObject);
Conductor.instance.Stop();
Conductor.instance.Stop(time);
}
#endregion

View file

@ -0,0 +1,15 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &1
MonoBehaviour:
m_ObjectHideFlags: 61
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a287be6c49135cd4f9b2b8666c39d999, type: 3}
m_Name:
m_EditorClassIdentifier:
assetDefaultFramerate: 60