diff --git a/Assets/Prefabs/Towers/Turret.prefab b/Assets/Prefabs/Towers/Turret.prefab index 1bdbae0..5b7cacb 100644 --- a/Assets/Prefabs/Towers/Turret.prefab +++ b/Assets/Prefabs/Towers/Turret.prefab @@ -185,7 +185,7 @@ Transform: serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0.000000070586, y: 0.000000017498, z: 0.843} - m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} + m_LocalScale: {x: 0.2, y: 0.2, z: 0.2} m_ConstrainProportionsScale: 1 m_Children: [] m_Father: {fileID: 4508182228569071021} @@ -304,7 +304,7 @@ Transform: serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0.843} - m_LocalScale: {x: 0.1, y: 0.1, z: 0.1} + m_LocalScale: {x: 0.2, y: 0.2, z: 0.2} m_ConstrainProportionsScale: 1 m_Children: [] m_Father: {fileID: 3688593234855359137} diff --git a/Assets/Scenes/TowerTest.unity b/Assets/Scenes/TowerTest.unity index 0268c1f..2424707 100644 --- a/Assets/Scenes/TowerTest.unity +++ b/Assets/Scenes/TowerTest.unity @@ -123,143 +123,6 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} ---- !u!1 &330585543 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 330585546} - - component: {fileID: 330585545} - - component: {fileID: 330585544} - - component: {fileID: 330585547} - m_Layer: 0 - m_Name: Main Camera - m_TagString: MainCamera - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!81 &330585544 -AudioListener: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 330585543} - m_Enabled: 1 ---- !u!20 &330585545 -Camera: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 330585543} - m_Enabled: 1 - serializedVersion: 2 - m_ClearFlags: 1 - m_BackGroundColor: {r: 0, g: 0, b: 0, a: 1} - m_projectionMatrixMode: 1 - m_GateFitMode: 2 - m_FOVAxisMode: 0 - m_Iso: 200 - m_ShutterSpeed: 0.005 - m_Aperture: 16 - m_FocusDistance: 10 - m_FocalLength: 50 - m_BladeCount: 5 - m_Curvature: {x: 2, y: 11} - m_BarrelClipping: 0.25 - m_Anamorphism: 0 - m_SensorSize: {x: 36, y: 24} - m_LensShift: {x: 0, y: 0} - m_NormalizedViewPortRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 - near clip plane: 0.3 - far clip plane: 1000 - field of view: 60 - orthographic: 0 - orthographic size: 5 - m_Depth: -1 - m_CullingMask: - serializedVersion: 2 - m_Bits: 4294967295 - m_RenderingPath: -1 - m_TargetTexture: {fileID: 0} - m_TargetDisplay: 0 - m_TargetEye: 3 - m_HDR: 1 - m_AllowMSAA: 1 - m_AllowDynamicResolution: 0 - m_ForceIntoRT: 0 - m_OcclusionCulling: 1 - m_StereoConvergence: 10 - m_StereoSeparation: 0.022 ---- !u!4 &330585546 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 330585543} - serializedVersion: 2 - m_LocalRotation: {x: 0.17984354, y: -0.2199579, z: 0.04129667, w: 0.95789844} - m_LocalPosition: {x: 0.989, y: 1.63, z: -2.004} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 21.267, y: -25.865, z: 0} ---- !u!114 &330585547 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 330585543} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3} - m_Name: - m_EditorClassIdentifier: - m_RenderShadows: 1 - m_RequiresDepthTextureOption: 2 - m_RequiresOpaqueTextureOption: 2 - m_CameraType: 0 - m_Cameras: [] - m_RendererIndex: -1 - m_VolumeLayerMask: - serializedVersion: 2 - m_Bits: 1 - m_VolumeTrigger: {fileID: 0} - m_VolumeFrameworkUpdateModeOption: 2 - m_RenderPostProcessing: 1 - m_Antialiasing: 0 - m_AntialiasingQuality: 2 - m_StopNaN: 0 - m_Dithering: 0 - m_ClearDepth: 1 - m_AllowXRRendering: 1 - m_AllowHDROutput: 1 - m_UseScreenCoordOverride: 0 - m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0} - m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} - m_RequiresDepthTexture: 0 - m_RequiresColorTexture: 0 - m_Version: 2 - m_TaaSettings: - m_Quality: 3 - m_FrameInfluence: 0.1 - m_JitterScale: 1 - m_MipBias: 0 - m_VarianceClampScale: 0.9 - m_ContrastAdaptiveSharpening: 0 --- !u!1 &410087039 GameObject: m_ObjectHideFlags: 0 @@ -477,7 +340,7 @@ Transform: m_GameObject: {fileID: 643774939} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068} - m_LocalPosition: {x: 8.81, y: 0, z: 5.15} + m_LocalPosition: {x: 8.81, y: -0.004999995, z: -2.6} m_LocalScale: {x: 18.010532, y: 21.082876, z: 0.17439} m_ConstrainProportionsScale: 0 m_Children: [] @@ -582,7 +445,7 @@ Transform: m_GameObject: {fileID: 769011490} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: -4.1} + m_LocalPosition: {x: 0, y: -0.004999995, z: -11.85} m_LocalScale: {x: 18.010532, y: 21.082876, z: 0.17439} m_ConstrainProportionsScale: 0 m_Children: [] @@ -668,7 +531,7 @@ PrefabInstance: - target: {fileID: 9116936080776508834, guid: 9415cb10a1bd579269301ca4f61a1554, type: 3} propertyPath: m_LocalPosition.y - value: 0.875 + value: 0.84 objectReference: {fileID: 0} - target: {fileID: 9116936080776508834, guid: 9415cb10a1bd579269301ca4f61a1554, type: 3} @@ -678,7 +541,7 @@ PrefabInstance: - target: {fileID: 9116936080776508834, guid: 9415cb10a1bd579269301ca4f61a1554, type: 3} propertyPath: m_LocalRotation.w - value: 0.7071068 + value: 1 objectReference: {fileID: 0} - target: {fileID: 9116936080776508834, guid: 9415cb10a1bd579269301ca4f61a1554, type: 3} @@ -688,7 +551,7 @@ PrefabInstance: - target: {fileID: 9116936080776508834, guid: 9415cb10a1bd579269301ca4f61a1554, type: 3} propertyPath: m_LocalRotation.y - value: 0.7071068 + value: 0 objectReference: {fileID: 0} - target: {fileID: 9116936080776508834, guid: 9415cb10a1bd579269301ca4f61a1554, type: 3} @@ -703,7 +566,7 @@ PrefabInstance: - target: {fileID: 9116936080776508834, guid: 9415cb10a1bd579269301ca4f61a1554, type: 3} propertyPath: m_LocalEulerAnglesHint.y - value: 90 + value: 0 objectReference: {fileID: 0} - target: {fileID: 9116936080776508834, guid: 9415cb10a1bd579269301ca4f61a1554, type: 3} @@ -814,7 +677,7 @@ Transform: m_GameObject: {fileID: 1085503232} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068} - m_LocalPosition: {x: -8.38, y: 0, z: 4.34} + m_LocalPosition: {x: -8.38, y: -0.004999995, z: -3.4099998} m_LocalScale: {x: 18.010532, y: 21.082876, z: 0.17439} m_ConstrainProportionsScale: 0 m_Children: [] @@ -919,7 +782,7 @@ Transform: m_GameObject: {fileID: 1197417724} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 13.76} + m_LocalPosition: {x: 0, y: -0.004999995, z: 6.0100007} m_LocalScale: {x: 18.010532, y: 21.082876, z: 0.17439} m_ConstrainProportionsScale: 0 m_Children: [] @@ -1024,12 +887,225 @@ Transform: m_GameObject: {fileID: 1621186629} serializedVersion: 2 m_LocalRotation: {x: -0.7071068, y: 0, z: 0, w: 0.7071068} - m_LocalPosition: {x: 0, y: 0, z: 4.88} + m_LocalPosition: {x: 0, y: -0.004999995, z: -2.87} m_LocalScale: {x: 18.010532, y: 21.082876, z: 0.17439} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0} +--- !u!1001 &1732242001 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1127111119625446846, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_Name + value: Cinemachine + objectReference: {fileID: 0} + - target: {fileID: 2465233980315321778, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalRotation.w + value: -0.13894229 + objectReference: {fileID: 0} + - target: {fileID: 2465233980315321778, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalRotation.x + value: -0.011488037 + objectReference: {fileID: 0} + - target: {fileID: 2465233980315321778, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalRotation.y + value: 0.98686635 + objectReference: {fileID: 0} + - target: {fileID: 2465233980315321778, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalRotation.z + value: -0.081596166 + objectReference: {fileID: 0} + - target: {fileID: 2981308973353539976, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalPosition.x + value: 3.3133156 + objectReference: {fileID: 0} + - target: {fileID: 2981308973353539976, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalPosition.y + value: 4.29 + objectReference: {fileID: 0} + - target: {fileID: 2981308973353539976, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalPosition.z + value: 11.533513 + objectReference: {fileID: 0} + - target: {fileID: 2981308973353539976, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalRotation.w + value: -0.13855627 + objectReference: {fileID: 0} + - target: {fileID: 2981308973353539976, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalRotation.x + value: -0.015462777 + objectReference: {fileID: 0} + - target: {fileID: 2981308973353539976, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalRotation.y + value: 0.9841245 + objectReference: {fileID: 0} + - target: {fileID: 2981308973353539976, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalRotation.z + value: -0.10982757 + objectReference: {fileID: 0} + - target: {fileID: 3665490202611795451, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalPosition.x + value: 3.3133156 + objectReference: {fileID: 0} + - target: {fileID: 3665490202611795451, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalPosition.y + value: 4.29 + objectReference: {fileID: 0} + - target: {fileID: 3665490202611795451, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalPosition.z + value: 11.533513 + objectReference: {fileID: 0} + - target: {fileID: 5753661378891917460, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalRotation.w + value: -0.13855627 + objectReference: {fileID: 0} + - target: {fileID: 5753661378891917460, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalRotation.x + value: -0.015462776 + objectReference: {fileID: 0} + - target: {fileID: 5753661378891917460, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalRotation.y + value: 0.98412454 + objectReference: {fileID: 0} + - target: {fileID: 5753661378891917460, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalRotation.z + value: -0.10982756 + objectReference: {fileID: 0} + - target: {fileID: 6115888582170302332, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6115888582170302332, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalPosition.y + value: 0.84 + objectReference: {fileID: 0} + - target: {fileID: 6115888582170302332, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6115888582170302332, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6115888582170302332, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6115888582170302332, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7348612162646443967, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7348612162646443967, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalRotation.w + value: -0.1380528 + objectReference: {fileID: 0} + - target: {fileID: 7348612162646443967, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalRotation.x + value: -0.019451136 + objectReference: {fileID: 0} + - target: {fileID: 7348612162646443967, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalRotation.y + value: 0.98054886 + objectReference: {fileID: 0} + - target: {fileID: 7348612162646443967, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalRotation.z + value: -0.13815574 + objectReference: {fileID: 0} + - target: {fileID: 8882344377078016156, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8882344377078016156, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8882344377078016156, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8882344377078016156, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8882344377078016156, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8882344377078016156, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8882344377078016156, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8882344377078016156, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8882344377078016156, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8882344377078016156, guid: fd9f9b61c0ebb324ebc9f929e26706bc, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: fd9f9b61c0ebb324ebc9f929e26706bc, type: 3} --- !u!1 &1797347348 GameObject: m_ObjectHideFlags: 0 @@ -1129,7 +1205,7 @@ Transform: m_GameObject: {fileID: 1797347348} serializedVersion: 2 m_LocalRotation: {x: -0.7071068, y: 0, z: 0, w: 0.7071068} - m_LocalPosition: {x: 0, y: 9.4, z: 4.88} + m_LocalPosition: {x: 0, y: 9.3949995, z: -2.87} m_LocalScale: {x: 18.010532, y: 21.082876, z: 0.17439} m_ConstrainProportionsScale: 0 m_Children: [] @@ -1151,12 +1227,12 @@ PrefabInstance: - target: {fileID: 888336455889056387, guid: 32921dff6554af324ba0001ca8b56fee, type: 3} propertyPath: m_LocalPosition.y - value: -18.054228 + value: -18.059227 objectReference: {fileID: 0} - target: {fileID: 888336455889056387, guid: 32921dff6554af324ba0001ca8b56fee, type: 3} propertyPath: m_LocalPosition.z - value: 22.62589 + value: 14.875891 objectReference: {fileID: 0} - target: {fileID: 888336455889056387, guid: 32921dff6554af324ba0001ca8b56fee, type: 3} @@ -1207,7 +1283,6 @@ PrefabInstance: SceneRoots: m_ObjectHideFlags: 0 m_Roots: - - {fileID: 330585546} - {fileID: 410087041} - {fileID: 832575519} - {fileID: 891862850} @@ -1218,3 +1293,4 @@ SceneRoots: - {fileID: 1085503236} - {fileID: 1621186633} - {fileID: 1797347352} + - {fileID: 1732242001} diff --git a/Assets/Scripts/Utilities/EditableArc.cs b/Assets/Scripts/Utilities/EditableArc.cs index efc1478..2b8223f 100644 --- a/Assets/Scripts/Utilities/EditableArc.cs +++ b/Assets/Scripts/Utilities/EditableArc.cs @@ -65,12 +65,19 @@ public class EditableArc : MonoBehaviour private void PointerDraggedOnKnob(SliderKnob knob) { // Amount mouse have moved since last frame - ie. mouse velocity - float mouseMovement = Input.GetAxis(moveKnobAxisName); + Vector2 mouseMovement = new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y")); + + Vector3 start = Quaternion.AngleAxis(rotationMinMax.x, normal) * tangent; + Vector3 end = Quaternion.AngleAxis(rotationMinMax.y, normal) * tangent; + Vector3 v1 = SamplePointOnArcAngle(start, end, visualRadius, Value.Value); + Vector3 v2 = SamplePointOnArcAngle(start, end, visualRadius, Value.Value + 0.01f); + Vector3 arcTangent = v2 - v1; // TODO: figure out this based on camera orientation float sign = -1f; - float delta = mouseMovement * knobSensitiviy * sign; + float delta = Vector2.Dot(arcTangent, Vector2.down * mouseMovement) * knobSensitiviy; + Debug.Log(delta); float newAngle = ClampAngle(Value.Value + delta, rotationMinMax.x, rotationMinMax.y); Value.Value = newAngle; } @@ -115,6 +122,12 @@ public class EditableArc : MonoBehaviour return transform.position + dir.normalized * radius; } + public Vector3 SamplePointOnArcAngle(Vector3 startPoint, Vector3 endPoint, float radius, float angle) + { + Vector3 dir = Quaternion.AngleAxis(angle, normal) * tangent; + return transform.position + dir.normalized * radius; + } + public static float ClampAngle(float current, float min, float max) { float dtAngle = Mathf.Abs(((min - max) + 180) % 360 - 180); diff --git a/Assets/Scripts/Utilities/SliderKnob.cs b/Assets/Scripts/Utilities/SliderKnob.cs index 1fa5519..5164962 100644 --- a/Assets/Scripts/Utilities/SliderKnob.cs +++ b/Assets/Scripts/Utilities/SliderKnob.cs @@ -1,7 +1,6 @@ using System; using UnityEngine; -[RequireComponent(typeof(MeshCollider))] public class SliderKnob : MonoBehaviour { public event Action OnDrag;