From 5226f6b28de645d861b61784f3979048603b18dc Mon Sep 17 00:00:00 2001 From: Jordan Orelli Date: Fri, 12 Jun 2020 21:57:32 -0500 Subject: [PATCH] seeker --- Assets/Materials/Seeker.mat | 77 ++++ .../{TouchHazard.mat.meta => Seeker.mat.meta} | 0 .../{TouchHazard.mat => TouchHazard 1.mat} | 2 +- Assets/Materials/TouchHazard 1.mat.meta | 8 + Assets/Prefabs/Seeker.prefab | 359 ++++++++++++++++++ Assets/Prefabs/Seeker.prefab.meta | 7 + Assets/Prefabs/TouchHazard.prefab | 2 +- Assets/Scenes/SampleScene.unity | 69 ++++ Assets/Scripts/PlayerController.cs | 21 +- Assets/Scripts/Seeker.cs | 64 ++++ Assets/Scripts/Seeker.cs.meta | 11 + ProjectSettings/TagManager.asset | 3 +- 12 files changed, 617 insertions(+), 6 deletions(-) create mode 100644 Assets/Materials/Seeker.mat rename Assets/Materials/{TouchHazard.mat.meta => Seeker.mat.meta} (100%) rename Assets/Materials/{TouchHazard.mat => TouchHazard 1.mat} (98%) create mode 100644 Assets/Materials/TouchHazard 1.mat.meta create mode 100644 Assets/Prefabs/Seeker.prefab create mode 100644 Assets/Prefabs/Seeker.prefab.meta create mode 100644 Assets/Scripts/Seeker.cs create mode 100644 Assets/Scripts/Seeker.cs.meta diff --git a/Assets/Materials/Seeker.mat b/Assets/Materials/Seeker.mat new file mode 100644 index 0000000..678074b --- /dev/null +++ b/Assets/Materials/Seeker.mat @@ -0,0 +1,77 @@ +%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: Seeker + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 1 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _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} + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 0, g: 0.5943396, b: 0.07189543, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/Materials/TouchHazard.mat.meta b/Assets/Materials/Seeker.mat.meta similarity index 100% rename from Assets/Materials/TouchHazard.mat.meta rename to Assets/Materials/Seeker.mat.meta diff --git a/Assets/Materials/TouchHazard.mat b/Assets/Materials/TouchHazard 1.mat similarity index 98% rename from Assets/Materials/TouchHazard.mat rename to Assets/Materials/TouchHazard 1.mat index eecfedf..b32f07d 100644 --- a/Assets/Materials/TouchHazard.mat +++ b/Assets/Materials/TouchHazard 1.mat @@ -7,7 +7,7 @@ Material: m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_Name: TouchHazard + m_Name: TouchHazard 1 m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} m_ShaderKeywords: m_LightmapFlags: 4 diff --git a/Assets/Materials/TouchHazard 1.mat.meta b/Assets/Materials/TouchHazard 1.mat.meta new file mode 100644 index 0000000..7bac4b5 --- /dev/null +++ b/Assets/Materials/TouchHazard 1.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 61d69b5b34181534d9fa2d1c4066dd2b +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Seeker.prefab b/Assets/Prefabs/Seeker.prefab new file mode 100644 index 0000000..5e20147 --- /dev/null +++ b/Assets/Prefabs/Seeker.prefab @@ -0,0 +1,359 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &4487469531008451088 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5364803949657740408} + - component: {fileID: 2861228925036942120} + - component: {fileID: 1667865045350920548} + m_Layer: 10 + m_Name: Quad + m_TagString: Enemy + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5364803949657740408 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4487469531008451088} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 6256090559880854698} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &2861228925036942120 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4487469531008451088} + m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &1667865045350920548 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4487469531008451088} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: cfe83c3bf8499d742b0903ab7c97d4e2, 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 +--- !u!1 &6224502771937998618 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5582799155841231266} + - component: {fileID: 107700806923936450} + - component: {fileID: 3417311567515930613} + m_Layer: 10 + m_Name: Quad (1) + m_TagString: Enemy + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5582799155841231266 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6224502771937998618} + m_LocalRotation: {x: -0, y: -0, z: -0.38268343, w: 0.92387956} + m_LocalPosition: {x: 0.5, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 6222642643292148606} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: -45} +--- !u!33 &107700806923936450 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6224502771937998618} + m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &3417311567515930613 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6224502771937998618} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: cfe83c3bf8499d742b0903ab7c97d4e2, 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 +--- !u!1 &6357844115163050814 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7256333555795088408} + - component: {fileID: 6384690151527866867} + - component: {fileID: 8930050421128870906} + m_Layer: 10 + m_Name: Quad + m_TagString: Enemy + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7256333555795088408 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6357844115163050814} + m_LocalRotation: {x: -0, y: -0, z: 0.38268343, w: 0.92387956} + m_LocalPosition: {x: -0.5, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 6222642643292148606} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 45} +--- !u!33 &6384690151527866867 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6357844115163050814} + m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &8930050421128870906 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6357844115163050814} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: cfe83c3bf8499d742b0903ab7c97d4e2, 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 +--- !u!1 &6587377380775331478 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6256090559880854698} + - component: {fileID: 2844899039713441137} + - component: {fileID: 4433057717770240425} + m_Layer: 10 + m_Name: Seeker + m_TagString: Enemy + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6256090559880854698 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6587377380775331478} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 5364803949657740408} + - {fileID: 6222642643292148606} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2844899039713441137 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6587377380775331478} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 55bf8fafe9016784882665b75489729c, type: 3} + m_Name: + m_EditorClassIdentifier: + collisionMask: + serializedVersion: 2 + m_Bits: 3328 + range: 12.5 + maxSpeed: 30 + acceleration: 60 + drag: 1 +--- !u!60 &4433057717770240425 +PolygonCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6587377380775331478} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 0, y: 0} + newSize: {x: 0, y: 0} + adaptiveTilingThreshold: 0 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + m_Points: + m_Paths: + - - {x: 0.5002374, y: 0.3538693} + - {x: 0.4995643, y: 0.50025505} + - {x: -0.5000009, y: 0.5000821} + - {x: -0.5000621, y: 0.3536035} + - {x: -1.2071084, y: 0.000003861962} + - {x: -0.5003041, y: -0.3535141} + - {x: -0.49993733, y: -0.500865} + - {x: 0.50028217, y: -0.50012565} + - {x: 0.50031036, y: -0.35400432} + - {x: 1.2072263, y: 0.00013122708} +--- !u!1 &8628242198497431465 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6222642643292148606} + m_Layer: 10 + m_Name: GameObject + m_TagString: Enemy + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6222642643292148606 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8628242198497431465} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 0.5, z: 1} + m_Children: + - {fileID: 5582799155841231266} + - {fileID: 7256333555795088408} + m_Father: {fileID: 6256090559880854698} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Prefabs/Seeker.prefab.meta b/Assets/Prefabs/Seeker.prefab.meta new file mode 100644 index 0000000..e8d5477 --- /dev/null +++ b/Assets/Prefabs/Seeker.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e7828cb028738b644aecc663b1440577 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/TouchHazard.prefab b/Assets/Prefabs/TouchHazard.prefab index 6b7e30c..c682fe5 100644 --- a/Assets/Prefabs/TouchHazard.prefab +++ b/Assets/Prefabs/TouchHazard.prefab @@ -60,7 +60,7 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: cfe83c3bf8499d742b0903ab7c97d4e2, type: 2} + - {fileID: 2100000, guid: 61d69b5b34181534d9fa2d1c4066dd2b, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index a4b1f17..987bddd 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -8643,6 +8643,75 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2130803679} m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1001 &1353198600256850240 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalPosition.x + value: 2.62 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalPosition.y + value: 4.49 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_RootOrder + value: 20 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6256090559880854698, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6587377380775331478, guid: e7828cb028738b644aecc663b1440577, + type: 3} + propertyPath: m_Name + value: Seeker + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: e7828cb028738b644aecc663b1440577, type: 3} --- !u!1001 &2340729373507300527 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index a138ca9..d38c18e 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -56,12 +56,18 @@ public class PlayerController : MonoBehaviour { void Awake() { Debug.Log("Creating new controls in Awake!"); - controls = new PlayerControls(); } void Update() { - InputActionPhase jumpPhase = controls.Gameplay.Jump.phase; - bool jumpTriggered = controls.Gameplay.Jump.triggered; + InputActionPhase jumpPhase = InputActionPhase.Waiting; + bool jumpTriggered = false; + if (controls == null) { + Debug.Log("HOW IS GAMEPLAY NULL"); + } + if (controls.Gameplay.Jump != null) { + jumpPhase = controls.Gameplay.Jump.phase; + jumpTriggered = controls.Gameplay.Jump.triggered; + } // Debug.LogFormat("Jump Phase: {0} Triggered: {1}", jumpPhase, jumpTriggered); GameObject tracerObj = Instantiate(tracerPrefab, transform.position, Quaternion.identity); @@ -357,6 +363,7 @@ public class PlayerController : MonoBehaviour { if (other == null) { return; } + Debug.Log(other); TouchHazard hazard = other.GetComponent(); if (hazard) { @@ -374,10 +381,18 @@ public class PlayerController : MonoBehaviour { Destroy(smashable.gameObject); } } + + Seeker seeker = other.GetComponent(); + if (seeker) { + SceneManager.LoadScene( SceneManager.GetActiveScene().buildIndex ) ; + } } public void OnEnable() { Debug.Log("Enabling the controls!"); + if (controls == null) { + controls = new PlayerControls(); + } controls.Enable(); controls.Gameplay.Enable(); controls.Gameplay.Jump.Enable(); diff --git a/Assets/Scripts/Seeker.cs b/Assets/Scripts/Seeker.cs new file mode 100644 index 0000000..0bf105b --- /dev/null +++ b/Assets/Scripts/Seeker.cs @@ -0,0 +1,64 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Seeker : MonoBehaviour { + public LayerMask collisionMask; + public float range = 3.0f; + public float maxSpeed = 3.0f; // units per second + public float acceleration = 3.0f; // increase in velocity per second + public float drag = 1.0f; + + private Vector3 pivot; + private Vector3 leftMax; + private Vector3 rightMax; + private Vector3 velocity; + + void Start() { + velocity = Vector3.zero; + } + + // Start is called before the first frame update + void Awake() { + pivot = transform.position; + leftMax = pivot + Vector3.left * range; + rightMax = pivot + Vector3.right * range; + } + + // Update is called once per frame + void Update() { + detectPlayer(); + velocity.x = Mathf.Clamp(velocity.x, -maxSpeed, maxSpeed); + transform.position = transform.position + velocity * Time.deltaTime; + } + + private void detectPlayer() { + if (detectPlayer(transform.position + Vector3.left * 1.22f, Vector3.left)) { + velocity += Vector3.left * acceleration * Time.deltaTime; + } + if (detectPlayer(transform.position + Vector3.right * 1.22f, Vector3.right)) { + velocity += Vector3.right * acceleration * Time.deltaTime; + } + } + + private bool detectPlayer(Vector3 start, Vector3 dir) { + Debug.LogFormat("start: {0} dir: {1}", start, dir); + RaycastHit2D hit = Physics2D.Raycast(start, dir, range, collisionMask); + if (hit) { + if (hit.collider.gameObject.layer == LayerMask.NameToLayer("Player")) { + Debug.DrawRay(start, dir * hit.distance, Color.red); + return true; + } else { + Debug.DrawRay(start, dir * hit.distance, Color.green); + if (dir.x >= 0) { + velocity.x = Mathf.Clamp(velocity.x, -Mathf.Infinity, hit.distance / Time.deltaTime); + } else { + velocity.x = Mathf.Clamp(velocity.x, -hit.distance / Time.deltaTime, Mathf.Infinity); + } + } + } else { + Debug.DrawRay(start, dir * range, Color.gray); + } + return false; + } +} diff --git a/Assets/Scripts/Seeker.cs.meta b/Assets/Scripts/Seeker.cs.meta new file mode 100644 index 0000000..27e6b32 --- /dev/null +++ b/Assets/Scripts/Seeker.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 55bf8fafe9016784882665b75489729c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index 040f138..6995890 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -3,7 +3,8 @@ --- !u!78 &1 TagManager: serializedVersion: 2 - tags: [] + tags: + - Enemy layers: - Default - TransparentFX