diff --git a/Assets/Materials/TrajectoryLine.mat b/Assets/Materials/TrajectoryLine.mat new file mode 100644 index 0000000..fc7cdf6 --- /dev/null +++ b/Assets/Materials/TrajectoryLine.mat @@ -0,0 +1,140 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-6532468477391232685 +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 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: TrajectoryLine + m_Shader: {fileID: 4800000, guid: 650dd9526735d5b46b79224bc6e94025, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _SURFACE_TYPE_TRANSPARENT + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 1 + 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 + - _BlendOp: 0 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 0 + - _Cutoff: 0.834 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 10 + - _DstBlendAlpha: 10 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _SampleGI: 0 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 5 + - _SrcBlendAlpha: 1 + - _Surface: 1 + - _UVSec: 0 + - _WorkflowMode: 1 + - _ZWrite: 0 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 0.015686275} + - _Color: {r: 1, g: 1, b: 1, a: 0.015686275} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Materials/TrajectoryLine.mat.meta b/Assets/Materials/TrajectoryLine.mat.meta new file mode 100644 index 0000000..35f1288 --- /dev/null +++ b/Assets/Materials/TrajectoryLine.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2332a9014d9db304793b505bab51a107 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Towers/Turret.prefab b/Assets/Prefabs/Towers/Turret.prefab index 7c83451..24d00ea 100644 --- a/Assets/Prefabs/Towers/Turret.prefab +++ b/Assets/Prefabs/Towers/Turret.prefab @@ -845,7 +845,7 @@ LineRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 10306, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 2100000, guid: 2332a9014d9db304793b505bab51a107, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 @@ -912,7 +912,7 @@ LineRenderer: atime6: 0 atime7: 0 m_Mode: 0 - m_ColorSpace: -1 + m_ColorSpace: 0 m_NumColorKeys: 2 m_NumAlphaKeys: 2 numCornerVertices: 0 @@ -1079,6 +1079,8 @@ MonoBehaviour: trajectoryBounces: 4 ghostPrefab: {fileID: 2962360034595352958, guid: f657bc53e175aad72a117bf3ef556359, type: 3} + trajectoryLine: {fileID: 3987931586699850031} + trajectoryObjectPoolSize: 25 attackSecondsDelay: 1 projectileSequence: - Arc: 0 diff --git a/Assets/Scripts/Tower/AimTower.cs b/Assets/Scripts/Tower/AimTower.cs index a9cac3c..f717840 100644 --- a/Assets/Scripts/Tower/AimTower.cs +++ b/Assets/Scripts/Tower/AimTower.cs @@ -14,6 +14,7 @@ public class AimTower : Tower private const float k_trajectory_maxdist = 100f; private List ghosts = new(); [SerializeField] private GameObject ghostPrefab; + [SerializeField] private LineRenderer trajectoryLine; [SerializeField] private int trajectoryObjectPoolSize = 25; private int poolIdx = 0; @@ -83,6 +84,10 @@ public class AimTower : Tower origin = hit.point; } + + trajectoryLine.positionCount = pointsInTrajectory.Count; + trajectoryLine.SetPositions(pointsInTrajectory.ToArray()); + // Build trajectory for (int i = 0; i < pointsInTrajectory.Count - 1; i++) {