correctly position enemies and obstacles in a cubic funnel

This commit is contained in:
Cat Flynn 2021-01-11 02:13:03 +00:00
parent 047dda4139
commit 73d3a6bfc2
32 changed files with 800 additions and 67 deletions

View File

@ -12,7 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c271cfa846431634db54fa41238b7b35, type: 3} m_Script: {fileID: 11500000, guid: c271cfa846431634db54fa41238b7b35, type: 3}
m_Name: Accessibility Options m_Name: Accessibility Options
m_EditorClassIdentifier: m_EditorClassIdentifier:
_mode: 1 _mode: 2
_calm: _calm:
_value: 0 _value: 0
_tunnel: {fileID: 2100000, guid: 439b4d6018bd23e4e91136d099c5b815, type: 2} _tunnel: {fileID: 2100000, guid: 439b4d6018bd23e4e91136d099c5b815, type: 2}

View File

@ -0,0 +1,16 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
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: d86361ffc5ae478d9e976629c5d651bd, type: 3}
m_Name: Base Tube Radius
m_EditorClassIdentifier:
_initialValue: 12
_readOnly: 1

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 728cb7e2ba632ed488575b477d23545b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -10,7 +10,7 @@ MonoBehaviour:
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d86361ffc5ae478d9e976629c5d651bd, type: 3} m_Script: {fileID: 11500000, guid: d86361ffc5ae478d9e976629c5d651bd, type: 3}
m_Name: HorizontalInput m_Name: XInput
m_EditorClassIdentifier: m_EditorClassIdentifier:
_initialValue: 0 _initialValue: 0
_readOnly: 0 _readOnly: 0

View File

@ -10,7 +10,7 @@ MonoBehaviour:
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d86361ffc5ae478d9e976629c5d651bd, type: 3} m_Script: {fileID: 11500000, guid: d86361ffc5ae478d9e976629c5d651bd, type: 3}
m_Name: HorizontalPosition m_Name: XPosition
m_EditorClassIdentifier: m_EditorClassIdentifier:
_initialValue: 0 _initialValue: 0
_readOnly: 0 _readOnly: 0

View File

@ -0,0 +1,16 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
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: d86361ffc5ae478d9e976629c5d651bd, type: 3}
m_Name: ZPosition
m_EditorClassIdentifier:
_initialValue: 0
_readOnly: 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d79a67f8d31402543bdbc2c3fdf3e53d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -21,7 +21,7 @@ Material:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: Bullet m_Name: Bullet
m_Shader: {fileID: 4800000, guid: 3fbfd755d973879408e445fecb08c7ae, type: 3} m_Shader: {fileID: 4800000, guid: ef0b3230706b9ff44b7a6246f9feac63, type: 3}
m_ShaderKeywords: m_ShaderKeywords:
m_LightmapFlags: 4 m_LightmapFlags: 4
m_EnableInstancingVariants: 0 m_EnableInstancingVariants: 0
@ -109,27 +109,31 @@ Material:
- _GlossMapScale: 0 - _GlossMapScale: 0
- _Glossiness: 0 - _Glossiness: 0
- _GlossyReflections: 0 - _GlossyReflections: 0
- _HorizontalScale: 0.1
- _M: 0.5 - _M: 0.5
- _Metallic: 0 - _Metallic: 0
- _OcclusionStrength: 1 - _OcclusionStrength: 1
- _Parallax: 0.005 - _Parallax: 0.005
- _PulseIntensity: 1 - _PulseIntensity: 1
- _QueueOffset: 0 - _QueueOffset: 0
- _RadiusWithDistance: 0.00005
- _ReceiveShadows: 1 - _ReceiveShadows: 1
- _SampleGI: 0 - _SampleGI: 0
- _Smoothness: 0.5 - _Smoothness: 0.5
- _SmoothnessTextureChannel: 0 - _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1 - _SpecularHighlights: 1
- _SpeedMultiplier: 2
- _SrcBlend: 1 - _SrcBlend: 1
- _Surface: 0 - _Surface: 0
- _TrackWidth: 20 - _TrackWidth: 20
- _VerticalScale: 10
- _WorkflowMode: 1 - _WorkflowMode: 1
- _ZWrite: 1 - _ZWrite: 1
m_Colors: m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1} - _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1}
- _Color1: {r: 1, g: 1, b: 1, a: 1} - _Color1: {r: 7.5717225, g: 6.7708673, b: 13.90576, a: 1}
- _Color2: {r: 1, g: 1, b: 1, a: 1} - _Color2: {r: 0.24509804, g: 0.3764706, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FarColor: {r: 1, g: 1, b: 1, a: 1} - _FarColor: {r: 1, g: 1, b: 1, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}

View File

@ -13,7 +13,7 @@ Material:
m_LightmapFlags: 4 m_LightmapFlags: 4
m_EnableInstancingVariants: 0 m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0 m_DoubleSidedGI: 0
m_CustomRenderQueue: -1 m_CustomRenderQueue: 3000
stringTagMap: {} stringTagMap: {}
disabledShaderPasses: [] disabledShaderPasses: []
m_SavedProperties: m_SavedProperties:
@ -82,6 +82,7 @@ Material:
m_Floats: m_Floats:
- _Alpha: 1 - _Alpha: 1
- _AlphaClip: 0 - _AlphaClip: 0
- _BaseScale: 0.8
- _Blend: 0 - _Blend: 0
- _BumpScale: 1 - _BumpScale: 1
- _C: 0 - _C: 0
@ -96,29 +97,33 @@ Material:
- _GlossMapScale: 0 - _GlossMapScale: 0
- _Glossiness: 0 - _Glossiness: 0
- _GlossyReflections: 0 - _GlossyReflections: 0
- _HorizontalScale: 0.1
- _M: 0.1 - _M: 0.1
- _Metallic: 0 - _Metallic: 0
- _OcclusionStrength: 1 - _OcclusionStrength: 1
- _Parallax: 0.005 - _Parallax: 0.005
- _PulseIntensity: 0.5 - _PulseIntensity: 0.5
- _QueueOffset: 0 - _QueueOffset: 0
- _RadiusWithDistance: 0.00005
- _ReceiveShadows: 1 - _ReceiveShadows: 1
- _Smoothness: 0.5 - _Smoothness: 0.5
- _SmoothnessTextureChannel: 0 - _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1 - _SpecularHighlights: 1
- _SpeedMultiplier: 3
- _SrcBlend: 1 - _SrcBlend: 1
- _Surface: 0 - _Surface: 0
- _TrackWidth: 20 - _TrackWidth: 20
- _VertexDistortion: 0.1 - _VertexDistortion: 0.1
- _VerticalScale: 10
- _WorkflowMode: 1 - _WorkflowMode: 1
- _ZWrite: 1 - _ZWrite: 1
m_Colors: m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1} - _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1}
- _Color1: {r: 0, g: 0.7880776, b: 1, a: 1} - _Color1: {r: 1, g: 0, b: 0.009225845, a: 1}
- _Color2: {r: 0, g: 0.9716981, b: 0.014814194, a: 1} - _Color2: {r: 0, g: 1, b: 0.9568691, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FarColor: {r: 0.8784709, g: 0, b: 1, a: 1} - _FarColor: {r: 0, g: 0.06666667, b: 0.006862745, a: 0}
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} - _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_BuildTextureStacks: [] m_BuildTextureStacks: []
--- !u!114 &1271807303275379478 --- !u!114 &1271807303275379478

View File

@ -0,0 +1,140 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Obstacle
m_Shader: {fileID: 4800000, guid: 283f3c94cc5a452448291c9d05edafee, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
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}
- _NoiseMap:
m_Texture: {fileID: 2800000, guid: 32d99a4d1161f0f4ca4fca2997778b37, type: 3}
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_Floats:
- _Alpha: 1
- _AlphaClip: 0
- _BaseScale: 1
- _Blend: 0
- _BumpScale: 1
- _C: 0
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _HorizontalScale: 0.1
- _M: 0.5
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _PulseIntensity: 1
- _QueueOffset: 0
- _RadiusWithDistance: 0.00005
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SpeedMultiplier: 3
- _SrcBlend: 1
- _Surface: 0
- _TrackWidth: 20
- _VerticalScale: 10
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Color1: {r: 1, g: 1, b: 1, a: 1}
- _Color2: {r: 1, g: 0, b: 0.048927307, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FarColor: {r: 0.24528301, g: 0, b: 0, a: 0}
- _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
m_BuildTextureStacks: []
--- !u!114 &2390192396215248314
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: 4

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5432517a431c50a468262c8b1ee28cb2
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -160,7 +160,7 @@ Material:
- _CircleColor: {r: 1, g: 1, b: 1, a: 1} - _CircleColor: {r: 1, g: 1, b: 1, a: 1}
- _CloudColor: {r: 0, g: 0, b: 0, a: 0} - _CloudColor: {r: 0, g: 0, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1}
- _CoreColor: {r: 1, g: 1, b: 1, a: 1} - _CoreColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _FractalColor: {r: 0, g: 0, b: 0, a: 1} - _FractalColor: {r: 0, g: 0, b: 0, a: 1}
- _GroundColor: {r: 0.84060663, g: 1.1600372, b: 2.5218198, a: 1} - _GroundColor: {r: 0.84060663, g: 1.1600372, b: 2.5218198, a: 1}

View File

@ -109,7 +109,7 @@ Material:
- _ClearCoatSmoothness: 0 - _ClearCoatSmoothness: 0
- _CoreRadius: 0.025 - _CoreRadius: 0.025
- _CoreThiccness: 0.5 - _CoreThiccness: 0.5
- _CoreYOffset: -0.03 - _CoreYOffset: 0.28
- _Cull: 2 - _Cull: 2
- _Cutoff: 0.5 - _Cutoff: 0.5
- _DetailAlbedoMapScale: 1 - _DetailAlbedoMapScale: 1

View File

@ -109,7 +109,7 @@ Material:
- _ClearCoatSmoothness: 0 - _ClearCoatSmoothness: 0
- _CoreRadius: 0.01 - _CoreRadius: 0.01
- _CoreThiccness: 0.15 - _CoreThiccness: 0.15
- _CoreYOffset: -0.03 - _CoreYOffset: 0.28
- _Cull: 2 - _Cull: 2
- _Cutoff: 0.5 - _Cutoff: 0.5
- _DetailAlbedoMapScale: 1 - _DetailAlbedoMapScale: 1

BIN
Assets/Models/obstacle.blend (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,102 @@
fileFormatVersion: 2
guid: 8841a2ba305fe8243a19cb4bc43c2d60
ModelImporter:
serializedVersion: 20200
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
fileIdsGeneration: 2
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -10,6 +10,7 @@ public class MovePlayer : MonoBehaviour
[SerializeField] private float lerpAmount = 0.95f; [SerializeField] private float lerpAmount = 0.95f;
[SerializeField] private SerialFloat horizontalInput; [SerializeField] private SerialFloat horizontalInput;
[SerializeField] private SerialFloat horizontalPosition; [SerializeField] private SerialFloat horizontalPosition;
[SerializeField] private SerialFloat zPosition;
private PlayerInput _input; private PlayerInput _input;
@ -67,6 +68,7 @@ public class MovePlayer : MonoBehaviour
horizontalInput.Value = _currentInput.x; horizontalInput.Value = _currentInput.x;
horizontalPosition.Value = _transform.localPosition.x; horizontalPosition.Value = _transform.localPosition.x;
zPosition.Value = transform.position.z;
} }
private void DoMove(InputAction.CallbackContext context) private void DoMove(InputAction.CallbackContext context)

View File

@ -27,7 +27,7 @@ Transform:
m_GameObject: {fileID: 1738226812227614583} m_GameObject: {fileID: 1738226812227614583}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 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: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 0.5, y: 0.5, z: 0.5}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0

View File

@ -60,7 +60,7 @@ MeshRenderer:
m_RenderingLayerMask: 1 m_RenderingLayerMask: 1
m_RendererPriority: 0 m_RendererPriority: 0
m_Materials: m_Materials:
- {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 2100000, guid: 5432517a431c50a468262c8b1ee28cb2, type: 2}
m_StaticBatchInfo: m_StaticBatchInfo:
firstSubMesh: 0 firstSubMesh: 0
subMeshCount: 0 subMeshCount: 0

View File

@ -234,7 +234,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 186457103} m_GameObject: {fileID: 186457103}
m_LocalRotation: {x: -0, y: 1, z: -0, w: 0} m_LocalRotation: {x: -0, y: 1, z: -0, w: 0}
m_LocalPosition: {x: 0, y: -2, z: 200} m_LocalPosition: {x: 0, y: 0, z: 200}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
@ -274,9 +274,12 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4f8399031f014bee928b07d26fe8ee4c, type: 3} m_Script: {fileID: 11500000, guid: 4f8399031f014bee928b07d26fe8ee4c, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
spawnOnBeat: 1 onBarBeats: 000000000100000002000000
beatWait: 4
xMin: -10 xMin: -10
xMax: 10 xMax: 10
_playerXPosition: {fileID: 11400000, guid: 25280515e18c66c44827faf0cb01ca42, type: 2}
_playerZPosition: {fileID: 11400000, guid: d79a67f8d31402543bdbc2c3fdf3e53d, type: 2}
--- !u!114 &531937975 stripped --- !u!114 &531937975 stripped
MonoBehaviour: MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5076175860835241000, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} m_CorrespondingSourceObject: {fileID: 5076175860835241000, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
@ -318,9 +321,12 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4f8399031f014bee928b07d26fe8ee4c, type: 3} m_Script: {fileID: 11500000, guid: 4f8399031f014bee928b07d26fe8ee4c, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
spawnOnBeat: 1 onBarBeats: 03000000
beatWait: 4
xMin: -10 xMin: -10
xMax: 10 xMax: 10
_playerXPosition: {fileID: 11400000, guid: 25280515e18c66c44827faf0cb01ca42, type: 2}
_playerZPosition: {fileID: 11400000, guid: d79a67f8d31402543bdbc2c3fdf3e53d, type: 2}
--- !u!114 &532372217 --- !u!114 &532372217
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -351,7 +357,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 532372215} m_GameObject: {fileID: 532372215}
m_LocalRotation: {x: -0, y: 1, z: -0, w: 0} m_LocalRotation: {x: -0, y: 1, z: -0, w: 0}
m_LocalPosition: {x: 0, y: -2, z: 200} m_LocalPosition: {x: 0, y: 0, z: 200}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
@ -707,21 +713,29 @@ PrefabInstance:
propertyPath: m_RenderPostProcessing propertyPath: m_RenderPostProcessing
value: 1 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3397488660425852637, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalPosition.y
value: -8.773619
objectReference: {fileID: 0}
- target: {fileID: 3397488660425852637, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalPosition.z
value: -52.2639
objectReference: {fileID: 0}
- target: {fileID: 3397488660425852637, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalRotation.x
value: -0.0000003837049
objectReference: {fileID: 0}
- target: {fileID: 3397488660571973483, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} - target: {fileID: 3397488660571973483, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_RenderPostProcessing propertyPath: m_RenderPostProcessing
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3397488660842926088, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 9429becea685bce4fa7b6595601ea615, type: 2}
- target: {fileID: 3397488660842926092, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} - target: {fileID: 3397488660842926092, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_IsActive propertyPath: m_IsActive
value: 1 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3397488660842926093, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} - target: {fileID: 3397488660842926093, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalScale.x propertyPath: m_LocalScale.x
value: 1850.4741 value: 1492.1846
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3397488660842926093, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} - target: {fileID: 3397488660842926093, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalScale.y propertyPath: m_LocalScale.y
@ -733,12 +747,16 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3397488660842926093, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} - target: {fileID: 3397488660842926093, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
value: -8.773619 value: -8.773621
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3397488660842926093, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} - target: {fileID: 3397488660842926093, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: 846.83606 value: 846.83606
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3397488660842926093, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalRotation.x
value: 0.000000346452
objectReference: {fileID: 0}
- target: {fileID: 3397488660859550700, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} - target: {fileID: 3397488660859550700, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: Rendering value: Rendering
@ -753,7 +771,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3397488660859550701, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} - target: {fileID: 3397488660859550701, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
value: 8.773619 value: 10.53
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3397488660859550701, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} - target: {fileID: 3397488660859550701, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
@ -761,11 +779,11 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3397488660859550701, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} - target: {fileID: 3397488660859550701, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalRotation.w propertyPath: m_LocalRotation.w
value: 1 value: 0.9988734
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3397488660859550701, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} - target: {fileID: 3397488660859550701, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
value: 0 value: 0.047455154
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3397488660859550701, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} - target: {fileID: 3397488660859550701, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalRotation.y propertyPath: m_LocalRotation.y
@ -777,7 +795,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3397488660859550701, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} - target: {fileID: 3397488660859550701, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalEulerAnglesHint.x propertyPath: m_LocalEulerAnglesHint.x
value: 0 value: 5.44
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3397488660859550701, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} - target: {fileID: 3397488660859550701, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalEulerAnglesHint.y propertyPath: m_LocalEulerAnglesHint.y
@ -791,6 +809,22 @@ PrefabInstance:
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: -100 value: -100
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4264314760911572847, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalScale.x
value: 1492.1846
objectReference: {fileID: 0}
- target: {fileID: 4264314760911572847, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalPosition.y
value: -8.773621
objectReference: {fileID: 0}
- target: {fileID: 4264314760911572847, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalPosition.z
value: 846.83606
objectReference: {fileID: 0}
- target: {fileID: 4264314760911572847, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalRotation.x
value: 0.000000346452
objectReference: {fileID: 0}
- target: {fileID: 5076175860835241000, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} - target: {fileID: 5076175860835241000, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: _playerXPos propertyPath: _playerXPos
value: value:
@ -799,6 +833,10 @@ PrefabInstance:
propertyPath: _playerXMove propertyPath: _playerXMove
value: value:
objectReference: {fileID: 11400000, guid: 7371e84b7c82f4631a96ac1c00b55fa0, type: 2} objectReference: {fileID: 11400000, guid: 7371e84b7c82f4631a96ac1c00b55fa0, type: 2}
- target: {fileID: 5076175860835241000, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: _baseTubeRadius
value:
objectReference: {fileID: 11400000, guid: 728cb7e2ba632ed488575b477d23545b, type: 2}
- target: {fileID: 5076175860835241000, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} - target: {fileID: 5076175860835241000, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: _anim.m_Curve.Array.size propertyPath: _anim.m_Curve.Array.size
value: 3 value: 3
@ -847,6 +885,22 @@ PrefabInstance:
propertyPath: _anim.m_Curve.Array.data[1].outWeight propertyPath: _anim.m_Curve.Array.data[1].outWeight
value: 0.09022057 value: 0.09022057
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7294003040346186954, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalScale.x
value: 1492.1846
objectReference: {fileID: 0}
- target: {fileID: 7294003040346186954, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalPosition.y
value: -8.773621
objectReference: {fileID: 0}
- target: {fileID: 7294003040346186954, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalPosition.z
value: 846.83606
objectReference: {fileID: 0}
- target: {fileID: 7294003040346186954, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
propertyPath: m_LocalRotation.x
value: 0.000000346452
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 1f82f952c53fc7449a0091cf29ba3def, type: 3}
--- !u!1 &1173812004 --- !u!1 &1173812004
@ -950,7 +1004,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1173812004} m_GameObject: {fileID: 1173812004}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: -4, z: 6} m_LocalPosition: {x: 0, y: 0, z: 6}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 1639649351} - {fileID: 1639649351}
@ -982,6 +1036,7 @@ MonoBehaviour:
lerpAmount: 0.95 lerpAmount: 0.95
horizontalInput: {fileID: 11400000, guid: 7371e84b7c82f4631a96ac1c00b55fa0, type: 2} horizontalInput: {fileID: 11400000, guid: 7371e84b7c82f4631a96ac1c00b55fa0, type: 2}
horizontalPosition: {fileID: 11400000, guid: 25280515e18c66c44827faf0cb01ca42, type: 2} horizontalPosition: {fileID: 11400000, guid: 25280515e18c66c44827faf0cb01ca42, type: 2}
zPosition: {fileID: 11400000, guid: d79a67f8d31402543bdbc2c3fdf3e53d, type: 2}
--- !u!114 &1173812010 --- !u!114 &1173812010
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1087,7 +1142,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1215971662} m_GameObject: {fileID: 1215971662}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: -2, z: 30} m_LocalPosition: {x: 0, y: 0, z: 30}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}

View File

@ -16,11 +16,11 @@ MonoBehaviour:
m_AdvancedMode: 0 m_AdvancedMode: 0
threshold: threshold:
m_OverrideState: 1 m_OverrideState: 1
m_Value: 3 m_Value: 1
min: 0 min: 0
intensity: intensity:
m_OverrideState: 1 m_OverrideState: 1
m_Value: 4 m_Value: 0.5
min: 0 min: 0
scatter: scatter:
m_OverrideState: 0 m_OverrideState: 0

View File

@ -1,14 +1,20 @@
using System; using System;
using Ktyl.Util;
using UnityEngine; using UnityEngine;
using UnityEngine.Scripting; using UnityEngine.Scripting;
using Random = UnityEngine.Random; using Random = UnityEngine.Random;
public class BeatSpawner : ShootInputBase public class BeatSpawner : ShootInputBase
{ {
[SerializeField] private int spawnOnBeat = 2; [SerializeField] private int[] onBarBeats;
[SerializeField] private int beatWait;
[SerializeField] private float xMin = -10; [SerializeField] private float xMin = -10;
[SerializeField] private float xMax = 10; [SerializeField] private float xMax = 10;
[SerializeField] private SerialFloat _playerXPosition;
[SerializeField] private SerialFloat _playerZPosition;
private AudioBeatManager _audio; private AudioBeatManager _audio;
private bool _shoot; private bool _shoot;
@ -20,9 +26,20 @@ public class BeatSpawner : ShootInputBase
public void OnBeat(int beat) public void OnBeat(int beat)
{ {
_shoot = beat % spawnOnBeat == 0; _shoot = false;
for (int i = 0; i < onBarBeats.Length; i++)
{
var barBeat = onBarBeats[i];
_shoot = (beat + barBeat) % beatWait == 0;
if (_shoot) break;
}
if (_shoot) if (_shoot)
transform.position = new Vector3(Mathf.Lerp(xMin, xMax, Mathf.Sin(beat)), transform.position.y, transform.position.z); transform.position = new Vector3(Mathf.Lerp(xMin, xMax, Mathf.Sin(beat)), transform.position.y, transform.position.z);
// var playerPosition = Vector3.right * _playerXPosition;
// Vector3.forward * _playerZPosition;
// transform.LookAt(playerPosition);
} }
public override bool IsShooting() public override bool IsShooting()

View File

@ -1,3 +1,4 @@
using System.Net.Http;
using DG.Tweening; using DG.Tweening;
using UnityEngine; using UnityEngine;
using Weapons.Scripts; using Weapons.Scripts;
@ -46,24 +47,22 @@ public class DisableOnDeath : MonoBehaviour
var oldName = gameObject.name; var oldName = gameObject.name;
gameObject.name = "disabled"; gameObject.name = "disabled";
_collider.enabled = false; _collider.enabled = false;
float duration = 0.4f;
float x = 0; float x = 0;
DOTween.To( DOTween.To(
() => x, () => x,
t => t =>
{ {
var c1 = Color.Lerp(_color1, Color.white, t); var c1 = Color.Lerp(_color1, Color.white*1000f, 1f-t);
var c2 = Color.Lerp(_color2, Color.white, t); var c2 = Color.Lerp(_color2, Color.white*1000f, 1f-t);
_renderer.material.SetColor(Color1, c1); _renderer.material.SetColor(Color1, c1);
_renderer.material.SetColor(Color2, c2);
_renderer.material.SetFloat(Alpha, 1.0f-t);
}, },
1.0f, 1.0f,
0.05f); duration);
transform.DOScale(Vector3.one * 3.0f, duration).SetEase(Ease.OutQuint).OnComplete(() =>
transform.DOScale(Vector3.one * 1.5f, 0.15f).SetEase(Ease.OutQuint).OnComplete(() =>
{ {
gameObject.name = oldName; gameObject.name = oldName;
gameObject.SetActive(false); gameObject.SetActive(false);

View File

@ -61,6 +61,7 @@ Shader "custom/bullet"
float _Alpha; float _Alpha;
float _PulseIntensity; float _PulseIntensity;
float _BaseTubeRadius;
// float _VertexScale; // float _VertexScale;
// float _FadeStrength; // float _FadeStrength;

View File

@ -15,6 +15,10 @@ Shader "custom/enemy"
// _VertexScale("Vertex Scale", Float) = 0 // _VertexScale("Vertex Scale", Float) = 0
_PulseIntensity("Pulse Intensity", Float) = 1.0 _PulseIntensity("Pulse Intensity", Float) = 1.0
_TrackWidth("Track Width", Float) = 20 _TrackWidth("Track Width", Float) = 20
_RadiusWithDistance("Radius with Distance", Float) = 0.003
_SpeedMultiplier("Speed Multiplier", Float) = 2.0
_BaseScale("Base Scale", Float) = 1.0
_M("M", Float) = 0.5 _M("M", Float) = 0.5
_C("C", Float) = 0.0 _C("C", Float) = 0.0
@ -28,6 +32,9 @@ Shader "custom/enemy"
Pass Pass
{ {
// Blend OneMinusDstColor OneMinusSrcAlpha
// Blend SrcAlpha
HLSLPROGRAM HLSLPROGRAM
#pragma vertex vert #pragma vertex vert
#pragma fragment frag #pragma fragment frag
@ -51,6 +58,7 @@ Shader "custom/enemy"
float2 uv : TEXCOORD0; float2 uv : TEXCOORD0;
float3 wpos : TEXCOORD1; float3 wpos : TEXCOORD1;
half3 normal : NORMAL; half3 normal : NORMAL;
float2 polar : TEXCOORD2; // TODO!!
}; };
float _M = 0.5; float _M = 0.5;
@ -61,11 +69,18 @@ Shader "custom/enemy"
float _Alpha; float _Alpha;
float _PulseIntensity; float _PulseIntensity;
float _SpeedMultiplier;
float _RadiusWithDistance;
float _TrackWidth; float _TrackWidth;
float _PlayerXPos; float _PlayerXPos;
float _DistanceToNextBeat; float _DistanceToNextBeat;
float _DistanceFromLastBeat; float _DistanceSinceLastBeat;
float _BaseScale;
float _BaseTubeRadius;
// float _VertexScale; // float _VertexScale;
// float _FadeStrength; // float _FadeStrength;
@ -85,17 +100,40 @@ Shader "custom/enemy"
float4 _NoiseMap_ST; float4 _NoiseMap_ST;
CBUFFER_END CBUFFER_END
Varyings vert(Attributes IN) Varyings vert(Attributes IN)
{ {
Varyings OUT; Varyings OUT;
float radius = _BaseTubeRadius;
float d = _TrackWidth;
float3 vpos = IN.positionOS.xyz; float3 vpos = IN.positionOS.xyz;
vpos*=2;
OUT.normal = IN.normal; OUT.normal = IN.normal;
float beat = _DistanceToNextBeat*_DistanceToNextBeat; // position of the model's origin in world space
vpos *= 1.0+beat*_PulseIntensity; float3 mo_wpos = TransformObjectToWorld(float3(0,0,0));
vpos.x *= 0.3; float db = _DistanceSinceLastBeat;
float beat = db*db;
vpos *= _BaseScale+beat*_PulseIntensity;
// float3 wpos = TransformObjectToWorld(vpos);
float wpz = mo_wpos.z;
float r = length(radius) + wpz*wpz*wpz*_RadiusWithDistance;
// compress horiztonally
// vpos.x = vpos.x * _HorizontalScale;
// vpos.y = vpos.y * _VerticalScale * 1.0-(r-radius);
// vpos = mul(UNITY_MATRIX_P,
// mul(UNITY_MATRIX_MV, float4(0,0,0,1))
// + float4(vpos.x, vpos.y, 0,0)
// + float4(1, 1,1,1));
// recalculate wpos with updated vpos
// wpos = TransformObjectToWorld(vpos);
// matrix m = GetObjectToWorldMatrix();
//float d = 1.0+length(wpos)*0.5; //float d = 1.0+length(wpos)*0.5;
//float2 uv = wpos.zx; //float2 uv = wpos.zx;
@ -108,22 +146,40 @@ Shader "custom/enemy"
// float3 owpos = TransformObjectToWorld(float3(0,0,0)); // float3 owpos = TransformObjectToWorld(float3(0,0,0));
// calculate position on circle // calculate position on circle
float3 wpos = TransformObjectToWorld(vpos);
float radius = 4.0;
float d = _TrackWidth;
float r = radius - vpos.y * 0.5; // float3 object_origin = TransformObjectToWorld(float3(0,0,0));
float x = wpos.x; // float r_origin = float
// float wpz = abs(mo_wpos.z-6); // offset due to player position
// // wpz *= wpz;
// r += wpz*_RadiusWithDistance;
// mo_wpos.z *= _SpeedMultiplier;
float x = mo_wpos;
// float x = mo_wpos.x+vpos.x;
x -= _PlayerXPos; x -= _PlayerXPos;
// x += 0.5*PI; // x += 0.5*PI;
float a = 2*PI*(x/d + 0.5); float a = 2*PI*(x/d);
a += 0.5*PI; a -= 0.5*PI;
// a *= (radius - r) * -1.0; // a *= (radius - r) * -1.0;
// vpos.y += 0.5*radius*cos(a);
float3 wpos = float3(cos(a)*r,sin(a)*r,mo_wpos.z);
wpos = float3(cos(a)*r,sin(a)*r,wpos.z); float x_p = vpos.x*cos(a)-vpos.y*sin(a);
float y_p = vpos.x*sin(a)+vpos.y*cos(a);
vpos.x = x_p;
vpos.y = y_p;
float noise1 = SAMPLE_TEXTURE2D_LOD(_NoiseMap, sampler_NoiseMap, wpos.yz, 0) - 0.5;
float noise2 = SAMPLE_TEXTURE2D_LOD(_NoiseMap, sampler_NoiseMap, wpos.xy, 0) - 0.5;
wpos += float3(noise1, noise2, 0) * 2.0;
wpos += float3(vpos.xy,0);
wpos.y += radius;
wpos.z *= (_SpeedMultiplier+5*(_DistanceToNextBeat*_DistanceSinceLastBeat));
// wpos.z *= max(1, (wpos.z-6)* _SpeedMultiplier);
vpos = TransformWorldToObject(wpos); vpos = TransformWorldToObject(wpos);
// TransformWorldToObject() // TransformWorldToObject()
@ -156,8 +212,19 @@ Shader "custom/enemy"
// float t = length(p); // float t = length(p);
// return lerp(_Color1,_Color2,t * _FadeStrength); // return lerp(_Color1,_Color2,t * _FadeStrength);
float4 c = float4(lerp(_Color1, _Color2, t).xyz, _Alpha); float normalised = IN.wpos.z/1000.0;
c = lerp(c, _FarColor, IN.wpos.z * 0.0075); // float4 c = float4(lerp(_Color1, _Color2, t).xyz, _Alpha);
float4 c = _Color1;
c = lerp(_Color1, _Color2, length(p));
c = lerp(c, _FarColor, normalised);
// float distanceAhead = IN.wpos.z - 6;
// float ca = clamp(distanceAhead * 0.1,0,1);
// c.a = ca;
// c.a = clamp((IN.wpos.z-6)*1.0,0,1);
// c.a = clamp((1.0-IN.polar.r),0,1);
// c.a = clamp(1.0-normalised,0,1);
return c; return c;
} }

View File

@ -0,0 +1,270 @@
// This shader draws a texture on the mesh.
Shader "custom/obstacle"
{
// The _BaseMap variable is visible in the Material's Inspector, as a field
// called Base Map.
Properties
{
[HDR] _Color1("Color1", Color) = (1,1,1,1)
[HDR] _Color2("Color2", Color) = (1,1,1,1)
[HDR] _FarColor("Far Color", Color) = (1,1,1,1)
_Alpha("Alpha", Float) = 1.0
// [HDR] _Color2("Color 2", Color) = (1,1,1,1)
// _FadeStrength("Fade Strength", Float) = 0.1
// _VertexScale("Vertex Scale", Float) = 0
_PulseIntensity("Pulse Intensity", Float) = 1.0
_TrackWidth("Track Width", Float) = 20
_RadiusWithDistance("Radius with Distance", Float) = 0.003
_SpeedMultiplier("Speed Multiplier", Float) = 2.0
_HorizontalScale("Horizontal Scale", Float) = 0.1
_VerticalScale("Vertical Scale", Float) = 10
_M("M", Float) = 0.5
_C("C", Float) = 0.0
_NoiseMap("Noise Map", 2D) = "black"
}
SubShader
{
Tags { "RenderType" = "Opaque" "RenderPipeline" = "UniversalRenderPipeline" }
Pass
{
// Blend OneMinusDstColor OneMinusSrcAlpha
// Blend SrcAlpha
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
struct Attributes
{
float4 positionOS : POSITION;
// The uv variable contains the UV coordinate on the texture for the
// given vertex.
float2 uv : TEXCOORD0;
half3 normal : NORMAL;
};
struct Varyings
{
float4 positionHCS : SV_POSITION;
// The uv variable contains the UV coordinate on the texture for the
// given vertex.
float2 uv : TEXCOORD0;
float3 wpos : TEXCOORD1;
half3 normal : NORMAL;
float2 polar : TEXCOORD2; // TODO!!
};
float _M = 0.5;
float _C = 0.0;
float4 _Color1;
float4 _Color2;
float4 _FarColor;
float _Alpha;
float _PulseIntensity;
float _SpeedMultiplier;
float _RadiusWithDistance;
float _TrackWidth;
float _PlayerXPos;
float _DistanceToNextBeat;
float _DistanceSinceLastBeat;
float _HorizontalScale;
float _VerticalScale;
float _BaseTubeRadius;
// float _VertexScale;
// float _FadeStrength;
// This macro declares _BaseMap as a Texture2D object.
TEXTURE2D(_BaseMap);
// This macro declares the sampler for the _BaseMap texture.
SAMPLER(sampler_BaseMap);
TEXTURE2D(_NoiseMap);
SAMPLER(sampler_NoiseMap);
CBUFFER_START(UnityPerMaterial)
// The following line declares the _BaseMap_ST variable, so that you
// can use the _BaseMap variable in the fragment shader. The _ST
// suffix is necessary for the tiling and offset function to work.
float4 _BaseMap_ST;
float4 _NoiseMap_ST;
CBUFFER_END
//random hash
float4 hash42(float2 p) {
float4 p4 = frac(float4(p.xyxy) * float4(443.8975, 397.2973, 491.1871, 470.7827));
p4 += dot(p4.wzxy, p4 + 19.19);
return frac(float4(p4.x * p4.y, p4.x * p4.z, p4.y * p4.w, p4.x * p4.w));
}
float hash(float n) {
return frac(sin(n) * 43758.5453123);
}
float n(in float3 x) {
float3 p = floor(x);
float3 f = frac(x);
f = f * f * (3.0 - 2.0 * f);
float n = p.x + p.y * 57.0 + 113.0 * p.z;
float res = lerp(lerp(lerp(hash(n + 0.0), hash(n + 1.0), f.x),
lerp(hash(n + 57.0), hash(n + 58.0), f.x), f.y),
lerp(lerp(hash(n + 113.0), hash(n + 114.0), f.x),
lerp(hash(n + 170.0), hash(n + 171.0), f.x), f.y), f.z);
return res;
}
//tape noise
float tape_noise(float2 p) {
float y = p.y;
float s = _Time.x + 200;
float v = (n(float3(y * .01 + s, 1., 1.0)) + .0)
* (n(float3(y * .011 + 1000.0 + s, 1., 1.0)) + .0)
* (n(float3(y * .51 + 421.0 + s, 1., 1.0)) + .0)
;
v *= hash42(float2(p.x + _Time.y + 200, p.y)).x + 2;
v = abs(pow(v + .3, 1.));
if (v < .5) v = 0.; //threshold
return v;
}
Varyings vert(Attributes IN)
{
Varyings OUT;
float radius = _BaseTubeRadius;
float d = _TrackWidth;
float3 vpos = IN.positionOS.xyz;
vpos*=3;
OUT.normal = IN.normal;
// position of the model's origin in world space
float3 mo_wpos = TransformObjectToWorld(float3(0,0,0));
float beat = _DistanceToNextBeat*_DistanceToNextBeat;
vpos *= 1.0+beat*_PulseIntensity;
// float3 wpos = TransformObjectToWorld(vpos);
float wpz = mo_wpos.z;
float r = length(radius) + wpz*wpz*wpz*_RadiusWithDistance;
// compress horiztonally
// vpos.x = vpos.x * _HorizontalScale;
// vpos.y = vpos.y * _VerticalScale * 1.0-(r-radius);
// vpos = mul(UNITY_MATRIX_P,
// mul(UNITY_MATRIX_MV, float4(0,0,0,1))
// + float4(vpos.x, vpos.y, 0,0)
// + float4(1, 1,1,1));
// recalculate wpos with updated vpos
// wpos = TransformObjectToWorld(vpos);
// matrix m = GetObjectToWorldMatrix();
//float d = 1.0+length(wpos)*0.5;
//float2 uv = wpos.zx;
// vpos += _VertexScale*float3(0,0,5)*d;
// vpos += sin(180)*sin(1800)*float3(0,0,5)*d;
// noise *= d*d * 0.1;
// vpos *= lerp (0.9,1.1,noise);
// float3 owpos = TransformObjectToWorld(float3(0,0,0));
// calculate position on circle
// float3 object_origin = TransformObjectToWorld(float3(0,0,0));
// float r_origin = float
// float wpz = abs(mo_wpos.z-6); // offset due to player position
// // wpz *= wpz;
// r += wpz*_RadiusWithDistance;
// mo_wpos.z *= _SpeedMultiplier;
float x = mo_wpos;
// float x = mo_wpos.x+vpos.x;
x -= _PlayerXPos;
// x += 0.5*PI;
float a = 2*PI*(x/d);
a -= 0.5*PI;
// a *= (radius - r) * -1.0;
// vpos.y += 0.5*radius*cos(a);
float3 wpos = float3(cos(a)*r,sin(a)*r,mo_wpos.z);
float x_p = vpos.x*cos(a)-vpos.y*sin(a);
float y_p = vpos.x*sin(a)+vpos.y*cos(a);
vpos.x = x_p;
vpos.y = y_p;
float noise1 = SAMPLE_TEXTURE2D_LOD(_NoiseMap, sampler_NoiseMap, wpos.yz, 0) - 0.5;
float noise2 = SAMPLE_TEXTURE2D_LOD(_NoiseMap, sampler_NoiseMap, wpos.xy, 0) - 0.5;
wpos += float3(noise1, noise2, 0) * 2.0;
wpos += float3(vpos.xy,0);
wpos.y += radius;
wpos.z *= (_SpeedMultiplier+5*(_DistanceToNextBeat*_DistanceSinceLastBeat));
// wpos.z *= max(1, (wpos.z-6)* _SpeedMultiplier);
vpos = TransformWorldToObject(wpos);
// TransformWorldToObject()
// vpos += wposOffset;
// float x_with_distance = normalize(wpos.x)*wpos.z*0.1;
// x_with_distance = abs(x_with_distance);
// vpos += float3(x_with_distance,0,0);
OUT.wpos = wpos;
OUT.positionHCS = TransformObjectToHClip(vpos);
// The TRANSFORM_TEX macro performs the tiling and offset
// transformation.
OUT.uv = TRANSFORM_TEX(IN.uv, _BaseMap);
return OUT;
}
half4 frag(Varyings IN) : SV_Target
{
// calculate pixel
float2 res = _ScreenParams;
float2 p = -1.0+2.0*IN.positionHCS.xy/res.xy;
float2 toCentre = TransformObjectToWorld(-IN.wpos).xy;
toCentre = normalize(toCentre);
float t = dot(IN.normal, toCentre) * 0.5 + 0.5;
// float t = dot(IN.normal, float3(0,1,0)) * 0.5 + 0.5;
// float t = length(p);
// return lerp(_Color1,_Color2,t * _FadeStrength);
float normalised = IN.wpos.z/500.0;
// float4 c = float4(lerp(_Color1, _Color2, t).xyz, _Alpha);
float4 c = _Color1;
c *= tape_noise(IN.polar/0.00005);
c = lerp(c, _FarColor, _DistanceToNextBeat);
return c;
}
ENDHLSL
}
}
}

View File

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

View File

@ -314,12 +314,13 @@ Shader "custom/tunnel"
float4 color = float4(0,0,0,0); float4 color = float4(0,0,0,0);
// precalc some stuff // precalc some stuff
float2 core_c = float2(0, _CoreYOffset);
float4 f = fractal1 + fractal2; float4 f = fractal1 + fractal2;
// float f = fractal2; // float f = fractal2;
float4 g = ground(p, r, a); float4 g = ground(p, r, a);
// float g_mask = step(_GroundMaskAngle,g); // float g_mask = step(_GroundMaskAngle,g);
float4 n = nebula(r, a); float4 n = nebula(r, a);
float4 s = stars(r, a); float4 s = stars((length(core_c-p)), atan((core_c-p).y/(core_c-p).x));
float4 b = bars(r, p); float4 b = bars(r, p);
// fractal // fractal
@ -369,7 +370,6 @@ Shader "custom/tunnel"
color = max(bars_color, color); color = max(bars_color, color);
// core // core
float2 core_c = float2(0, _CoreYOffset);
float4 core_color = blurry_circle(p, core_c, _CoreRadius, _CoreThiccness); float4 core_color = blurry_circle(p, core_c, _CoreRadius, _CoreThiccness);
core_color *= _CoreColor; core_color *= _CoreColor;
color = lerp(color, core_color, core_color); color = lerp(color, core_color, core_color);

View File

@ -11,6 +11,7 @@ public class TunnelController : MonoBehaviour
[SerializeField] private AnimationCurve _anim; [SerializeField] private AnimationCurve _anim;
[SerializeField] private SerialFloat _playerXPos; [SerializeField] private SerialFloat _playerXPos;
[SerializeField] private SerialFloat _playerXMove; [SerializeField] private SerialFloat _playerXMove;
[SerializeField] private SerialFloat _baseTubeRadius;
[SerializeField] private AccessibilityOptions _accessibility; [SerializeField] private AccessibilityOptions _accessibility;
[SerializeField] private float _baseCameraShake; [SerializeField] private float _baseCameraShake;
@ -26,6 +27,7 @@ public class TunnelController : MonoBehaviour
private void Awake() private void Awake()
{ {
Shader.SetGlobalFloat("_CameraShake", 0); Shader.SetGlobalFloat("_CameraShake", 0);
Shader.SetGlobalFloat("_BaseTubeRadius", _baseTubeRadius);
Debug.Log(_accessibility.Mode); Debug.Log(_accessibility.Mode);
switch (_accessibility.Mode) switch (_accessibility.Mode)

View File

@ -106,19 +106,19 @@ MonoBehaviour:
m_Bits: 64 m_Bits: 64
accuracy: 0 accuracy: 0
zone: zone:
numToSpawn: 1 numToSpawn: 75
offset: {x: 0, y: 0, z: 0} offset: {x: 0, y: 0, z: 0}
spawnType: 0 spawnType: 0
spawnDir: 0 spawnDir: 0
spawnPlane: 1 spawnPlane: 1
width: 0 width: 10
height: 0 height: 0
surfaceOnly: 1 surfaceOnly: 0
evenDistribution: 1 evenDistribution: 1
numSides: 3 numSides: 3
numPerSide: 10 numPerSide: 10
flipVertical: 0 flipVertical: 0
radius: 0 radius: 5
arc: 360 arc: 360
composite: [] composite: []
manualFire: 1 manualFire: 1