Editor Gizmos + horizontal min max linerenderer sampler
This commit is contained in:
parent
543292de23
commit
838ac1d272
|
@ -33,6 +33,8 @@ Transform:
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 2145028294596449649}
|
- {fileID: 2145028294596449649}
|
||||||
|
- {fileID: 1223875499574008094}
|
||||||
|
- {fileID: 8537103711824016857}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!33 &5439060163005320995
|
--- !u!33 &5439060163005320995
|
||||||
|
@ -189,3 +191,307 @@ MeshFilter:
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 4398724951968777500}
|
m_GameObject: {fileID: 4398724951968777500}
|
||||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
--- !u!1 &4929042397896542789
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1223875499574008094}
|
||||||
|
- component: {fileID: 8501533562697966838}
|
||||||
|
- component: {fileID: 1842811169542586225}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: HorizontalArc
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &1223875499574008094
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4929042397896542789}
|
||||||
|
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: 7523567070824087546}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!120 &8501533562697966838
|
||||||
|
LineRenderer:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4929042397896542789}
|
||||||
|
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: 0}
|
||||||
|
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_Positions:
|
||||||
|
- {x: 0, y: 0, z: 0}
|
||||||
|
- {x: 0, y: 0, z: 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_MaskInteraction: 0
|
||||||
|
m_UseWorldSpace: 1
|
||||||
|
m_Loop: 0
|
||||||
|
m_ApplyActiveColorSpace: 1
|
||||||
|
--- !u!114 &1842811169542586225
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 4929042397896542789}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 907145a413a8aab36826e850743ffdcc, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
samples: 15
|
||||||
|
visualRadius: 1
|
||||||
|
rotationMinMax: {x: -30, y: 30}
|
||||||
|
--- !u!1 &7730797280345979287
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 8537103711824016857}
|
||||||
|
- component: {fileID: 639897978325975064}
|
||||||
|
- component: {fileID: 1425401315373935596}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: VerticalArc
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &8537103711824016857
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7730797280345979287}
|
||||||
|
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: 7523567070824087546}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!120 &639897978325975064
|
||||||
|
LineRenderer:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7730797280345979287}
|
||||||
|
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: 0}
|
||||||
|
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_Positions:
|
||||||
|
- {x: 0, y: 0, z: 0}
|
||||||
|
- {x: 0, y: 0, z: 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_MaskInteraction: 0
|
||||||
|
m_UseWorldSpace: 1
|
||||||
|
m_Loop: 0
|
||||||
|
m_ApplyActiveColorSpace: 1
|
||||||
|
--- !u!114 &1425401315373935596
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7730797280345979287}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 907145a413a8aab36826e850743ffdcc, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
samples: 15
|
||||||
|
visualRadius: 1
|
||||||
|
rotationMinMax: {x: -30, y: 30}
|
||||||
|
|
|
@ -0,0 +1,179 @@
|
||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1001 &3629188724500721763
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 639897978325975064, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_Positions.Array.size
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 4241178655744724118, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: Turret
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7523567070824087546, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7523567070824087546, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7523567070824087546, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7523567070824087546, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7523567070824087546, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7523567070824087546, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7523567070824087546, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7523567070824087546, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7523567070824087546, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7523567070824087546, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7730797280345979287, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_IsActive
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8501533562697966838, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_Positions.Array.size
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8501533562697966838, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_Parameters.widthCurve.m_Curve.Array.data[0].value
|
||||||
|
value: 0.20800006
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_RemovedGameObjects: []
|
||||||
|
m_AddedGameObjects: []
|
||||||
|
m_AddedComponents:
|
||||||
|
- targetCorrespondingSourceObject: {fileID: 4241178655744724118, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
||||||
|
type: 3}
|
||||||
|
insertIndex: -1
|
||||||
|
addedObject: {fileID: 5440735504016821781}
|
||||||
|
- targetCorrespondingSourceObject: {fileID: 4241178655744724118, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
||||||
|
type: 3}
|
||||||
|
insertIndex: -1
|
||||||
|
addedObject: {fileID: 7323039027591738477}
|
||||||
|
- targetCorrespondingSourceObject: {fileID: 4241178655744724118, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
||||||
|
type: 3}
|
||||||
|
insertIndex: -1
|
||||||
|
addedObject: {fileID: 841175348891104259}
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: c309e2ab8a7e17f049cee02d2d5e1af3, type: 3}
|
||||||
|
--- !u!1 &614396578925772021 stripped
|
||||||
|
GameObject:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 4241178655744724118, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
||||||
|
type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 3629188724500721763}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
--- !u!114 &5440735504016821781
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 614396578925772021}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: f10d9733c7bd6bfd7ad6ba157ed4dd18, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
delayBetweenBulletSequences: 0.1
|
||||||
|
--- !u!114 &7323039027591738477
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 614396578925772021}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 62293fbacde88045196dca1e291b5f23, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
startHealth: 100
|
||||||
|
OnHealthZero:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
OnHealthChange:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls: []
|
||||||
|
--- !u!114 &841175348891104259
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 614396578925772021}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 3c6fb039e74d12a7bbfde22591bc7eee, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
horizontalArc: {fileID: 3156896981218152210}
|
||||||
|
verticalArc: {fileID: 2419977930026982287}
|
||||||
|
projectileSequence: []
|
||||||
|
--- !u!114 &2419977930026982287 stripped
|
||||||
|
MonoBehaviour:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 1425401315373935596, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
||||||
|
type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 3629188724500721763}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 907145a413a8aab36826e850743ffdcc, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
--- !u!114 &3156896981218152210 stripped
|
||||||
|
MonoBehaviour:
|
||||||
|
m_CorrespondingSourceObject: {fileID: 1842811169542586225, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
||||||
|
type: 3}
|
||||||
|
m_PrefabInstance: {fileID: 3629188724500721763}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 907145a413a8aab36826e850743ffdcc, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9415cb10a1bd579269301ca4f61a1554
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -160,7 +160,7 @@ Camera:
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_ClearFlags: 1
|
m_ClearFlags: 1
|
||||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
m_projectionMatrixMode: 1
|
m_projectionMatrixMode: 1
|
||||||
m_GateFitMode: 2
|
m_GateFitMode: 2
|
||||||
m_FOVAxisMode: 0
|
m_FOVAxisMode: 0
|
||||||
|
@ -427,7 +427,7 @@ Transform:
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1001 &8564517829232091348
|
--- !u!1001 &891862850
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
@ -435,57 +435,67 @@ PrefabInstance:
|
||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
m_TransformParent: {fileID: 0}
|
m_TransformParent: {fileID: 0}
|
||||||
m_Modifications:
|
m_Modifications:
|
||||||
- target: {fileID: 4241178655744724118, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
- target: {fileID: 614396578925772021, guid: 9415cb10a1bd579269301ca4f61a1554,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: BaseTower
|
value: Turret
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7523567070824087546, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
- target: {fileID: 841175348891104259, guid: 9415cb10a1bd579269301ca4f61a1554,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: verticalRotationMinMax.x
|
||||||
|
value: -38.2
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 841175348891104259, guid: 9415cb10a1bd579269301ca4f61a1554,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: horizontalRotationMinMax.x
|
||||||
|
value: -35.7
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6499929602381336473, guid: 9415cb10a1bd579269301ca4f61a1554,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7523567070824087546, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
- target: {fileID: 6499929602381336473, guid: 9415cb10a1bd579269301ca4f61a1554,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_LocalPosition.y
|
propertyPath: m_LocalPosition.y
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7523567070824087546, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
- target: {fileID: 6499929602381336473, guid: 9415cb10a1bd579269301ca4f61a1554,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7523567070824087546, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
- target: {fileID: 6499929602381336473, guid: 9415cb10a1bd579269301ca4f61a1554,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_LocalRotation.w
|
propertyPath: m_LocalRotation.w
|
||||||
value: 1
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7523567070824087546, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
- target: {fileID: 6499929602381336473, guid: 9415cb10a1bd579269301ca4f61a1554,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_LocalRotation.x
|
propertyPath: m_LocalRotation.x
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7523567070824087546, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
- target: {fileID: 6499929602381336473, guid: 9415cb10a1bd579269301ca4f61a1554,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_LocalRotation.y
|
propertyPath: m_LocalRotation.y
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7523567070824087546, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
- target: {fileID: 6499929602381336473, guid: 9415cb10a1bd579269301ca4f61a1554,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_LocalRotation.z
|
propertyPath: m_LocalRotation.z
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7523567070824087546, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
- target: {fileID: 6499929602381336473, guid: 9415cb10a1bd579269301ca4f61a1554,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_LocalEulerAnglesHint.x
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7523567070824087546, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
- target: {fileID: 6499929602381336473, guid: 9415cb10a1bd579269301ca4f61a1554,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_LocalEulerAnglesHint.y
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7523567070824087546, guid: c309e2ab8a7e17f049cee02d2d5e1af3,
|
- target: {fileID: 6499929602381336473, guid: 9415cb10a1bd579269301ca4f61a1554,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_LocalEulerAnglesHint.z
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
value: 0
|
value: 0
|
||||||
|
@ -494,7 +504,7 @@ PrefabInstance:
|
||||||
m_RemovedGameObjects: []
|
m_RemovedGameObjects: []
|
||||||
m_AddedGameObjects: []
|
m_AddedGameObjects: []
|
||||||
m_AddedComponents: []
|
m_AddedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: c309e2ab8a7e17f049cee02d2d5e1af3, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: 9415cb10a1bd579269301ca4f61a1554, type: 3}
|
||||||
--- !u!1660057539 &9223372036854775807
|
--- !u!1660057539 &9223372036854775807
|
||||||
SceneRoots:
|
SceneRoots:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -502,4 +512,4 @@ SceneRoots:
|
||||||
- {fileID: 330585546}
|
- {fileID: 330585546}
|
||||||
- {fileID: 410087041}
|
- {fileID: 410087041}
|
||||||
- {fileID: 832575519}
|
- {fileID: 832575519}
|
||||||
- {fileID: 8564517829232091348}
|
- {fileID: 891862850}
|
|
@ -0,0 +1,18 @@
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Assertions;
|
||||||
|
|
||||||
|
[RequireComponent(typeof(ProjectileSpawner))]
|
||||||
|
public class ProjectileTower : Tower
|
||||||
|
{
|
||||||
|
[SerializeField] private ProjectilePattern[] projectileSequence;
|
||||||
|
|
||||||
|
private ProjectileSpawner projectileSpawner;
|
||||||
|
|
||||||
|
protected override void Awake()
|
||||||
|
{
|
||||||
|
base.Awake();
|
||||||
|
|
||||||
|
projectileSpawner = GetComponent<ProjectileSpawner>();
|
||||||
|
Assert.IsNotNull(projectileSpawner);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3c6fb039e74d12a7bbfde22591bc7eee
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -4,21 +4,22 @@ using UnityEngine.Assertions;
|
||||||
[RequireComponent(typeof(HealthComponent))]
|
[RequireComponent(typeof(HealthComponent))]
|
||||||
public abstract class Tower : MonoBehaviour
|
public abstract class Tower : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField] private Vector2 horizontalRotationMinMax;
|
[SerializeField] private EditableArc horizontalArc;
|
||||||
[SerializeField] private Vector2 verticalRotationMinMax;
|
[SerializeField] private EditableArc verticalArc;
|
||||||
|
|
||||||
[SerializeField] private float horizontalRotation;
|
|
||||||
[SerializeField] private float verticalRotation;
|
|
||||||
|
|
||||||
private HealthComponent healthComp;
|
private HealthComponent healthComp;
|
||||||
|
|
||||||
private void Awake()
|
// Getters
|
||||||
|
public Vector2 HorizontalRotationMinMax => horizontalArc.RotationMinMax;
|
||||||
|
public Vector2 VerticalRotationMinMax => verticalArc.RotationMinMax;
|
||||||
|
public float HorizontalRotation => horizontalArc.Value;
|
||||||
|
public float VerticalRotation => verticalArc.Value;
|
||||||
|
|
||||||
|
protected virtual void Awake()
|
||||||
{
|
{
|
||||||
healthComp = GetComponent<HealthComponent>();
|
healthComp = GetComponent<HealthComponent>();
|
||||||
Assert.IsNotNull(healthComp);
|
Assert.IsNotNull(healthComp);
|
||||||
|
|
||||||
// Set default rotation to average between min max
|
// Set default rotation to average between min max
|
||||||
horizontalRotation = (horizontalRotationMinMax.x + horizontalRotationMinMax.y) / 2f;
|
|
||||||
verticalRotation = (verticalRotationMinMax.x + verticalRotationMinMax.y) / 2f;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEditor;
|
||||||
|
|
||||||
|
[CustomEditor(typeof(ProjectileSpawner))]
|
||||||
|
public class TowerEditor : Editor
|
||||||
|
{
|
||||||
|
private float arcDist = 1f;
|
||||||
|
|
||||||
|
public void OnSceneGUI()
|
||||||
|
{
|
||||||
|
var tower = (serializedObject.targetObject as Component).gameObject.GetComponent<Tower>();
|
||||||
|
|
||||||
|
// Draw horizontal angle
|
||||||
|
Handles.color = Color.red;
|
||||||
|
float angleX = tower.HorizontalRotationMinMax.y - tower.HorizontalRotationMinMax.x;
|
||||||
|
float vX = (Mathf.PI - tower.HorizontalRotation * Mathf.Deg2Rad) / 2f;
|
||||||
|
Vector3 fromX = Quaternion.AngleAxis(tower.HorizontalRotationMinMax.x, tower.transform.up) * tower.transform.right;
|
||||||
|
Handles.DrawWireArc(tower.transform.position, tower.transform.up, fromX, angleX, arcDist, 5);
|
||||||
|
|
||||||
|
// Draw vertical angle
|
||||||
|
Handles.color = Color.green;
|
||||||
|
float angleY = tower.VerticalRotationMinMax.y - tower.VerticalRotationMinMax.x;
|
||||||
|
float vY = (Mathf.PI - tower.VerticalRotation * Mathf.Deg2Rad) / 2f;
|
||||||
|
Vector3 fromY = Quaternion.AngleAxis(tower.VerticalRotationMinMax.x, tower.transform.right) * tower.transform.up;
|
||||||
|
Handles.DrawWireArc(tower.transform.position, tower.transform.right, fromY, angleY, arcDist, 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0e79d278213d1e8b0b8cf1ef67884018
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,67 @@
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[RequireComponent(typeof(LineRenderer))]
|
||||||
|
public class EditableArc : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField, Range(5, 50)] private int samples = 15;
|
||||||
|
[SerializeField] private float visualRadius = 1f;
|
||||||
|
|
||||||
|
[SerializeField] private Vector2 rotationMinMax = new Vector2(-30f, 30f);
|
||||||
|
private LineRenderer lineRenderer;
|
||||||
|
|
||||||
|
public Observer<float> Value { get; private set; } = new(0);
|
||||||
|
public Vector2 RotationMinMax => rotationMinMax;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
lineRenderer = GetComponent<LineRenderer>();
|
||||||
|
|
||||||
|
Value.AddListener(UpdateArc);
|
||||||
|
|
||||||
|
Value.Value = (rotationMinMax.x + rotationMinMax.y) / 2f;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Update()
|
||||||
|
{
|
||||||
|
UpdateArc(Value.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateArc(float rotation)
|
||||||
|
{
|
||||||
|
float angle = rotationMinMax.y - rotationMinMax.x;
|
||||||
|
float v = (Mathf.PI - Value * Mathf.Deg2Rad) / 2f;
|
||||||
|
Vector3 start = Quaternion.AngleAxis(rotationMinMax.x, transform.up) * transform.right;
|
||||||
|
Vector3 end = Quaternion.AngleAxis(rotationMinMax.y, transform.up) * transform.right;
|
||||||
|
|
||||||
|
// Sample LineRenderer points
|
||||||
|
lineRenderer.positionCount = samples + 1;
|
||||||
|
Vector3[] positions = new Vector3[samples + 1];
|
||||||
|
float stepSize = 1f / samples;
|
||||||
|
float t = 0;
|
||||||
|
for (int i = 0; i <= samples; i++)
|
||||||
|
{
|
||||||
|
positions[i] = SamplePointOnArc(start, end, visualRadius, t);
|
||||||
|
// Debug.Log($"t: = {t}, pos: {positions[i]}");
|
||||||
|
t += stepSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
lineRenderer.SetPositions(positions);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector3 SamplePointOnArc(Vector3 startPoint, Vector3 endPoint, float radius, float t)
|
||||||
|
{
|
||||||
|
// Calculate the angle between start and end points
|
||||||
|
float angle = Vector3.Angle(startPoint, endPoint) * t;
|
||||||
|
|
||||||
|
// Calculate the perpendicular vector from start to end
|
||||||
|
Vector3 axis = Vector3.Cross(startPoint, endPoint).normalized;
|
||||||
|
|
||||||
|
// Calculate the position of the point on the arc
|
||||||
|
Vector3 pointOnArc = Quaternion.AngleAxis(angle, axis) * startPoint;
|
||||||
|
|
||||||
|
// Scale the point by the radius
|
||||||
|
pointOnArc *= radius;
|
||||||
|
|
||||||
|
return pointOnArc;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 907145a413a8aab36826e850743ffdcc
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,78 @@
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Events;
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
using UnityEditor.Events;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class Observer<T> {
|
||||||
|
[SerializeField] T value;
|
||||||
|
[SerializeField] UnityEvent<T> onValueChanged;
|
||||||
|
|
||||||
|
public T Value {
|
||||||
|
get => value;
|
||||||
|
set => Set(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator T(Observer<T> observer) => observer.value;
|
||||||
|
|
||||||
|
public Observer(T value, UnityAction<T> callback = null) {
|
||||||
|
this.value = value;
|
||||||
|
onValueChanged = new UnityEvent<T>();
|
||||||
|
if (callback != null) onValueChanged.AddListener(callback);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Set(T value) {
|
||||||
|
if (Equals(this.value, value)) return;
|
||||||
|
this.value = value;
|
||||||
|
Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Invoke() {
|
||||||
|
Debug.Log($"Invoking {onValueChanged.GetPersistentEventCount()} listeners");
|
||||||
|
onValueChanged.Invoke(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddListener(UnityAction<T> callback) {
|
||||||
|
if (callback == null) return;
|
||||||
|
if (onValueChanged == null) onValueChanged = new UnityEvent<T>();
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
UnityEventTools.AddPersistentListener(onValueChanged, callback);
|
||||||
|
#else
|
||||||
|
onValueChanged.AddListener(callback);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveListener(UnityAction<T> callback) {
|
||||||
|
if (callback == null) return;
|
||||||
|
if (onValueChanged == null) return;
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
UnityEventTools.RemovePersistentListener(onValueChanged, callback);
|
||||||
|
#else
|
||||||
|
onValueChanged.RemoveListener(callback);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveAllListeners() {
|
||||||
|
if (onValueChanged == null) return;
|
||||||
|
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
FieldInfo fieldInfo = typeof(UnityEventBase).GetField("m_PersistentCalls", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||||
|
object value = fieldInfo.GetValue(onValueChanged);
|
||||||
|
value.GetType().GetMethod("Clear").Invoke(value, null);
|
||||||
|
#else
|
||||||
|
onValueChanged.RemoveAllListeners();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose() {
|
||||||
|
RemoveAllListeners();
|
||||||
|
onValueChanged = null;
|
||||||
|
value = default;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5735822f673b7d3bf8f5c054f91c8fd4
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,64 @@
|
||||||
|
using System.Collections;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public class ProjectilePattern
|
||||||
|
{
|
||||||
|
[SerializeField]
|
||||||
|
public float Arc = 15;
|
||||||
|
[SerializeField]
|
||||||
|
public int Amount = 3;
|
||||||
|
[SerializeField]
|
||||||
|
public float Speed = 1;
|
||||||
|
[SerializeField]
|
||||||
|
public GameObject bulletPrefab;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
public bool Burst = true;
|
||||||
|
[SerializeField]
|
||||||
|
public float BurstDelay = 0.1f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ProjectileSpawner : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField] private float delayBetweenBulletSequences = 0.1f;
|
||||||
|
|
||||||
|
public void RunBulletSequence(Vector3 origin, Vector3 baseDirection, ProjectilePattern[] bulletSequence)
|
||||||
|
{
|
||||||
|
StartCoroutine(RunBulletSequenceCourotine(origin, baseDirection, bulletSequence));
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerator RunBulletSequenceCourotine(Vector3 origin, Vector3 baseDirection, ProjectilePattern[] bulletSequence)
|
||||||
|
{
|
||||||
|
baseDirection.Normalize();
|
||||||
|
|
||||||
|
foreach (ProjectilePattern bulletPattern in bulletSequence)
|
||||||
|
{
|
||||||
|
float stepSize = bulletPattern.Arc / ((float)bulletPattern.Amount);
|
||||||
|
for (int i = 0; i < bulletPattern.Amount; i++)
|
||||||
|
{
|
||||||
|
Vector2 bulletDir = rotate(baseDirection, stepSize * i + stepSize / 2f - bulletPattern.Arc / 2f);
|
||||||
|
|
||||||
|
GameObject projectile = Instantiate(bulletPattern.bulletPrefab, origin, Quaternion.identity);
|
||||||
|
Debug.DrawRay(origin, bulletDir, Color.magenta, 5f);
|
||||||
|
|
||||||
|
projectile.transform.up = bulletDir;
|
||||||
|
projectile.GetComponent<Rigidbody2D>().AddForce(bulletDir * bulletPattern.Speed);
|
||||||
|
|
||||||
|
if (bulletPattern.Burst)
|
||||||
|
yield return new WaitForSeconds(bulletPattern.BurstDelay);
|
||||||
|
}
|
||||||
|
yield return new WaitForSeconds(delayBetweenBulletSequences);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vector2 rotate(Vector2 v, float deg)
|
||||||
|
{
|
||||||
|
float delta = deg * (float)Mathf.Deg2Rad;
|
||||||
|
return new Vector2(
|
||||||
|
v.x * Mathf.Cos(delta) - v.y * Mathf.Sin(delta),
|
||||||
|
v.x * Mathf.Sin(delta) + v.y * Mathf.Cos(delta)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f10d9733c7bd6bfd7ad6ba157ed4dd18
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -6,6 +6,6 @@ EditorBuildSettings:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Scenes:
|
m_Scenes:
|
||||||
- enabled: 1
|
- enabled: 1
|
||||||
path: Assets/Scenes/SampleScene.unity
|
path: Assets/Scenes/TowerTest.unity
|
||||||
guid: 99c9720ab356a0642a771bea13969a05
|
guid: 99c9720ab356a0642a771bea13969a05
|
||||||
m_configObjects: {}
|
m_configObjects: {}
|
||||||
|
|
Loading…
Reference in New Issue