diff --git a/Assets/Materials.meta b/Assets/Materials.meta new file mode 100644 index 00000000..80d56471 --- /dev/null +++ b/Assets/Materials.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1b22677b3a59345f0bef02c38b700728 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/General.meta b/Assets/Materials/General.meta new file mode 100644 index 00000000..5edc4816 --- /dev/null +++ b/Assets/Materials/General.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b0cc37bae489c47698f8eb9245ced60a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/General/DefaultLitTransparent.mat b/Assets/Materials/General/DefaultLitTransparent.mat new file mode 100644 index 00000000..de15ef7a --- /dev/null +++ b/Assets/Materials/General/DefaultLitTransparent.mat @@ -0,0 +1,137 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: DefaultLitTransparent + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _ALPHAPREMULTIPLY_ON + - _SURFACE_TYPE_TRANSPARENT + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 3000 + stringTagMap: + RenderType: Transparent + disabledShaderPasses: + - DepthOnly + - SHADOWCASTER + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 10 + - _DstBlendAlpha: 10 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 1 + - _WorkflowMode: 1 + - _ZWrite: 0 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] +--- !u!114 &5815930170147133817 +MonoBehaviour: + m_ObjectHideFlags: 11 + 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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 7 diff --git a/Assets/Materials/General/DefaultLitTransparent.mat.meta b/Assets/Materials/General/DefaultLitTransparent.mat.meta new file mode 100644 index 00000000..af86affd --- /dev/null +++ b/Assets/Materials/General/DefaultLitTransparent.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b39306d2c39754d0aafabe8570b8e640 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/BasePrefabsCollection.asset b/Assets/Prefabs/BasePrefabsCollection.asset index a95477cd..fae4c8d6 100644 --- a/Assets/Prefabs/BasePrefabsCollection.asset +++ b/Assets/Prefabs/BasePrefabsCollection.asset @@ -31,6 +31,9 @@ MonoBehaviour: type: 3} defaultTrackMaterial: {fileID: 2100000, guid: 2424431729f1047c4b42f971c2cdd2b6, type: 2} + trail: {fileID: 4801226466239889825, guid: a21d9cdd0e3454527bec5f2b0e9a9cae, type: 3} + defaultTrailMaterial: {fileID: 2100000, guid: 8af6dd7f0725540388b84a4697118bb9, + type: 2} tapNote: {fileID: 8182686472733940155, guid: 9b2da5f6faa9c4d2abe557fc8f79f806, type: 3} stayNote: {fileID: 0} holdNote: {fileID: 0} diff --git a/Assets/Prefabs/DefaultTrackMaterial.mat b/Assets/Prefabs/GameElements/DefaultTrackMaterial.mat similarity index 100% rename from Assets/Prefabs/DefaultTrackMaterial.mat rename to Assets/Prefabs/GameElements/DefaultTrackMaterial.mat diff --git a/Assets/Prefabs/DefaultTrackMaterial.mat.meta b/Assets/Prefabs/GameElements/DefaultTrackMaterial.mat.meta similarity index 100% rename from Assets/Prefabs/DefaultTrackMaterial.mat.meta rename to Assets/Prefabs/GameElements/DefaultTrackMaterial.mat.meta diff --git a/Assets/Prefabs/GameElements/DefaultTrailMaterial.mat b/Assets/Prefabs/GameElements/DefaultTrailMaterial.mat new file mode 100644 index 00000000..910d7b62 --- /dev/null +++ b/Assets/Prefabs/GameElements/DefaultTrailMaterial.mat @@ -0,0 +1,171 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: DefaultTrailMaterial + m_Shader: {fileID: 211, guid: 0000000000000000f000000000000000, type: 0} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 0 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: + - GRABPASS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _AlphaTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MaskTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _NormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BlendOp: 0 + - _BumpScale: 1 + - _CameraFadingEnabled: 0 + - _CameraFarFadeDistance: 2 + - _CameraNearFadeDistance: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _ColorMode: 0 + - _Cull: 0 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DistortionBlend: 0.5 + - _DistortionEnabled: 0 + - _DistortionStrength: 1 + - _DistortionStrengthScaled: 0 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EmissionEnabled: 0 + - _EnableExternalAlpha: 0 + - _EnvironmentReflections: 1 + - _FlipbookMode: 0 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossinessSource: 0 + - _GlossyReflections: 0 + - _LightingEnabled: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Shininess: 0 + - _Smoothness: 0.5 + - _SmoothnessSource: 0 + - _SmoothnessTextureChannel: 0 + - _SoftParticlesEnabled: 0 + - _SoftParticlesFarFadeDistance: 1 + - _SoftParticlesNearFadeDistance: 0 + - _SpecSource: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _Flip: {r: 1, g: 1, b: 1, a: 1} + - _RendererColor: {r: 1, g: 1, b: 1, a: 1} + - _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] +--- !u!114 &2523386628062252728 +MonoBehaviour: + m_ObjectHideFlags: 11 + 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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 7 diff --git a/Assets/Prefabs/GameElements/DefaultTrailMaterial.mat.meta b/Assets/Prefabs/GameElements/DefaultTrailMaterial.mat.meta new file mode 100644 index 00000000..b02760b6 --- /dev/null +++ b/Assets/Prefabs/GameElements/DefaultTrailMaterial.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8af6dd7f0725540388b84a4697118bb9 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/GameElements/Trail.prefab b/Assets/Prefabs/GameElements/Trail.prefab new file mode 100644 index 00000000..a6d3a6e9 --- /dev/null +++ b/Assets/Prefabs/GameElements/Trail.prefab @@ -0,0 +1,180 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &4801226466239889825 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5989318717494774921} + - component: {fileID: 4874969544181214436} + - component: {fileID: 7085906370378666250} + m_Layer: 0 + m_Name: Trail + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5989318717494774921 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4801226466239889825} + serializedVersion: 2 + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &4874969544181214436 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4801226466239889825} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 48120e902e0734a51a10b8b4c0229afa, type: 3} + m_Name: + m_EditorClassIdentifier: + serializationData: + SerializedFormat: 2 + SerializedBytes: + ReferencedUnityObjects: [] + SerializedBytesString: + Prefab: {fileID: 0} + PrefabModificationsReferencedUnityObjects: [] + PrefabModifications: [] + SerializationNodes: + - Name: elementGuid + Entry: 2 + Data: 00000000000000000000000000000000 + - Name: timeDurationSubmodule + Entry: 6 + Data: + - Name: transformSubmodule + Entry: 6 + Data: + - Name: colorSubmodule + Entry: 6 + Data: + elementName: + serialNumber: 0 + tags: [] + parentElement: {fileID: 0} + childElementList: [] + trailRenderer: {fileID: 7085906370378666250} + renderMaterial: {fileID: 0} + visibleTimeLength: 0 +--- !u!96 &7085906370378666250 +TrailRenderer: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4801226466239889825} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 0 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 0 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 8af6dd7f0725540388b84a4697118bb9, type: 2} + 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: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Time: 5 + m_PreviewTimeScale: 1 + m_Parameters: + serializedVersion: 3 + widthMultiplier: 1 + widthCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + colorGradient: + serializedVersion: 2 + key0: {r: 1, g: 1, b: 1, a: 1} + key1: {r: 1, g: 1, b: 1, a: 1} + key2: {r: 0, g: 0, b: 0, a: 0} + key3: {r: 0, g: 0, b: 0, a: 0} + key4: {r: 0, g: 0, b: 0, a: 0} + key5: {r: 0, g: 0, b: 0, a: 0} + key6: {r: 0, g: 0, b: 0, a: 0} + key7: {r: 0, g: 0, b: 0, a: 0} + ctime0: 0 + ctime1: 65535 + ctime2: 0 + ctime3: 0 + ctime4: 0 + ctime5: 0 + ctime6: 0 + ctime7: 0 + atime0: 0 + atime1: 65535 + atime2: 0 + atime3: 0 + atime4: 0 + atime5: 0 + atime6: 0 + atime7: 0 + m_Mode: 0 + m_ColorSpace: -1 + m_NumColorKeys: 2 + m_NumAlphaKeys: 2 + numCornerVertices: 0 + numCapVertices: 0 + alignment: 0 + textureMode: 0 + textureScale: {x: 1, y: 1} + shadowBias: 0.5 + generateLightingData: 0 + m_MinVertexDistance: 0.1 + m_MaskInteraction: 0 + m_Autodestruct: 0 + m_Emitting: 1 + m_ApplyActiveColorSpace: 1 diff --git a/Assets/Prefabs/GameElements/Trail.prefab.meta b/Assets/Prefabs/GameElements/Trail.prefab.meta new file mode 100644 index 00000000..980104de --- /dev/null +++ b/Assets/Prefabs/GameElements/Trail.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a21d9cdd0e3454527bec5f2b0e9a9cae +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 43896a49..1a787105 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -361,6 +361,7 @@ MonoBehaviour: Data: elementName: serialNumber: 0 + tags: [] parentElement: {fileID: 0} childElementList: [] camera: {fileID: 330585545} @@ -1244,8 +1245,10 @@ MonoBehaviour: Data: elementName: serialNumber: 0 + tags: [] parentElement: {fileID: 0} childElementList: [] + trackList: [] --- !u!4 &759707325 Transform: m_ObjectHideFlags: 0 @@ -1631,6 +1634,7 @@ MonoBehaviour: - Name: Entry: 8 Data: + currentJudgeType: 0 basePrefabs: {fileID: 11400000, guid: 266f4a39c512c46eea7e44336e4fc600, type: 2} elementList: [] --- !u!4 &1197505579 diff --git a/Assets/Scripts/Animations/AnimationBase.cs b/Assets/Scripts/Animations/AnimationBase.cs index 940e534b..41a3d857 100644 --- a/Assets/Scripts/Animations/AnimationBase.cs +++ b/Assets/Scripts/Animations/AnimationBase.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using System.Linq; @@ -12,35 +13,10 @@ namespace Ichni.RhythmGame public FlexibleReturnType animationReturnType; //public ICanHaveAnimation target; - public void NewInitialize(string elementName, BaseElement targetObject) + public override void Initialize(string elementName, Guid id, List tags) { - base.Initialize(elementName); - this.targetObject = targetObject; - SetParent(this.targetObject); - } - - public virtual void SetTimeDuration(params FlexibleFloat[] flexibleFloats) - { - List startTimes = new List(); - List endTimes = new List(); - - foreach (FlexibleFloat flexibleFloat in flexibleFloats) - { - flexibleFloat.Sort(); - - if (flexibleFloat.animations.Count > 0) - { - startTimes.Add(flexibleFloat.animations[0].startTime); - endTimes.Add(flexibleFloat.animations[^1].endTime); - } - } - - timeDurationSubmodule = new TimeDurationSubmodule(this, startTimes.Min(), endTimes.Max()); - } - - public virtual void SetTimeDuration(float startTime, float endTime) - { - timeDurationSubmodule = new TimeDurationSubmodule(this, startTime, endTime); + base.Initialize(elementName, id, tags); + timeDurationSubmodule = new TimeDurationSubmodule(this); } protected abstract void UpdateAnimation(float songTime); diff --git a/Assets/Scripts/Animations/Color/BaseColorChange.cs b/Assets/Scripts/Animations/Color/BaseColorChange.cs index 4c950bd7..4e256780 100644 --- a/Assets/Scripts/Animations/Color/BaseColorChange.cs +++ b/Assets/Scripts/Animations/Color/BaseColorChange.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using Lean.Pool; @@ -10,12 +11,15 @@ namespace Ichni.RhythmGame public ColorSubmodule targetColorSubmodule; public FlexibleFloat colorR, colorG, colorB, colorA; - public static BaseColorChange GenerateElement(string elementName, BaseElement targetObject, + public static BaseColorChange GenerateElement(string elementName, Guid id, + List tags, BaseElement targetObject, FlexibleFloat colorR, FlexibleFloat colorG, FlexibleFloat colorB, FlexibleFloat colorA) { BaseColorChange baseColorChange = Instantiate(EditorManager.instance.basePrefabs.emptyObject).AddComponent(); - baseColorChange.NewInitialize(elementName, targetObject); + baseColorChange.Initialize(elementName, id, tags); + baseColorChange.targetObject = targetObject; + baseColorChange.colorR = colorR; baseColorChange.colorG = colorG; baseColorChange.colorB = colorB; @@ -31,7 +35,8 @@ namespace Ichni.RhythmGame throw new System.Exception("Target object does not have a ColorSubmodule"); } - baseColorChange.SetTimeDuration(colorR, colorG, colorB, colorA); + baseColorChange.SetParent(targetObject); + baseColorChange.timeDurationSubmodule.SetDuration(colorR, colorG, colorB, colorA); return baseColorChange; } diff --git a/Assets/Scripts/Animations/Color/EmissionColorChange.cs b/Assets/Scripts/Animations/Color/EmissionColorChange.cs index d1173394..fa104a85 100644 --- a/Assets/Scripts/Animations/Color/EmissionColorChange.cs +++ b/Assets/Scripts/Animations/Color/EmissionColorChange.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using Lean.Pool; @@ -10,30 +11,35 @@ namespace Ichni.RhythmGame public ColorSubmodule targetColorSubmodule; public FlexibleFloat colorR, colorG, colorB, colorI; - public static EmissionColorChange GenerateElement(string elementName, BaseElement targetObject, + public static EmissionColorChange GenerateElement(string elementName, Guid id, + List tags, BaseElement targetObject, FlexibleFloat colorR, FlexibleFloat colorG, FlexibleFloat colorB, FlexibleFloat colorI) { - EmissionColorChange baseColorChange = Instantiate(EditorManager.instance.basePrefabs.emptyObject).AddComponent(); + EmissionColorChange emissionColorChange = Instantiate(EditorManager.instance.basePrefabs.emptyObject).AddComponent(); - baseColorChange.NewInitialize(elementName, targetObject); - baseColorChange.colorR = colorR; - baseColorChange.colorG = colorG; - baseColorChange.colorB = colorB; - baseColorChange.colorI = colorI; - baseColorChange.animationReturnType = FlexibleReturnType.Before; + emissionColorChange.Initialize(elementName, id, tags); + emissionColorChange.targetObject = targetObject; + + emissionColorChange.colorR = colorR; + emissionColorChange.colorG = colorG; + emissionColorChange.colorB = colorB; + emissionColorChange.colorI = colorI; + emissionColorChange.animationReturnType = FlexibleReturnType.Before; if (targetObject.colorSubmodule != null) { - baseColorChange.targetColorSubmodule = targetObject.colorSubmodule; + emissionColorChange.targetColorSubmodule = targetObject.colorSubmodule; } else { throw new System.Exception("Target object does not have a ColorSubmodule"); } - baseColorChange.SetTimeDuration(colorR, colorG, colorB, colorI); + emissionColorChange.SetParent(targetObject); + + emissionColorChange.timeDurationSubmodule.SetDuration(colorR, colorG, colorB, colorI); - return baseColorChange; + return emissionColorChange; } protected override void UpdateAnimation(float songTime) diff --git a/Assets/Scripts/Animations/Track/TrackTotalTimeChange.cs b/Assets/Scripts/Animations/Track/TrackTotalTimeChange.cs index 7803b6eb..87560c34 100644 --- a/Assets/Scripts/Animations/Track/TrackTotalTimeChange.cs +++ b/Assets/Scripts/Animations/Track/TrackTotalTimeChange.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using Lean.Pool; @@ -10,10 +11,13 @@ namespace Ichni.RhythmGame public FlexibleFloat totalTime; public TrackTimeSubmoduleStatic targetTrackTimeSubmoduleStatic; - public static TrackTotalTimeChange GenerateElement(string elementName, Track targetTrack, FlexibleFloat totalTime) + public static TrackTotalTimeChange GenerateElement(string elementName, Guid id, + List tags, Track targetTrack, FlexibleFloat totalTime) { TrackTotalTimeChange trackTotalTimeChange = Instantiate(EditorManager.instance.basePrefabs.emptyObject).AddComponent(); - trackTotalTimeChange.NewInitialize(elementName, targetTrack); + trackTotalTimeChange.Initialize(elementName, id, tags); + + trackTotalTimeChange.targetObject = targetTrack; if (targetTrack.trackTimeSubmodule is TrackTimeSubmoduleStatic submoduleStatic) { @@ -26,7 +30,9 @@ namespace Ichni.RhythmGame trackTotalTimeChange.totalTime = totalTime; trackTotalTimeChange.animationReturnType = FlexibleReturnType.Before; - trackTotalTimeChange.SetTimeDuration(totalTime); + trackTotalTimeChange.timeDurationSubmodule.SetDuration(totalTime); + + trackTotalTimeChange.SetParent(targetTrack); return trackTotalTimeChange; } diff --git a/Assets/Scripts/Animations/Transform/Displacement.cs b/Assets/Scripts/Animations/Transform/Displacement.cs index 59aab96a..d67d0e55 100644 --- a/Assets/Scripts/Animations/Transform/Displacement.cs +++ b/Assets/Scripts/Animations/Transform/Displacement.cs @@ -15,12 +15,15 @@ namespace Ichni.RhythmGame public TransformSubmodule targetTransformSubmodule; public FlexibleFloat positionX, positionY, positionZ; - public static Displacement GenerateElement(string elementName, BaseElement targetObject, + public static Displacement GenerateElement(string elementName, Guid id, + List tags, BaseElement targetObject, FlexibleFloat positionX, FlexibleFloat positionY, FlexibleFloat positionZ) { Displacement displacement = Instantiate(EditorManager.instance.basePrefabs.emptyObject).AddComponent(); - displacement.NewInitialize(elementName, targetObject); + displacement.Initialize(elementName, id, tags); + + displacement.targetObject = targetObject; displacement.positionX = positionX; displacement.positionY = positionY; @@ -36,7 +39,9 @@ namespace Ichni.RhythmGame throw new System.Exception("Target object does not have a TransformSubmodule"); } - displacement.SetTimeDuration(positionX, positionY, positionZ); + displacement.SetParent(targetObject); + + displacement.timeDurationSubmodule.SetDuration(positionX, positionY, positionZ); return displacement; } diff --git a/Assets/Scripts/Animations/Transform/LookAt.cs b/Assets/Scripts/Animations/Transform/LookAt.cs index 5ee0075e..6a5150fb 100644 --- a/Assets/Scripts/Animations/Transform/LookAt.cs +++ b/Assets/Scripts/Animations/Transform/LookAt.cs @@ -16,29 +16,33 @@ namespace Ichni.RhythmGame public BaseElement lookAtObject; public FlexibleBool enabling; - public static LookAt GenerateElement(string elementName, BaseElement targetObject, + public static LookAt GenerateElement(string elementName, Guid id, + List tags, BaseElement targetObject, BaseElement lookAtTarget, FlexibleBool enabling) { - LookAt swirl = Instantiate(EditorManager.instance.basePrefabs.emptyObject).AddComponent(); + LookAt look = Instantiate(EditorManager.instance.basePrefabs.emptyObject).AddComponent(); - swirl.NewInitialize(elementName, targetObject); - - swirl.lookAtObject = lookAtTarget; - swirl.enabling = enabling; - swirl.animationReturnType = FlexibleReturnType.Before; + look.Initialize(elementName, id, tags); + + look.targetObject = targetObject; + look.lookAtObject = lookAtTarget; + look.enabling = enabling; + look.animationReturnType = FlexibleReturnType.Before; if (targetObject.transformSubmodule != null) { - swirl.targetTransformSubmodule = targetObject.transformSubmodule; + look.targetTransformSubmodule = targetObject.transformSubmodule; } else { throw new System.Exception("Target object does not have a TransformSubmodule"); } + + look.SetParent(targetObject); - swirl.SetTimeDuration(-999, 999); //TODO: 换为(-delay, songLength) + look.timeDurationSubmodule.SetDuration(-999f, 999f); //TODO: 换为(-delay, songLength) - return swirl; + return look; } private void Start() diff --git a/Assets/Scripts/Animations/Transform/Scale.cs b/Assets/Scripts/Animations/Transform/Scale.cs index 08be57a2..3ce64f44 100644 --- a/Assets/Scripts/Animations/Transform/Scale.cs +++ b/Assets/Scripts/Animations/Transform/Scale.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using UnityEngine; @@ -9,12 +10,15 @@ namespace Ichni.RhythmGame public TransformSubmodule targetTransformSubmodule; public FlexibleFloat scaleX, scaleY, scaleZ; - public static Scale GenerateElement(string elementName, BaseElement targetObject, + public static Scale GenerateElement(string elementName, Guid id, + List tags, BaseElement targetObject, FlexibleFloat scaleX, FlexibleFloat scaleY, FlexibleFloat scaleZ) { Scale scale = Instantiate(EditorManager.instance.basePrefabs.emptyObject).AddComponent(); - scale.NewInitialize(elementName, targetObject); + scale.Initialize(elementName, id, tags); + + scale.targetObject = targetObject; scale.scaleX = scaleX; scale.scaleY = scaleY; @@ -30,7 +34,8 @@ namespace Ichni.RhythmGame throw new System.Exception("Target object does not have a TransformSubmodule"); } - scale.SetTimeDuration(scaleX, scaleY, scaleZ); + scale.SetParent(targetObject); + scale.timeDurationSubmodule.SetDuration(scaleX, scaleY, scaleZ); return scale; } diff --git a/Assets/Scripts/Animations/Transform/Swirl.cs b/Assets/Scripts/Animations/Transform/Swirl.cs index 3ce086f2..1f3614c0 100644 --- a/Assets/Scripts/Animations/Transform/Swirl.cs +++ b/Assets/Scripts/Animations/Transform/Swirl.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using Lean.Pool; @@ -10,12 +11,15 @@ namespace Ichni.RhythmGame public TransformSubmodule targetTransformSubmodule; public FlexibleFloat eulerAngleX, eulerAngleY, eulerAngleZ; - public static Swirl GenerateElement(string elementName, BaseElement targetObject, + public static Swirl GenerateElement(string elementName, Guid id, + List tags, BaseElement targetObject, FlexibleFloat eulerAngleX, FlexibleFloat eulerAngleY, FlexibleFloat eulerAngleZ) { Swirl swirl = Instantiate(EditorManager.instance.basePrefabs.emptyObject).AddComponent(); - swirl.NewInitialize(elementName, targetObject); + swirl.Initialize(elementName, id, tags); + + swirl.targetObject = targetObject; swirl.eulerAngleX = eulerAngleX; swirl.eulerAngleY = eulerAngleY; @@ -31,7 +35,9 @@ namespace Ichni.RhythmGame throw new System.Exception("Target object does not have a TransformSubmodule"); } - swirl.SetTimeDuration(eulerAngleX, eulerAngleY, eulerAngleZ); + swirl.SetParent(targetObject); + + swirl.timeDurationSubmodule.SetDuration(eulerAngleX, eulerAngleY, eulerAngleZ); return swirl; } diff --git a/Assets/Scripts/Base/BaseElement.cs b/Assets/Scripts/Base/BaseElement.cs index 4fb7bbe6..d57d8f89 100644 --- a/Assets/Scripts/Base/BaseElement.cs +++ b/Assets/Scripts/Base/BaseElement.cs @@ -2,6 +2,7 @@ using System; using System.Collections; using System.Collections.Generic; using System.Linq; +using Ichni.RhythmGame.Beatmap; using Sirenix.OdinInspector; using UniRx; using UnityEngine; @@ -13,9 +14,6 @@ namespace Ichni.RhythmGame { //物体名 public string elementName; - - //序列号 - public int serialNumber; //标识 GUID public Guid elementGuid; @@ -24,14 +22,14 @@ namespace Ichni.RhythmGame public List tags; //存档 - //public BaseElement_BM matchedBM; + public BaseElement_BM matchedBM; //父游戏物体 public BaseElement parentElement; //子物体列表 public List childElementList = new List(); - + //次级模块 public TimeDurationSubmodule timeDurationSubmodule; public TransformSubmodule transformSubmodule; @@ -41,10 +39,11 @@ namespace Ichni.RhythmGame /// 首次初始化 /// /// 物体名 - public virtual void Initialize(string name) + public virtual void Initialize(string name, Guid elementGuid, List tags) { this.elementName = name; - this.elementGuid = Guid.NewGuid(); + this.elementGuid = elementGuid; + this.tags = tags; EditorManager.instance.elementList.Add(this); //GameManager.beatMapContainer.beatMapElementList.Add(this); //serialNumber = totalSerialNumber++; @@ -56,7 +55,7 @@ namespace Ichni.RhythmGame /// public virtual void AfterInitialize() { - + } /// @@ -64,15 +63,7 @@ namespace Ichni.RhythmGame /// public virtual void Refresh() { - - } - /// - /// 当物体被删除时执行的方法 - /// - public virtual void OnDelete() - { - } /// @@ -88,25 +79,8 @@ namespace Ichni.RhythmGame transform.SetParent(parentElement.transform); } } - - public virtual void Delete() - { - if (this.childElementList != null) - { - for (int i = 0; i < childElementList.Count; i++) - { - childElementList[i].Delete(); //删除子GameElement、 - } - } - - OnDelete(); - - EditorManager.instance.elementList.Remove(this); //从保存列表中剔除 - this.parentElement.childElementList.Remove(this); - Destroy(gameObject); //销毁 - } } - + public abstract partial class BaseElement { private void Start() @@ -116,15 +90,14 @@ namespace Ichni.RhythmGame public virtual void SetTimeDuration() { - + } - - [Button("Apply Time Duration From Child")] + public void ApplyTimeDuration() { childElementList.ForEach(x => x.ApplyTimeDuration()); - - timeDurationSubmodule?.SetDurationFromChildren(childElementList.Select(x=>x.timeDurationSubmodule).ToList()); + timeDurationSubmodule?.SetDurationFromChildren(childElementList.Select(x => x.timeDurationSubmodule) + .ToList()); } /// @@ -147,11 +120,12 @@ namespace Ichni.RhythmGame { offset += scaleOffset; } + transformSubmodule.currentScale = transformSubmodule.originalScale + offset; transform.localScale = transformSubmodule.currentScale; transformSubmodule.scaleDirtyMark = false; } - + if (transformSubmodule.eulerAnglesDirtyMark) { Vector3 offset = Vector3.zero; @@ -159,11 +133,12 @@ namespace Ichni.RhythmGame { offset += eulerOffset; } + transformSubmodule.currentEulerAngles = transformSubmodule.originalEulerAngles + offset; transform.localEulerAngles = transformSubmodule.currentEulerAngles; transformSubmodule.eulerAnglesDirtyMark = false; } - + if (transformSubmodule.positionDirtyMark) { Vector3 offset = Vector3.zero; @@ -171,15 +146,116 @@ namespace Ichni.RhythmGame { offset += posOffset; } + transformSubmodule.currentPosition = transformSubmodule.originalPosition + offset; transform.localPosition = transformSubmodule.currentPosition; transformSubmodule.positionDirtyMark = false; } - + transformSubmodule.scaleOffset.Clear(); transformSubmodule.eulerAnglesOffset.Clear(); transformSubmodule.positionOffset.Clear(); }).AddTo(gameObject); } } + + public abstract partial class BaseElement //存档,删除,复制,粘贴 + { + /// + /// 用于生成存档 + /// + public abstract void SaveBM(); + + /// + /// 当物体被删除时执行的方法 + /// + public virtual void OnDelete() + { + + } + + + /// + /// 删除物体,包括所有子物体 + /// + [Button("Delete")] + public virtual void Delete() + { + if (this.childElementList != null) + { + for (int i = 0; i < childElementList.Count; i++) + { + childElementList[i].Delete(); //删除子GameElement、 + } + } + + OnDelete(); + +#if UNITY_EDITOR + Debug.Log("Delete " + elementName + "(" + elementGuid + ")"); +#endif + + EditorManager.instance.elementList.Remove(this); //从保存列表中剔除 + this.parentElement.childElementList.Remove(this); + Destroy(gameObject); //销毁 + } + } + + + namespace Beatmap + { + [System.Serializable] + public abstract class BaseElement_BM + { + [System.NonSerialized] public static Dictionary identifier; //存档类的标识符 + + [System.NonSerialized] public BaseElement matchedElement; //存档类对应的游戏物体 + public string elementName; + public List tags; + public Guid elementGuid; + public Guid attachedElementGuid; + + public BaseElement_BM() + { + + } + + public BaseElement_BM(string elementName, Guid elementGuid, List tags, BaseElement_BM attachedElement) + { + this.elementName = elementName; + this.elementGuid = elementGuid; + this.tags = tags; + + this.attachedElementGuid = attachedElement?.elementGuid ?? Guid.Empty; + + identifier.TryAdd(this.elementGuid, this); + } + + public static BaseElement_BM GetElementBM(Guid id) + { + if (identifier.TryGetValue(id, out BaseElement_BM element_BM)) + { + return element_BM; + } + + Debug.LogAssertion("Element not found or do not have id"); + return null; + } + + public static BaseElement GetElement(Guid id) + { + return GetElementBM(id)?.matchedElement; + } + + /// + /// 用于从存档中生成物体 + /// + public abstract void ExecuteBM(); + + /// + /// 用于复制物体 + /// + public abstract BaseElement DuplicateBM(BaseElement parent); + } + } } \ No newline at end of file diff --git a/Assets/Scripts/Base/FlexibleTypes/FlexibleInt.cs b/Assets/Scripts/Base/FlexibleTypes/FlexibleInt.cs new file mode 100644 index 00000000..6e84e192 --- /dev/null +++ b/Assets/Scripts/Base/FlexibleTypes/FlexibleInt.cs @@ -0,0 +1,81 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Ichni +{ + [System.Serializable] + public class AnimatedInt + { + public int value; //值 + public float time; + + public AnimatedInt() + { + } + + public AnimatedInt(int value, float time) + { + this.value = value; + this.time = time; + } + } + + [System.Serializable] + public class FlexibleInt + { + public int value; + public List animations; + + public FlexibleInt() + { + animations = new List(); + } + + public FlexibleInt(List anim) + { + this.animations = anim; + } + + public void Add(AnimatedInt animatedInt) + { + animations.Add(animatedInt); + } + + /// + /// 在动画脚本的Update中更新Int Value + /// + /// + public FlexibleReturnType UpdateFlexibleInt(float nowTime) + { + AnimatedInt nowAnimatedInt = GetAnimatedInt(nowTime); //获取当前时间点对应的AnimatedInt + value = nowAnimatedInt.value; //更新value + return FlexibleReturnType.MiddleExecuting; + } + + /// + /// 获取songTime对应的AnimatedInt的时间段 + /// + /// + /// 返回距离当前时间最近的前一个AnimatedInt + AnimatedInt GetAnimatedInt(float nowTime) + { + for (int i = 0; i < animations.Count; i++) + { + if (nowTime < animations[i].time) + { + if (i == 0) + { + return animations[i]; + } + else + { + return animations[i - 1]; + } + } + } + + return new AnimatedInt(0, 0); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Base/FlexibleTypes/FlexibleInt.cs.meta b/Assets/Scripts/Base/FlexibleTypes/FlexibleInt.cs.meta new file mode 100644 index 00000000..0fe4f934 --- /dev/null +++ b/Assets/Scripts/Base/FlexibleTypes/FlexibleInt.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 824c05113512f41048fc8189760bd7cc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Base/GeneralSubmodules/TimeDurationSubmodule.cs b/Assets/Scripts/Base/GeneralSubmodules/TimeDurationSubmodule.cs index 102825b1..7864f3e6 100644 --- a/Assets/Scripts/Base/GeneralSubmodules/TimeDurationSubmodule.cs +++ b/Assets/Scripts/Base/GeneralSubmodules/TimeDurationSubmodule.cs @@ -29,6 +29,32 @@ namespace Ichni.RhythmGame { return time >= startTime - offset && time <= endTime + offset; } + + public void SetDuration(float startTime, float endTime) + { + this.startTime = startTime; + this.endTime = endTime; + } + + public void SetDuration(params FlexibleFloat[] flexibleFloats) + { + List startTimes = new List(); + List endTimes = new List(); + + foreach (FlexibleFloat flexibleFloat in flexibleFloats) + { + flexibleFloat.Sort(); + + if (flexibleFloat.animations.Count > 0) + { + startTimes.Add(flexibleFloat.animations[0].startTime); + endTimes.Add(flexibleFloat.animations[^1].endTime); + } + } + + startTime = startTimes.Min(); + endTime = endTimes.Max(); + } public void SetDurationFromChildren(List children) { diff --git a/Assets/Scripts/Base/Manager/BasePrefabsCollection.cs b/Assets/Scripts/Base/Manager/BasePrefabsCollection.cs index 64e0fda2..5bf82be1 100644 --- a/Assets/Scripts/Base/Manager/BasePrefabsCollection.cs +++ b/Assets/Scripts/Base/Manager/BasePrefabsCollection.cs @@ -15,6 +15,10 @@ public class BasePrefabsCollection : SerializedScriptableObject public GameObject track; public GameObject pathNode; public Material defaultTrackMaterial; + + [Title("Trail相关")] + public GameObject trail; + public Material defaultTrailMaterial; [Title("Note 相关")] public GameObject tapNote; @@ -27,8 +31,7 @@ public class BasePrefabsCollection : SerializedScriptableObject public AudioClip holdNoteLoopSound; public AudioClip holdNoteEndSound; public AudioClip flickNoteSound; - - + [Title("Effect相关")] public GameObject bloomShake; } diff --git a/Assets/Scripts/Base/Manager/EditorManager.cs b/Assets/Scripts/Base/Manager/EditorManager.cs index b36938db..44b817bf 100644 --- a/Assets/Scripts/Base/Manager/EditorManager.cs +++ b/Assets/Scripts/Base/Manager/EditorManager.cs @@ -11,10 +11,11 @@ namespace Ichni public class EditorManager : SerializedMonoBehaviour { public static EditorManager instance; - - public SongModule songModule; - public BasePrefabsCollection basePrefabs; + public SongModule songModule; + public NoteBase.NoteJudgeType currentJudgeType; + public BasePrefabsCollection basePrefabs; + public List elementList = new List(); private void Awake() @@ -24,19 +25,28 @@ namespace Ichni private void Start() { - var f0 = ElementFolder.GenerateElement("Folder", null); - var dis0 = Displacement.GenerateElement("Displacement-0", f0, - new FlexibleFloat(), - new FlexibleFloat(new List(){new (0,2,0,2, AnimationCurveType.Linear)}), - new FlexibleFloat()); - var t0 = Track.GenerateElement("Track", f0, Vector3.left * 5f); - t0.trackPathSubmodule = new TrackPathSubmodule(t0, Track.TrackSpaceType.Linear, Track.TrackSamplingType.TimeDistributed, false); - t0.trackTimeSubmodule = new TrackTimeSubmoduleMovable(t0, 0, 2, 1, AnimationCurveType.Linear); - t0.trackRendererSubmodule = new TrackRendererSubmoduleAutoOrient(t0); - var p0 = PathNode.GenerateElement("PathNode-0", t0, 0, new Vector3(-5,5,10), Vector3.forward, 1, Color.white); - var p1 = PathNode.GenerateElement("PathNode-1", t0, 1, new Vector3(5,-5,10), Vector3.forward, 0, Color.red); - var n0 = Tap.GenerateElement("Note-0", 1f, t0); - var n0v = BasicNoteVisual.GenerateElement("Note-0-V", "basic", "BasicNoteTap3D", Vector3.zero, Vector3.zero, Vector3.one, n0); + //currentJudgeType = NoteBase.NoteJudgeType.Perfect; + + var f0 = ElementFolder.GenerateElement("Folder", Guid.NewGuid(), new List(), null); + // var dis0 = Displacement.GenerateElement("Displacement-0", f0, + // new FlexibleFloat(), + // new FlexibleFloat(new List(){new (0,2,0,2, AnimationCurveType.Linear)}), + // new FlexibleFloat()); + var t0 = Track.GenerateElement("Track", Guid.NewGuid(), new List(), f0, Vector3.left * 5f); + t0.trackPathSubmodule = new TrackPathSubmodule(t0, Track.TrackSpaceType.Linear, + Track.TrackSamplingType.TimeDistributed, false); + t0.trackTimeSubmodule = new TrackTimeSubmoduleMovable(t0, 0, 2, 1, AnimationCurveType.OutQuad); + var pp0 = TrackPercentPoint.GenerateElement("TrackPercentPoint-0", Guid.NewGuid(), new List(), t0, + new FlexibleFloat(new List() { new(0, 2, 0, 1, AnimationCurveType.OutQuad) })); + var tr0 = Trail.GenerateElement("Trail-0", Guid.NewGuid(), new List(), pp0, 5); + // t0.trackRendererSubmodule = new TrackRendererSubmoduleAutoOrient(t0); + var p0 = PathNode.GenerateElement("PathNode-0", Guid.NewGuid(), new List(), t0, + new Vector3(-5, 5, 10), Vector3.forward, 1, Color.white); + var p1 = PathNode.GenerateElement("PathNode-1", Guid.NewGuid(), new List(), t0, + new Vector3(5, -5, 10), Vector3.forward, 0, Color.red); + var n0 = Tap.GenerateElement("Note-0", Guid.NewGuid(), new List(), 1f, t0); + var n0v = BasicNoteVisual.GenerateElement("Note-0-V", Guid.NewGuid(), new List(), "basic", + "BasicNoteTap3D", Vector3.zero, Vector3.zero, Vector3.one, n0); elementList.ForEach(e => e.AfterInitialize()); } diff --git a/Assets/Scripts/Console/EditorConsole.cs b/Assets/Scripts/Console/EditorConsole.cs index f2433757..9d1f688f 100644 --- a/Assets/Scripts/Console/EditorConsole.cs +++ b/Assets/Scripts/Console/EditorConsole.cs @@ -15,7 +15,7 @@ namespace Ichni.Editor SetUpFunctions(); //Test - functionInterpreter.Eval("Log(\"Hello World!\")"); + //functionInterpreter.Eval("Log(\"Hello World!\")"); } } diff --git a/Assets/Scripts/GameElements/ElementFolder.cs b/Assets/Scripts/GameElements/ElementFolder.cs deleted file mode 100644 index ef7839a2..00000000 --- a/Assets/Scripts/GameElements/ElementFolder.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using Lean.Pool; -using UnityEngine; - -namespace Ichni.RhythmGame -{ - public class ElementFolder : BaseElement - { - public static ElementFolder GenerateElement(string name, BaseElement parentElement) - { - ElementFolder elementFolder = Instantiate(EditorManager.instance.basePrefabs.elementFolder).GetComponent(); - - elementFolder.Initialize(name); - elementFolder.SetParent(parentElement); - - elementFolder.transformSubmodule = new TransformSubmodule(elementFolder); - elementFolder.timeDurationSubmodule = new TimeDurationSubmodule(elementFolder); - //elementFolder.GenerateTab(parentElement); - - elementFolder.SetTransformObserver(); - - return elementFolder; - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/GameElements/ElementFolder.meta b/Assets/Scripts/GameElements/ElementFolder.meta new file mode 100644 index 00000000..62e0b729 --- /dev/null +++ b/Assets/Scripts/GameElements/ElementFolder.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6944ee6ee5d024c15a16862148361df3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/GameElements/ElementFolder/ElementFolder.cs b/Assets/Scripts/GameElements/ElementFolder/ElementFolder.cs new file mode 100644 index 00000000..e1b40875 --- /dev/null +++ b/Assets/Scripts/GameElements/ElementFolder/ElementFolder.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Lean.Pool; +using UnityEngine; + +namespace Ichni.RhythmGame +{ + public partial class ElementFolder : BaseElement + { + public List trackList; + + public static ElementFolder GenerateElement(string name, Guid id, List tags, BaseElement parentElement) + { + ElementFolder elementFolder = Instantiate(EditorManager.instance.basePrefabs.elementFolder).GetComponent(); + + elementFolder.Initialize(name, id, tags); + elementFolder.SetParent(parentElement); + + elementFolder.transformSubmodule = new TransformSubmodule(elementFolder); + elementFolder.timeDurationSubmodule = new TimeDurationSubmodule(elementFolder); + //elementFolder.GenerateTab(parentElement); + + elementFolder.SetTransformObserver(); + + return elementFolder; + } + } + + public partial class ElementFolder + { + public override void SaveBM() + { + matchedBM = new Beatmap.ElementFolder_BM(elementName, elementGuid, tags, parentElement.matchedBM); + } + } + + namespace Beatmap + { + public class ElementFolder_BM : BaseElement_BM + { + public ElementFolder_BM() + { + + } + + public ElementFolder_BM(string elementName, Guid elementGuid, List tags, BaseElement_BM attachedElement) + : base(elementName, elementGuid, tags, attachedElement) + { + + } + + public override void ExecuteBM() + { + matchedElement = ElementFolder.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid)); + } + + public override BaseElement DuplicateBM(BaseElement parent) + { + return ElementFolder.GenerateElement(elementName, elementGuid, tags, parent); + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/GameElements/ElementFolder.cs.meta b/Assets/Scripts/GameElements/ElementFolder/ElementFolder.cs.meta similarity index 100% rename from Assets/Scripts/GameElements/ElementFolder.cs.meta rename to Assets/Scripts/GameElements/ElementFolder/ElementFolder.cs.meta diff --git a/Assets/Scripts/GameElements/EnvironmentObjects/EnvironmentObject.cs b/Assets/Scripts/GameElements/EnvironmentObjects/EnvironmentObject.cs index 53ab5416..873678f8 100644 --- a/Assets/Scripts/GameElements/EnvironmentObjects/EnvironmentObject.cs +++ b/Assets/Scripts/GameElements/EnvironmentObjects/EnvironmentObject.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using Lean.Pool; @@ -9,13 +10,14 @@ namespace Ichni.RhythmGame { public bool isStatic; - public static SubstantialObject GenerateElement(string elementName, string themeBundleName, - string objectName, Vector3 position, Vector3 eulerAngles, Vector3 scale, BaseElement parent, + public static SubstantialObject GenerateElement(string elementName, Guid id, List tags, + string themeBundleName, string objectName, BaseElement parent, + Vector3 position, Vector3 eulerAngles, Vector3 scale, bool isStatic, bool isFirstGenerated = true) { EnvironmentObject themeBundleObject = ThemeBundleManager.instance.GetObject(themeBundleName, objectName); EnvironmentObject environmentObject = Instantiate(themeBundleObject, parent.transform).GetComponent(); - environmentObject.Initialize(elementName); + environmentObject.Initialize(elementName, id, tags); environmentObject.isStatic = isStatic; return environmentObject; } diff --git a/Assets/Scripts/GameElements/GameCamera/GameCamera.cs b/Assets/Scripts/GameElements/GameCamera/GameCamera.cs index 7ae7d93e..6ec37fbd 100644 --- a/Assets/Scripts/GameElements/GameCamera/GameCamera.cs +++ b/Assets/Scripts/GameElements/GameCamera/GameCamera.cs @@ -20,13 +20,14 @@ namespace Ichni.RhythmGame public float perspectiveAngle; public float orthographicSize; - public static GameCamera GenerateElement(string elementName, BaseElement parentElement, + public static GameCamera GenerateElement(string elementName, Guid id, + List tags, BaseElement parentElement, CameraViewType cameraViewType, float perspectiveAngle, float orthographicSize, Vector3 initialPosition, Vector3 initialEulerAngles) { GameCamera gameCamera = Instantiate(EditorManager.instance.basePrefabs.gameCamera).GetComponent(); - gameCamera.Initialize(elementName); + gameCamera.Initialize(elementName, id, tags); gameCamera.parentElement = parentElement; gameCamera.cameraViewType = cameraViewType; gameCamera.camera.orthographic = cameraViewType == CameraViewType.Orthographic; diff --git a/Assets/Scripts/GameElements/Notes/Flick.cs b/Assets/Scripts/GameElements/Notes/Flick.cs index 21a3128b..eb3527a5 100644 --- a/Assets/Scripts/GameElements/Notes/Flick.cs +++ b/Assets/Scripts/GameElements/Notes/Flick.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using Dreamteck.Splines; @@ -7,13 +8,14 @@ using UnityEngine; namespace Ichni.RhythmGame { - public class Flick : NoteBase + public partial class Flick : NoteBase { public List availableFlickDirections; - public static Flick GenerateElement(string elementName, float exactJudgeTime, BaseElement attach, List directions) + public static Flick GenerateElement(string elementName, Guid id, List tags, + float exactJudgeTime, BaseElement attach, List directions) { Flick flick = Instantiate(EditorManager.instance.basePrefabs.tapNote, attach.transform).GetComponent(); - flick.Initialize(elementName); + flick.Initialize(elementName, id, tags); flick.exactJudgeTime = exactJudgeTime; flick.availableFlickDirections = directions; flick.transformSubmodule = new TransformSubmodule(flick); @@ -44,4 +46,42 @@ namespace Ichni.RhythmGame return flick; } } + + public partial class Flick + { + public override void SaveBM() + { + matchedBM = new Beatmap.Flick_BM(elementName, elementGuid, tags, parentElement.matchedBM, exactJudgeTime, availableFlickDirections); + } + } + + namespace Beatmap + { + public class Flick_BM : BaseElement_BM + { + public float exactJudgeTime; + public List availableFlickDirections; + public Flick_BM() + { + + } + + public Flick_BM(string elementName, Guid elementGuid, List tags, BaseElement_BM attachedElement, float exactJudgeTime, List directions) + : base(elementName, elementGuid, tags, attachedElement) + { + this.exactJudgeTime = exactJudgeTime; + availableFlickDirections = directions; + } + + public override void ExecuteBM() + { + matchedElement = Flick.GenerateElement(elementName, elementGuid, tags, exactJudgeTime, GetElement(attachedElementGuid), availableFlickDirections); + } + + public override BaseElement DuplicateBM(BaseElement parent) + { + return Flick.GenerateElement(elementName, elementGuid, tags, exactJudgeTime, parent, availableFlickDirections); + } + } + } } \ No newline at end of file diff --git a/Assets/Scripts/GameElements/Notes/NoteBase.cs b/Assets/Scripts/GameElements/Notes/NoteBase.cs index 0ab99f3a..37e1fd88 100644 --- a/Assets/Scripts/GameElements/Notes/NoteBase.cs +++ b/Assets/Scripts/GameElements/Notes/NoteBase.cs @@ -7,7 +7,7 @@ using UnityEngine; namespace Ichni.RhythmGame { - public abstract class NoteBase : BaseElement + public abstract partial class NoteBase : BaseElement { [Title("Basic Info")] public float exactJudgeTime; @@ -41,9 +41,9 @@ namespace Ichni.RhythmGame public Vector2 noteScreenPosition; public bool isJudged; - public override void Initialize(string name) + public override void Initialize(string name, Guid id, List tags) { - base.Initialize(name); + base.Initialize(name, id, tags); generateEffects = new EffectSubmodule(this); generalJudgeEffects = new EffectSubmodule(this); perfectJudgeEffects = new EffectSubmodule(this); @@ -113,14 +113,23 @@ namespace Ichni.RhythmGame isJudged = true; } } + + generateEffects.effectList.ForEach(e => e.UpdateEffect()); - foreach (var effect in generateEffects.effectList) + switch (EditorManager.instance.currentJudgeType) { - effect.UpdateEffect(); - } - foreach (var effect in perfectJudgeEffects.effectList) - { - effect.UpdateEffect(); + case NoteJudgeType.Perfect: + perfectJudgeEffects.effectList.ForEach(e => e.UpdateEffect()); + break; + case NoteJudgeType.Good: + goodJudgeEffects.effectList.ForEach(e => e.UpdateEffect()); + break; + case NoteJudgeType.Bad: + badJudgeEffects.effectList.ForEach(e => e.UpdateEffect()); + break; + case NoteJudgeType.Miss: + missJudgeEffects.effectList.ForEach(e => e.UpdateEffect()); + break; } } @@ -144,4 +153,15 @@ namespace Ichni.RhythmGame } } } + + public abstract partial class NoteBase + { + public enum NoteJudgeType + { + Perfect, + Good, + Bad, + Miss + } + } } \ No newline at end of file diff --git a/Assets/Scripts/GameElements/Notes/NoteVisual/NoteVisualBase.cs b/Assets/Scripts/GameElements/Notes/NoteVisual/NoteVisualBase.cs index eda11174..80406c70 100644 --- a/Assets/Scripts/GameElements/Notes/NoteVisual/NoteVisualBase.cs +++ b/Assets/Scripts/GameElements/Notes/NoteVisual/NoteVisualBase.cs @@ -13,11 +13,5 @@ namespace Ichni.RhythmGame public List notePartList; public List effectPartList; - - public void NewInitialize(NoteBase note) - { - base.Initialize(note.elementName + " Note Visual"); - this.note = note; - } } } \ No newline at end of file diff --git a/Assets/Scripts/GameElements/Notes/Stay.cs b/Assets/Scripts/GameElements/Notes/Stay.cs index 9e0388c0..808cbacb 100644 --- a/Assets/Scripts/GameElements/Notes/Stay.cs +++ b/Assets/Scripts/GameElements/Notes/Stay.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using Dreamteck.Splines; @@ -7,12 +8,13 @@ using UnityEngine; namespace Ichni.RhythmGame { - public class Stay : NoteBase + public partial class Stay : NoteBase { - public static Stay GenerateElement(string elementName, float exactJudgeTime, BaseElement attach) + public static Stay GenerateElement(string elementName, Guid id, List tags, + float exactJudgeTime, BaseElement attach) { Stay stay = Instantiate(EditorManager.instance.basePrefabs.tapNote, attach.transform).GetComponent(); - stay.Initialize(elementName); + stay.Initialize(elementName, id, tags); stay.exactJudgeTime = exactJudgeTime; stay.transformSubmodule = new TransformSubmodule(stay); stay.timeDurationSubmodule = new TimeDurationSubmodule(stay); @@ -42,4 +44,41 @@ namespace Ichni.RhythmGame return stay; } } + + public partial class Stay + { + public override void SaveBM() + { + matchedBM = new Beatmap.Stay_BM(elementName, elementGuid, tags, parentElement.matchedBM, exactJudgeTime); + } + } + + namespace Beatmap + { + public class Stay_BM : BaseElement_BM + { + public float exactJudgeTime; + + public Stay_BM() + { + + } + + public Stay_BM(string elementName, Guid elementGuid, List tags, BaseElement_BM attachedElement, float exactJudgeTime) + : base(elementName, elementGuid, tags, attachedElement) + { + this.exactJudgeTime = exactJudgeTime; + } + + public override void ExecuteBM() + { + matchedElement = Stay.GenerateElement(elementName, elementGuid, tags, exactJudgeTime, GetElement(attachedElementGuid)); + } + + public override BaseElement DuplicateBM(BaseElement parent) + { + return Stay.GenerateElement(elementName, elementGuid, tags, exactJudgeTime, parent); + } + } + } } \ No newline at end of file diff --git a/Assets/Scripts/GameElements/Notes/Tap.cs b/Assets/Scripts/GameElements/Notes/Tap.cs index c4c6fe83..0a481e95 100644 --- a/Assets/Scripts/GameElements/Notes/Tap.cs +++ b/Assets/Scripts/GameElements/Notes/Tap.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using Dreamteck.Splines; @@ -7,12 +8,13 @@ using UnityEngine; namespace Ichni.RhythmGame { - public class Tap : NoteBase + public partial class Tap : NoteBase { - public static Tap GenerateElement(string elementName, float exactJudgeTime, BaseElement attach) + public static Tap GenerateElement(string elementName, Guid id, List tags, + float exactJudgeTime, BaseElement attach) { Tap tap = Instantiate(EditorManager.instance.basePrefabs.tapNote, attach.transform).GetComponent(); - tap.Initialize(elementName); + tap.Initialize(elementName, id, tags); tap.exactJudgeTime = exactJudgeTime; tap.transformSubmodule = new TransformSubmodule(tap); tap.timeDurationSubmodule = new TimeDurationSubmodule(tap); @@ -42,4 +44,41 @@ namespace Ichni.RhythmGame return tap; } } + + public partial class Tap + { + public override void SaveBM() + { + matchedBM = new Beatmap.Tap_BM(elementName, elementGuid, tags, parentElement.matchedBM, exactJudgeTime); + } + } + + namespace Beatmap + { + public class Tap_BM : BaseElement_BM + { + public float exactJudgeTime; + + public Tap_BM() + { + + } + + public Tap_BM(string elementName, Guid elementGuid, List tags, BaseElement_BM attachedElement, float exactJudgeTime) + : base(elementName, elementGuid, tags, attachedElement) + { + this.exactJudgeTime = exactJudgeTime; + } + + public override void ExecuteBM() + { + matchedElement = Tap.GenerateElement(elementName, elementGuid, tags, exactJudgeTime, GetElement(attachedElementGuid)); + } + + public override BaseElement DuplicateBM(BaseElement parent) + { + return Tap.GenerateElement(elementName, elementGuid, tags, exactJudgeTime, parent); + } + } + } } \ No newline at end of file diff --git a/Assets/Scripts/GameElements/SubstantialObject.cs b/Assets/Scripts/GameElements/SubstantialObject.cs index d8051193..a421f115 100644 --- a/Assets/Scripts/GameElements/SubstantialObject.cs +++ b/Assets/Scripts/GameElements/SubstantialObject.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using Lean.Pool; @@ -9,13 +10,13 @@ namespace Ichni.RhythmGame { public string themeBundleName, objectName; - public static SubstantialObject GenerateElement(string elementName, string themeBundleName, - string objectName, Vector3 position, Vector3 eulerAngles, Vector3 scale, BaseElement parent, - bool isFirstGenerated = true) + public static SubstantialObject GenerateElement(string elementName, Guid id, List tags, + string themeBundleName, string objectName, Vector3 position, Vector3 eulerAngles, Vector3 scale, + BaseElement parent, bool isFirstGenerated = true) { GameObject themeBundleObject = ThemeBundleManager.instance.GetObject(themeBundleName, objectName); SubstantialObject substantialObject = Instantiate(themeBundleObject, parent.transform).GetComponent(); - substantialObject.Initialize(elementName); + substantialObject.Initialize(elementName, id, tags); substantialObject.transformSubmodule = new TransformSubmodule(substantialObject, position, eulerAngles, scale); substantialObject.timeDurationSubmodule = new TimeDurationSubmodule(substantialObject); diff --git a/Assets/Scripts/GameElements/Track/PathNode.cs b/Assets/Scripts/GameElements/Track/PathNode.cs index bdfb5124..9fa17b9e 100644 --- a/Assets/Scripts/GameElements/Track/PathNode.cs +++ b/Assets/Scripts/GameElements/Track/PathNode.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using Dreamteck.Splines; @@ -18,12 +19,12 @@ namespace Ichni.RhythmGame public SplinePoint node; - public static PathNode GenerateElement(string elementName, Track track, int index, Vector3 nodePosition, - Vector3 nodeNormal, float nodeSize, Color nodeColor) + public static PathNode GenerateElement(string elementName, Guid id, List tags, + Track track, Vector3 nodePosition, Vector3 nodeNormal, float nodeSize, Color nodeColor) { PathNode pathNode = Instantiate(EditorManager.instance.basePrefabs.pathNode, track.transform).GetComponent(); - pathNode.Initialize(elementName); + pathNode.Initialize(elementName, id, tags); pathNode.track = track; //pathNode.index = index; diff --git a/Assets/Scripts/GameElements/Track/Track.cs b/Assets/Scripts/GameElements/Track/Track.cs index 2f71f013..cb8079af 100644 --- a/Assets/Scripts/GameElements/Track/Track.cs +++ b/Assets/Scripts/GameElements/Track/Track.cs @@ -12,11 +12,12 @@ namespace Ichni.RhythmGame public TrackTimeSubmodule trackTimeSubmodule; public TrackRendererSubmodule trackRendererSubmodule; - public static Track GenerateElement(string elementName, BaseElement parent, Vector3 position) + public static Track GenerateElement(string elementName, Guid id, List tags, + BaseElement parent, Vector3 position) { Track track = Instantiate(EditorManager.instance.basePrefabs.track, parent.transform).GetComponent(); - track.Initialize(elementName); + track.Initialize(elementName, id, tags); track.SetParent(parent); track.transformSubmodule = new TransformSubmodule(track, position, Vector3.zero, Vector3.one); @@ -47,9 +48,9 @@ namespace Ichni.RhythmGame public partial class Track { - public override void Refresh() + public override void SaveBM() { - + matchedBM = new Beatmap.Track_BM(elementName, elementGuid, tags, parentElement.matchedBM); } } @@ -68,4 +69,31 @@ namespace Ichni.RhythmGame DistanceDistributed = 1 } } + + namespace Beatmap + { + public class Track_BM : BaseElement_BM + { + public Track_BM() + { + + } + + public Track_BM(string elementName, Guid elementGuid, List tags, BaseElement_BM attachedElement) + : base(elementName, elementGuid, tags, attachedElement) + { + + } + + public override void ExecuteBM() + { + matchedElement = Track.GenerateElement(elementName, elementGuid, tags, GetElement(attachedElementGuid), Vector3.zero); + } + + public override BaseElement DuplicateBM(BaseElement parent) + { + return Track.GenerateElement(elementName, elementGuid, tags, parent, Vector3.zero); + } + } + } } \ No newline at end of file diff --git a/Assets/Scripts/GameElements/Track/TrackPoints/CrossTrackPoint.cs b/Assets/Scripts/GameElements/Track/TrackPoints/CrossTrackPoint.cs new file mode 100644 index 00000000..885666bd --- /dev/null +++ b/Assets/Scripts/GameElements/Track/TrackPoints/CrossTrackPoint.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Dreamteck.Splines; +using Ichni.RhythmGame; +using UnityEngine; + +namespace Ichni.RhythmGame +{ + public class CrossTrackPoint : BaseElement + { + public ElementFolder trackListFolder; + public Track nowAttachedTrack; + private int nowAttachedTrackIndex; + public SplinePositioner trackPositioner; + + public FlexibleInt trackSwitch; + public FlexibleFloat trackPercent; + + public static CrossTrackPoint GenerateElement(string elementName, Guid id, List tags, + ElementFolder elementFolder, FlexibleInt trackSwitch, FlexibleFloat trackPercent) + { + CrossTrackPoint point = Instantiate(EditorManager.instance.basePrefabs.emptyObject, elementFolder.transform).AddComponent(); + point.Initialize(elementName, id, tags); + point.trackPositioner = point.gameObject.AddComponent(); + point.nowAttachedTrackIndex = -1; + point.trackListFolder = elementFolder; + point.trackSwitch = trackSwitch; + point.trackPercent = trackPercent; + point.transformSubmodule = new TransformSubmodule(point); + point.timeDurationSubmodule = new TimeDurationSubmodule(point); + point.SetParent(elementFolder); + + return point; + } + + private void Update() + { + if (trackPercent.animations.Count > 0) + { + trackSwitch.UpdateFlexibleInt(EditorManager.instance.songModule.songTime); + trackPercent.UpdateFlexibleFloat(EditorManager.instance.songModule.songTime); + SetPoint(); + } + } + + private void SetPoint() + { + if (nowAttachedTrackIndex != trackSwitch.value && trackSwitch.value >= 0 && trackSwitch.value < trackListFolder.trackList.Count) + { + nowAttachedTrack = trackListFolder.trackList[trackSwitch.value]; + nowAttachedTrackIndex = trackSwitch.value; + trackPositioner.spline = trackListFolder.trackList[trackSwitch.value].trackPathSubmodule.path; + } + + trackPositioner.SetPercent(trackPercent.value); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/GameElements/Track/TrackPoints/CrossTrackPoint.cs.meta b/Assets/Scripts/GameElements/Track/TrackPoints/CrossTrackPoint.cs.meta new file mode 100644 index 00000000..4e49881d --- /dev/null +++ b/Assets/Scripts/GameElements/Track/TrackPoints/CrossTrackPoint.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7dc68e9f357304d71a938d5e3f9b1125 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/GameElements/Track/TrackPoints/TrackHeadPoint.cs b/Assets/Scripts/GameElements/Track/TrackPoints/TrackHeadPoint.cs index 4e934e10..dc99b852 100644 --- a/Assets/Scripts/GameElements/Track/TrackPoints/TrackHeadPoint.cs +++ b/Assets/Scripts/GameElements/Track/TrackPoints/TrackHeadPoint.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using Dreamteck.Splines; @@ -12,24 +13,19 @@ namespace Ichni.RhythmGame public TrackTimeSubmoduleMovable trackTimeSubmoduleMovable; public SplinePositioner trackPositioner; - public static TrackHeadPoint GenerateElement(string elementName, Track track) + public static TrackHeadPoint GenerateElement(string elementName, Guid id, List tags, Track track) { TrackHeadPoint head = Instantiate(EditorManager.instance.basePrefabs.emptyObject, track.transform).AddComponent(); - head.NewInitialize(elementName, track); + head.Initialize(elementName, id, tags); + head.track = track; + head.trackPositioner = head.gameObject.AddComponent(); + head.trackPositioner.spline = track.trackPathSubmodule.path; + head.trackTimeSubmoduleMovable = track.trackTimeSubmodule as TrackTimeSubmoduleMovable; head.SetParent(track); return head; } - - private void NewInitialize(string elementName, Track track) - { - base.Initialize(elementName); - this.track = track; - this.trackPositioner = gameObject.AddComponent(); - this.trackPositioner.spline = track.trackPathSubmodule.path; - this.trackTimeSubmoduleMovable = track.trackTimeSubmodule as TrackTimeSubmoduleMovable; - } - + public void Update() { if (track.timeDurationSubmodule.CheckTimeInDuration(EditorManager.instance.songModule.songTime)) diff --git a/Assets/Scripts/GameElements/Track/TrackPoints/TrackPercentPoint.cs b/Assets/Scripts/GameElements/Track/TrackPoints/TrackPercentPoint.cs index d6f17aec..5640e9aa 100644 --- a/Assets/Scripts/GameElements/Track/TrackPoints/TrackPercentPoint.cs +++ b/Assets/Scripts/GameElements/Track/TrackPoints/TrackPercentPoint.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using System.Linq; @@ -19,27 +20,23 @@ namespace Ichni.RhythmGame private bool isBeyond1 = false; - public static TrackPercentPoint GenerateElement(string elementName, Track track, FlexibleFloat trackPercent) + public static TrackPercentPoint GenerateElement(string elementName, Guid id, List tags, + Track track, FlexibleFloat trackPercent) { TrackPercentPoint point = Instantiate(EditorManager.instance.basePrefabs.emptyObject, track.transform).AddComponent(); - point.NewInitialize(elementName, track, trackPercent); + point.Initialize(elementName, id, tags); + point.track = track; + point.trackPositioner = point.gameObject.AddComponent(); + point.trackPositioner.spline = track.trackPathSubmodule.path; + point.trackPercent = trackPercent; point.SetParent(track); point.isBeyond1 = trackPercent.animations.Any(animation => animation.endValue > 1);//判断是否有超过1的动画,超过1将会循环 return point; } - - private void NewInitialize(string elementName, Track track, FlexibleFloat trackPercent) - { - base.Initialize(elementName); - this.track = track; - this.trackPositioner = gameObject.AddComponent(); - this.trackPositioner.spline = track.trackPathSubmodule.path; - this.trackPercent = trackPercent; - } - + public void Update() { if (trackPercent.animations.Count > 0) diff --git a/Assets/Scripts/GameElements/Track/Trail.cs b/Assets/Scripts/GameElements/Track/Trail.cs new file mode 100644 index 00000000..31306407 --- /dev/null +++ b/Assets/Scripts/GameElements/Track/Trail.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Ichni.RhythmGame +{ + public class Trail : BaseElement + { + public TrailRenderer trailRenderer; + public Material renderMaterial; + + public float visibleTimeLength; + + public static Trail GenerateElement(string name, Guid id, List tags, + BaseElement parentElement, float visibleTimeLength, Material material = null) + { + Trail trail = Instantiate(EditorManager.instance.basePrefabs.trail).GetComponent(); + trail.trailRenderer = trail.GetComponent(); + + trail.Initialize(name, id, tags); + trail.renderMaterial = material == null ? EditorManager.instance.basePrefabs.defaultTrailMaterial : material; + trail.trailRenderer.material = trail.renderMaterial; + trail.visibleTimeLength = visibleTimeLength; + trail.SetParent(parentElement); + + trail.transformSubmodule = new TransformSubmodule(trail); + + return trail; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/GameElements/Track/Trail.cs.meta b/Assets/Scripts/GameElements/Track/Trail.cs.meta new file mode 100644 index 00000000..2da31acc --- /dev/null +++ b/Assets/Scripts/GameElements/Track/Trail.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 48120e902e0734a51a10b8b4c0229afa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets/ThemeBundles/OSX/OSX b/Assets/StreamingAssets/ThemeBundles/OSX/OSX index d2c1c067..a067fb30 100644 Binary files a/Assets/StreamingAssets/ThemeBundles/OSX/OSX and b/Assets/StreamingAssets/ThemeBundles/OSX/OSX differ diff --git a/Assets/StreamingAssets/ThemeBundles/OSX/OSX.manifest b/Assets/StreamingAssets/ThemeBundles/OSX/OSX.manifest index 6e6b2d5f..cb808116 100644 --- a/Assets/StreamingAssets/ThemeBundles/OSX/OSX.manifest +++ b/Assets/StreamingAssets/ThemeBundles/OSX/OSX.manifest @@ -1,5 +1,5 @@ ManifestFileVersion: 0 -CRC: 2320234516 +CRC: 3910270382 AssetBundleManifest: AssetBundleInfos: Info_0: diff --git a/Assets/StreamingAssets/ThemeBundles/OSX/basic b/Assets/StreamingAssets/ThemeBundles/OSX/basic index eaf8ff5f..671e3332 100644 Binary files a/Assets/StreamingAssets/ThemeBundles/OSX/basic and b/Assets/StreamingAssets/ThemeBundles/OSX/basic differ diff --git a/Assets/StreamingAssets/ThemeBundles/OSX/basic.manifest b/Assets/StreamingAssets/ThemeBundles/OSX/basic.manifest index 7f175f73..f0fa5298 100644 --- a/Assets/StreamingAssets/ThemeBundles/OSX/basic.manifest +++ b/Assets/StreamingAssets/ThemeBundles/OSX/basic.manifest @@ -1,15 +1,15 @@ ManifestFileVersion: 0 -CRC: 3644372668 +CRC: 3370319538 Hashes: AssetFileHash: serializedVersion: 2 - Hash: 110d4740b29ef7da3aa800ad69f39ffe + Hash: 49bd9bdbb89b1cab8e0110743b991ce3 TypeTreeHash: serializedVersion: 2 - Hash: 0b29093cb0b98a6a3edca231f6a05b16 + Hash: 14b925367e650018329ce40d4f1a1124 IncrementalBuildHash: serializedVersion: 2 - Hash: 110d4740b29ef7da3aa800ad69f39ffe + Hash: 49bd9bdbb89b1cab8e0110743b991ce3 HashAppended: 0 ClassTypes: - Class: 1 diff --git a/Assets/ThemeBundles/Basic/Prefabs/BasicNoteTap3D.prefab b/Assets/ThemeBundles/Basic/Prefabs/BasicNoteTap3D.prefab index 076d6a4e..b3d75dc4 100644 --- a/Assets/ThemeBundles/Basic/Prefabs/BasicNoteTap3D.prefab +++ b/Assets/ThemeBundles/Basic/Prefabs/BasicNoteTap3D.prefab @@ -145,7 +145,7 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + - {fileID: 2100000, guid: b39306d2c39754d0aafabe8570b8e640, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 @@ -538,6 +538,7 @@ MonoBehaviour: Data: elementName: serialNumber: 0 + tags: [] parentElement: {fileID: 0} childElementList: [] themeBundleName: basic diff --git a/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteBadExpand.cs b/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteBadExpand.cs new file mode 100644 index 00000000..9512668d --- /dev/null +++ b/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteBadExpand.cs @@ -0,0 +1,54 @@ +using System.Collections; +using System.Collections.Generic; +using DG.Tweening; +using UnityEngine; + +namespace Ichni.RhythmGame.ThemeBundles.Basic +{ + public class BasicNoteBadExpand : NoteEffectBase + { + Renderer noteMainRenderer; + public BasicNoteBadExpand(NoteBase note) + { + this.note = note; + this.noteVisual = note.noteVisual.GetComponent(); + this.noteMainRenderer = noteVisual.noteMain.GetComponent(); + } + + public override void Recover() + { + noteVisual.noteMain.SetActive(true); + noteVisual.noteMain.transform.localScale = Vector3.one; + noteMainRenderer.material.SetColor("_BaseColor", Color.white); + } + + public override void Adjust() + { + noteMainRenderer.material.DOColor(Color.clear, 0.2f).SetEase(Ease.OutQuad); + noteVisual.noteMain.transform.DOScale(Vector3.one * 1.5f, 0.2f).SetEase(Ease.OutQuad).OnComplete(() => noteVisual.noteMain.SetActive(false)); + } + + public override EffectState CheckEffectState() + { + float songTime = EditorManager.instance.songModule.songTime; + + if (songTime < note.exactJudgeTime ) + { + return EffectState.Before; + } + + if (songTime >= note.exactJudgeTime && + songTime <= note.exactJudgeTime + effectTime) + { + return EffectState.Middle; + } + + if (songTime > note.exactJudgeTime + effectTime) + { + return EffectState.After; + } + + return EffectState.Error; + } + } +} \ No newline at end of file diff --git a/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteBadExpand.cs.meta b/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteBadExpand.cs.meta new file mode 100644 index 00000000..2c1f9d10 --- /dev/null +++ b/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteBadExpand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f3670b926c29e45e5b059ab5ae013d6a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteGoodBurst.cs b/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteGoodBurst.cs new file mode 100644 index 00000000..6082c9fd --- /dev/null +++ b/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteGoodBurst.cs @@ -0,0 +1,58 @@ +using System.Collections; +using System.Collections.Generic; +using DG.Tweening; +using UnityEngine; + +namespace Ichni.RhythmGame.ThemeBundles.Basic +{ + public class BasicNoteGoodBurst : NoteEffectBase + { + private GameObject effectRing; + + public BasicNoteGoodBurst(NoteBase note) + { + this.note = note; + this.noteVisual = note.noteVisual.GetComponent(); + this.effectRing = noteVisual.effectPartList[0]; + } + + public override void Recover() + { + effectRing.SetActive(false); + effectRing.transform.localScale = Vector3.zero; + effectRing.GetComponent().color = Color.white; + noteVisual.noteMain.SetActive(true); + } + + public override void Adjust() + { + effectRing.gameObject.SetActive(true); + effectRing.transform.DOScale(Vector3.one * 0.5f, 0.1f).SetEase(Ease.OutQuad); + effectRing.GetComponent().DOFade(0, 0.1f).SetEase(Ease.OutQuad).OnComplete(() => effectRing.SetActive(false)); + noteVisual.noteMain.SetActive(false); + } + + public override EffectState CheckEffectState() + { + float songTime = EditorManager.instance.songModule.songTime; + + if (songTime < note.exactJudgeTime ) + { + return EffectState.Before; + } + + if (songTime >= note.exactJudgeTime && + songTime <= note.exactJudgeTime + effectTime) + { + return EffectState.Middle; + } + + if (songTime > note.exactJudgeTime + effectTime) + { + return EffectState.After; + } + + return EffectState.Error; + } + } +} \ No newline at end of file diff --git a/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteGoodBurst.cs.meta b/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteGoodBurst.cs.meta new file mode 100644 index 00000000..7ad0007d --- /dev/null +++ b/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteGoodBurst.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 01c52632ad5b643f58504f3b8294d253 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteMissPale.cs b/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteMissPale.cs new file mode 100644 index 00000000..8d4c3ac3 --- /dev/null +++ b/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteMissPale.cs @@ -0,0 +1,55 @@ +using System.Collections; +using System.Collections.Generic; +using DG.Tweening; +using UnityEngine; + +namespace Ichni.RhythmGame.ThemeBundles.Basic +{ + public class BasicNoteMissPale : NoteEffectBase + { + Renderer noteMainRenderer; + + public BasicNoteMissPale(NoteBase note) + { + this.note = note; + this.noteVisual = note.noteVisual.GetComponent(); + this.noteMainRenderer = noteVisual.noteMain.GetComponent(); + } + + public override void Recover() + { + noteVisual.noteMain.SetActive(true); + noteMainRenderer.material.SetColor("_BaseColor", Color.white); + } + + public override void Adjust() + { + noteVisual.noteMain.SetActive(true); + noteMainRenderer.material.SetColor("_BaseColor", Color.white / 2f); + noteMainRenderer.material.DOColor(Color.clear, 0.2f).SetEase(Ease.OutQuad); + } + + public override EffectState CheckEffectState() + { + float songTime = EditorManager.instance.songModule.songTime; + + if (songTime < note.exactJudgeTime ) + { + return EffectState.Before; + } + + if (songTime >= note.exactJudgeTime && + songTime <= note.exactJudgeTime + effectTime) + { + return EffectState.Middle; + } + + if (songTime > note.exactJudgeTime + effectTime) + { + return EffectState.After; + } + + return EffectState.Error; + } + } +} \ No newline at end of file diff --git a/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteMissPale.cs.meta b/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteMissPale.cs.meta new file mode 100644 index 00000000..92c04ed6 --- /dev/null +++ b/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteMissPale.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 403dbcfe52a994428a72e2d7dbc2bb50 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNotePerfectBurst.cs b/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNotePerfectBurst.cs index cfa1f1ce..03515432 100644 --- a/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNotePerfectBurst.cs +++ b/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNotePerfectBurst.cs @@ -27,8 +27,8 @@ namespace Ichni.RhythmGame.ThemeBundles.Basic public override void Adjust() { effectRing.gameObject.SetActive(true); - effectRing.transform.DOScale(Vector3.one, 0.1f).SetEase(Ease.OutBack); - effectRing.GetComponent().DOFade(0, 0.1f).SetEase(Ease.OutBack).OnComplete(() => effectRing.SetActive(false)); + effectRing.transform.DOScale(Vector3.one, 0.1f).SetEase(Ease.OutQuad); + effectRing.GetComponent().DOFade(0, 0.1f).SetEase(Ease.OutQuad).OnComplete(() => effectRing.SetActive(false)); noteVisual.noteMain.SetActive(false); } diff --git a/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteVisual.cs b/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteVisual.cs index b5dac991..c8923688 100644 --- a/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteVisual.cs +++ b/Assets/ThemeBundles/Basic/Scripts/NoteVisual/BasicNoteVisual.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using Lean.Pool; @@ -7,12 +8,12 @@ namespace Ichni.RhythmGame.ThemeBundles.Basic { public class BasicNoteVisual : NoteVisualBase { - public new static BasicNoteVisual GenerateElement(string elementName, string themeBundleName, - string objectName, Vector3 position, Vector3 eulerAngles, Vector3 scale, BaseElement parent, - bool isFirstGenerated = true) + public new static BasicNoteVisual GenerateElement(string elementName, Guid id, List tags, + string themeBundleName, string objectName, + Vector3 position, Vector3 eulerAngles, Vector3 scale, BaseElement parent, bool isFirstGenerated = true) { BasicNoteVisual noteVisual = SubstantialObject - .GenerateElement(elementName, themeBundleName, objectName, position, eulerAngles, scale, parent, isFirstGenerated) + .GenerateElement(elementName, id, tags, themeBundleName, objectName, position, eulerAngles, scale, parent, isFirstGenerated) .GetComponent(); NoteBase note = parent as NoteBase; @@ -24,6 +25,9 @@ namespace Ichni.RhythmGame.ThemeBundles.Basic { note.generateEffects.effectList.Add(new BasicNoteGenerateExpand(noteVisual.note)); note.perfectJudgeEffects.effectList.Add(new BasicNotePerfectBurst(noteVisual.note)); + note.goodJudgeEffects.effectList.Add(new BasicNoteGoodBurst(noteVisual.note)); + note.badJudgeEffects.effectList.Add(new BasicNoteBadExpand(noteVisual.note)); + note.missJudgeEffects.effectList.Add(new BasicNoteMissPale(noteVisual.note)); } return noteVisual;