diff --git a/.vsconfig b/.vsconfig
new file mode 100644
index 0000000..d70cd98
--- /dev/null
+++ b/.vsconfig
@@ -0,0 +1,6 @@
+{
+ "version": "1.0",
+ "components": [
+ "Microsoft.VisualStudio.Workload.ManagedGame"
+ ]
+}
diff --git a/Assets/Entities/Structures/Tower/Turret.prefab b/Assets/Entities/Structures/Tower/Turret.prefab
index 03845e8..b1009e7 100644
--- a/Assets/Entities/Structures/Tower/Turret.prefab
+++ b/Assets/Entities/Structures/Tower/Turret.prefab
@@ -100,7 +100,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
- m_IsActive: 0
+ m_IsActive: 1
--- !u!4 &8338452631907263897
Transform:
m_ObjectHideFlags: 0
@@ -676,8 +676,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d3a16cf44e28f02409c23498ed14acf5, type: 3}
m_Name:
m_EditorClassIdentifier:
- name:
health: 0
+ maxHealth: 0
+ isInvulnerable: 0
+ name:
cost: 0
buildTimer: 0
weaponRange: 40
diff --git a/Assets/InputSystem/CameraControllActions.cs b/Assets/InputSystem/CameraControllActions.cs
new file mode 100644
index 0000000..21357c1
--- /dev/null
+++ b/Assets/InputSystem/CameraControllActions.cs
@@ -0,0 +1,256 @@
+//------------------------------------------------------------------------------
+//
+// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
+// version 1.3.0
+// from Assets/InputSystem/CameraControllActions.inputactions
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine.InputSystem;
+using UnityEngine.InputSystem.Utilities;
+
+public partial class @CameraControllActions : IInputActionCollection2, IDisposable
+{
+ public InputActionAsset asset { get; }
+ public @CameraControllActions()
+ {
+ asset = InputActionAsset.FromJson(@"{
+ ""name"": ""CameraControllActions"",
+ ""maps"": [
+ {
+ ""name"": ""Camera"",
+ ""id"": ""e56b92c5-8fd9-4498-967b-a8a289d2ea2d"",
+ ""actions"": [
+ {
+ ""name"": ""Movement"",
+ ""type"": ""Value"",
+ ""id"": ""6d1751e7-bc18-45f3-ba28-1945c0630170"",
+ ""expectedControlType"": ""Vector2"",
+ ""processors"": """",
+ ""interactions"": """",
+ ""initialStateCheck"": true
+ },
+ {
+ ""name"": ""RotateCamera"",
+ ""type"": ""Value"",
+ ""id"": ""78a37640-f3de-4ef4-8ce2-48f71344fbad"",
+ ""expectedControlType"": ""Vector2"",
+ ""processors"": """",
+ ""interactions"": """",
+ ""initialStateCheck"": true
+ },
+ {
+ ""name"": ""ZoomCamera"",
+ ""type"": ""Value"",
+ ""id"": ""21086730-75a8-43cc-8b53-0ee2b54bf01f"",
+ ""expectedControlType"": ""Vector2"",
+ ""processors"": """",
+ ""interactions"": """",
+ ""initialStateCheck"": true
+ }
+ ],
+ ""bindings"": [
+ {
+ ""name"": ""2D Vector"",
+ ""id"": ""47f89b9c-94ea-4afd-afcb-3b77e0ec6033"",
+ ""path"": ""2DVector"",
+ ""interactions"": """",
+ ""processors"": """",
+ ""groups"": """",
+ ""action"": ""Movement"",
+ ""isComposite"": true,
+ ""isPartOfComposite"": false
+ },
+ {
+ ""name"": ""up"",
+ ""id"": ""34de0da3-759c-4218-b44d-920d156ddf0e"",
+ ""path"": ""/w"",
+ ""interactions"": """",
+ ""processors"": """",
+ ""groups"": """",
+ ""action"": ""Movement"",
+ ""isComposite"": false,
+ ""isPartOfComposite"": true
+ },
+ {
+ ""name"": ""down"",
+ ""id"": ""f9926638-c705-4e78-8b9a-ff59ab5326ec"",
+ ""path"": ""/s"",
+ ""interactions"": """",
+ ""processors"": """",
+ ""groups"": """",
+ ""action"": ""Movement"",
+ ""isComposite"": false,
+ ""isPartOfComposite"": true
+ },
+ {
+ ""name"": ""left"",
+ ""id"": ""53b6113e-e4f1-4b87-80a5-19c43df102c7"",
+ ""path"": ""/a"",
+ ""interactions"": """",
+ ""processors"": """",
+ ""groups"": """",
+ ""action"": ""Movement"",
+ ""isComposite"": false,
+ ""isPartOfComposite"": true
+ },
+ {
+ ""name"": ""right"",
+ ""id"": ""aa5061e6-662a-4969-b742-18ef7f2332e5"",
+ ""path"": ""/d"",
+ ""interactions"": """",
+ ""processors"": """",
+ ""groups"": """",
+ ""action"": ""Movement"",
+ ""isComposite"": false,
+ ""isPartOfComposite"": true
+ },
+ {
+ ""name"": """",
+ ""id"": ""305c7967-8fb9-4245-9d9f-70e40c553777"",
+ ""path"": ""/delta"",
+ ""interactions"": """",
+ ""processors"": """",
+ ""groups"": """",
+ ""action"": ""RotateCamera"",
+ ""isComposite"": false,
+ ""isPartOfComposite"": false
+ },
+ {
+ ""name"": """",
+ ""id"": ""cd712463-c5f3-49e7-877c-51c6f3440413"",
+ ""path"": ""/scroll"",
+ ""interactions"": """",
+ ""processors"": """",
+ ""groups"": """",
+ ""action"": ""ZoomCamera"",
+ ""isComposite"": false,
+ ""isPartOfComposite"": false
+ }
+ ]
+ }
+ ],
+ ""controlSchemes"": []
+}");
+ // Camera
+ m_Camera = asset.FindActionMap("Camera", throwIfNotFound: true);
+ m_Camera_Movement = m_Camera.FindAction("Movement", throwIfNotFound: true);
+ m_Camera_RotateCamera = m_Camera.FindAction("RotateCamera", throwIfNotFound: true);
+ m_Camera_ZoomCamera = m_Camera.FindAction("ZoomCamera", throwIfNotFound: true);
+ }
+
+ public void Dispose()
+ {
+ UnityEngine.Object.Destroy(asset);
+ }
+
+ public InputBinding? bindingMask
+ {
+ get => asset.bindingMask;
+ set => asset.bindingMask = value;
+ }
+
+ public ReadOnlyArray? devices
+ {
+ get => asset.devices;
+ set => asset.devices = value;
+ }
+
+ public ReadOnlyArray controlSchemes => asset.controlSchemes;
+
+ public bool Contains(InputAction action)
+ {
+ return asset.Contains(action);
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return asset.GetEnumerator();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+
+ public void Enable()
+ {
+ asset.Enable();
+ }
+
+ public void Disable()
+ {
+ asset.Disable();
+ }
+ public IEnumerable bindings => asset.bindings;
+
+ public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
+ {
+ return asset.FindAction(actionNameOrId, throwIfNotFound);
+ }
+ public int FindBinding(InputBinding bindingMask, out InputAction action)
+ {
+ return asset.FindBinding(bindingMask, out action);
+ }
+
+ // Camera
+ private readonly InputActionMap m_Camera;
+ private ICameraActions m_CameraActionsCallbackInterface;
+ private readonly InputAction m_Camera_Movement;
+ private readonly InputAction m_Camera_RotateCamera;
+ private readonly InputAction m_Camera_ZoomCamera;
+ public struct CameraActions
+ {
+ private @CameraControllActions m_Wrapper;
+ public CameraActions(@CameraControllActions wrapper) { m_Wrapper = wrapper; }
+ public InputAction @Movement => m_Wrapper.m_Camera_Movement;
+ public InputAction @RotateCamera => m_Wrapper.m_Camera_RotateCamera;
+ public InputAction @ZoomCamera => m_Wrapper.m_Camera_ZoomCamera;
+ public InputActionMap Get() { return m_Wrapper.m_Camera; }
+ public void Enable() { Get().Enable(); }
+ public void Disable() { Get().Disable(); }
+ public bool enabled => Get().enabled;
+ public static implicit operator InputActionMap(CameraActions set) { return set.Get(); }
+ public void SetCallbacks(ICameraActions instance)
+ {
+ if (m_Wrapper.m_CameraActionsCallbackInterface != null)
+ {
+ @Movement.started -= m_Wrapper.m_CameraActionsCallbackInterface.OnMovement;
+ @Movement.performed -= m_Wrapper.m_CameraActionsCallbackInterface.OnMovement;
+ @Movement.canceled -= m_Wrapper.m_CameraActionsCallbackInterface.OnMovement;
+ @RotateCamera.started -= m_Wrapper.m_CameraActionsCallbackInterface.OnRotateCamera;
+ @RotateCamera.performed -= m_Wrapper.m_CameraActionsCallbackInterface.OnRotateCamera;
+ @RotateCamera.canceled -= m_Wrapper.m_CameraActionsCallbackInterface.OnRotateCamera;
+ @ZoomCamera.started -= m_Wrapper.m_CameraActionsCallbackInterface.OnZoomCamera;
+ @ZoomCamera.performed -= m_Wrapper.m_CameraActionsCallbackInterface.OnZoomCamera;
+ @ZoomCamera.canceled -= m_Wrapper.m_CameraActionsCallbackInterface.OnZoomCamera;
+ }
+ m_Wrapper.m_CameraActionsCallbackInterface = instance;
+ if (instance != null)
+ {
+ @Movement.started += instance.OnMovement;
+ @Movement.performed += instance.OnMovement;
+ @Movement.canceled += instance.OnMovement;
+ @RotateCamera.started += instance.OnRotateCamera;
+ @RotateCamera.performed += instance.OnRotateCamera;
+ @RotateCamera.canceled += instance.OnRotateCamera;
+ @ZoomCamera.started += instance.OnZoomCamera;
+ @ZoomCamera.performed += instance.OnZoomCamera;
+ @ZoomCamera.canceled += instance.OnZoomCamera;
+ }
+ }
+ }
+ public CameraActions @Camera => new CameraActions(this);
+ public interface ICameraActions
+ {
+ void OnMovement(InputAction.CallbackContext context);
+ void OnRotateCamera(InputAction.CallbackContext context);
+ void OnZoomCamera(InputAction.CallbackContext context);
+ }
+}
diff --git a/Assets/InputSystem/CameraControllActions.cs.meta b/Assets/InputSystem/CameraControllActions.cs.meta
new file mode 100644
index 0000000..86327c0
--- /dev/null
+++ b/Assets/InputSystem/CameraControllActions.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 52ac121cad654304eab31002ee48c659
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/InputSystem/CameraControllActions.inputactions b/Assets/InputSystem/CameraControllActions.inputactions
new file mode 100644
index 0000000..01053e8
--- /dev/null
+++ b/Assets/InputSystem/CameraControllActions.inputactions
@@ -0,0 +1,118 @@
+{
+ "name": "CameraControllActions",
+ "maps": [
+ {
+ "name": "Camera",
+ "id": "e56b92c5-8fd9-4498-967b-a8a289d2ea2d",
+ "actions": [
+ {
+ "name": "Movement",
+ "type": "Value",
+ "id": "6d1751e7-bc18-45f3-ba28-1945c0630170",
+ "expectedControlType": "Vector2",
+ "processors": "",
+ "interactions": "",
+ "initialStateCheck": true
+ },
+ {
+ "name": "RotateCamera",
+ "type": "Value",
+ "id": "78a37640-f3de-4ef4-8ce2-48f71344fbad",
+ "expectedControlType": "Vector2",
+ "processors": "",
+ "interactions": "",
+ "initialStateCheck": true
+ },
+ {
+ "name": "ZoomCamera",
+ "type": "Value",
+ "id": "21086730-75a8-43cc-8b53-0ee2b54bf01f",
+ "expectedControlType": "Vector2",
+ "processors": "",
+ "interactions": "",
+ "initialStateCheck": true
+ }
+ ],
+ "bindings": [
+ {
+ "name": "2D Vector",
+ "id": "47f89b9c-94ea-4afd-afcb-3b77e0ec6033",
+ "path": "2DVector",
+ "interactions": "",
+ "processors": "",
+ "groups": "",
+ "action": "Movement",
+ "isComposite": true,
+ "isPartOfComposite": false
+ },
+ {
+ "name": "up",
+ "id": "34de0da3-759c-4218-b44d-920d156ddf0e",
+ "path": "/w",
+ "interactions": "",
+ "processors": "",
+ "groups": "",
+ "action": "Movement",
+ "isComposite": false,
+ "isPartOfComposite": true
+ },
+ {
+ "name": "down",
+ "id": "f9926638-c705-4e78-8b9a-ff59ab5326ec",
+ "path": "/s",
+ "interactions": "",
+ "processors": "",
+ "groups": "",
+ "action": "Movement",
+ "isComposite": false,
+ "isPartOfComposite": true
+ },
+ {
+ "name": "left",
+ "id": "53b6113e-e4f1-4b87-80a5-19c43df102c7",
+ "path": "/a",
+ "interactions": "",
+ "processors": "",
+ "groups": "",
+ "action": "Movement",
+ "isComposite": false,
+ "isPartOfComposite": true
+ },
+ {
+ "name": "right",
+ "id": "aa5061e6-662a-4969-b742-18ef7f2332e5",
+ "path": "/d",
+ "interactions": "",
+ "processors": "",
+ "groups": "",
+ "action": "Movement",
+ "isComposite": false,
+ "isPartOfComposite": true
+ },
+ {
+ "name": "",
+ "id": "305c7967-8fb9-4245-9d9f-70e40c553777",
+ "path": "/delta",
+ "interactions": "",
+ "processors": "",
+ "groups": "",
+ "action": "RotateCamera",
+ "isComposite": false,
+ "isPartOfComposite": false
+ },
+ {
+ "name": "",
+ "id": "cd712463-c5f3-49e7-877c-51c6f3440413",
+ "path": "/scroll",
+ "interactions": "",
+ "processors": "",
+ "groups": "",
+ "action": "ZoomCamera",
+ "isComposite": false,
+ "isPartOfComposite": false
+ }
+ ]
+ }
+ ],
+ "controlSchemes": []
+}
\ No newline at end of file
diff --git a/Assets/InputSystem/CameraControllActions.inputactions.meta b/Assets/InputSystem/CameraControllActions.inputactions.meta
new file mode 100644
index 0000000..4c19842
--- /dev/null
+++ b/Assets/InputSystem/CameraControllActions.inputactions.meta
@@ -0,0 +1,14 @@
+fileFormatVersion: 2
+guid: 1ed38b5ee37727f45b2a31c3fdb9d911
+ScriptedImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 2
+ userData:
+ assetBundleName:
+ assetBundleVariant:
+ script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3}
+ generateWrapperCode: 1
+ wrapperCodePath:
+ wrapperClassName:
+ wrapperCodeNamespace:
diff --git a/Assets/Scenes/Camera Test Scene.unity b/Assets/Scenes/Camera Test Scene.unity
new file mode 100644
index 0000000..1911ade
--- /dev/null
+++ b/Assets/Scenes/Camera Test Scene.unity
@@ -0,0 +1,697 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!29 &1
+OcclusionCullingSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_OcclusionBakeSettings:
+ smallestOccluder: 5
+ smallestHole: 0.25
+ backfaceThreshold: 100
+ m_SceneGUID: 00000000000000000000000000000000
+ m_OcclusionCullingData: {fileID: 0}
+--- !u!104 &2
+RenderSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 9
+ m_Fog: 0
+ m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
+ m_FogMode: 3
+ m_FogDensity: 0.01
+ m_LinearFogStart: 0
+ m_LinearFogEnd: 300
+ m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
+ m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
+ m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
+ m_AmbientIntensity: 1
+ m_AmbientMode: 0
+ m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
+ m_SkyboxMaterial: {fileID: 0}
+ m_HaloStrength: 0.5
+ m_FlareStrength: 1
+ m_FlareFadeSpeed: 3
+ m_HaloTexture: {fileID: 0}
+ m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
+ m_DefaultReflectionMode: 0
+ m_DefaultReflectionResolution: 128
+ m_ReflectionBounces: 1
+ m_ReflectionIntensity: 1
+ m_CustomReflection: {fileID: 0}
+ m_Sun: {fileID: 0}
+ m_IndirectSpecularColor: {r: 262.3369, g: 325.0498, b: 430.21924, a: 1}
+ m_UseRadianceAmbientProbe: 0
+--- !u!157 &3
+LightmapSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 12
+ m_GIWorkflowMode: 1
+ m_GISettings:
+ serializedVersion: 2
+ m_BounceScale: 1
+ m_IndirectOutputScale: 1
+ m_AlbedoBoost: 1
+ m_EnvironmentLightingMode: 0
+ m_EnableBakedLightmaps: 1
+ m_EnableRealtimeLightmaps: 0
+ m_LightmapEditorSettings:
+ serializedVersion: 12
+ m_Resolution: 2
+ m_BakeResolution: 40
+ m_AtlasSize: 1024
+ m_AO: 0
+ m_AOMaxDistance: 1
+ m_CompAOExponent: 1
+ m_CompAOExponentDirect: 0
+ m_ExtractAmbientOcclusion: 0
+ m_Padding: 2
+ m_LightmapParameters: {fileID: 0}
+ m_LightmapsBakeMode: 1
+ m_TextureCompression: 1
+ m_FinalGather: 0
+ m_FinalGatherFiltering: 1
+ m_FinalGatherRayCount: 256
+ m_ReflectionCompression: 2
+ m_MixedBakeMode: 2
+ m_BakeBackend: 1
+ m_PVRSampling: 1
+ m_PVRDirectSampleCount: 32
+ m_PVRSampleCount: 512
+ m_PVRBounces: 2
+ m_PVREnvironmentSampleCount: 256
+ m_PVREnvironmentReferencePointCount: 2048
+ m_PVRFilteringMode: 1
+ m_PVRDenoiserTypeDirect: 1
+ m_PVRDenoiserTypeIndirect: 1
+ m_PVRDenoiserTypeAO: 1
+ m_PVRFilterTypeDirect: 0
+ m_PVRFilterTypeIndirect: 0
+ m_PVRFilterTypeAO: 0
+ m_PVREnvironmentMIS: 1
+ m_PVRCulling: 1
+ m_PVRFilteringGaussRadiusDirect: 1
+ m_PVRFilteringGaussRadiusIndirect: 5
+ m_PVRFilteringGaussRadiusAO: 2
+ m_PVRFilteringAtrousPositionSigmaDirect: 0.5
+ m_PVRFilteringAtrousPositionSigmaIndirect: 2
+ m_PVRFilteringAtrousPositionSigmaAO: 1
+ m_ExportTrainingData: 0
+ m_TrainingDataDestination: TrainingData
+ m_LightProbeSampleCountMultiplier: 4
+ m_LightingDataAsset: {fileID: 0}
+ m_LightingSettings: {fileID: 0}
+--- !u!196 &4
+NavMeshSettings:
+ serializedVersion: 2
+ m_ObjectHideFlags: 0
+ m_BuildSettings:
+ serializedVersion: 2
+ agentTypeID: 0
+ agentRadius: 0.5
+ agentHeight: 2
+ agentSlope: 45
+ agentClimb: 0.4
+ ledgeDropHeight: 0
+ maxJumpAcrossDistance: 0
+ minRegionArea: 2
+ manualCellSize: 0
+ cellSize: 0.16666667
+ manualTileSize: 0
+ tileSize: 256
+ accuratePlacement: 0
+ maxJobWorkers: 0
+ preserveTilesOutsideBounds: 0
+ debug:
+ m_Flags: 0
+ m_NavMeshData: {fileID: 0}
+--- !u!1 &204534861
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 204534863}
+ - component: {fileID: 204534862}
+ m_Layer: 0
+ m_Name: CameraRigBase
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!114 &204534862
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 204534861}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 3aa4e7fcdd1707b4e9384dc1d17779ac, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ maxSpeed: 5
+ acceleration: 10
+ damping: 15
+ stepSize: 2
+ zoomDampening: 7.5
+ minHeight: 5
+ maxHeight: 50
+ zoomSpeed: 2
+ maxRotationSpeed: 1
+ edgeTolerance: 0.05
+ useScreenEdge: 1
+--- !u!4 &204534863
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 204534861}
+ 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:
+ - {fileID: 529089915}
+ - {fileID: 404902390}
+ m_Father: {fileID: 0}
+ m_RootOrder: 3
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &404902389
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 404902390}
+ - component: {fileID: 404902393}
+ - component: {fileID: 404902392}
+ - component: {fileID: 404902391}
+ m_Layer: 0
+ m_Name: Sphere
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &404902390
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 404902389}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1.23, y: 1.23, z: 1.23}
+ m_ConstrainProportionsScale: 1
+ m_Children: []
+ m_Father: {fileID: 204534863}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!135 &404902391
+SphereCollider:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 404902389}
+ m_Material: {fileID: 0}
+ m_IsTrigger: 0
+ m_Enabled: 1
+ serializedVersion: 2
+ m_Radius: 0.5
+ m_Center: {x: 0, y: 0, z: 0}
+--- !u!23 &404902392
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 404902389}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_StaticShadowCaster: 0
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_RayTracingMode: 2
+ m_RayTraceProcedural: 0
+ m_RenderingLayerMask: 257
+ m_RendererPriority: 0
+ m_Materials:
+ - {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, 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
+ m_AdditionalVertexStreams: {fileID: 0}
+--- !u!33 &404902393
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 404902389}
+ m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!1 &529089912
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 529089915}
+ - component: {fileID: 529089914}
+ - component: {fileID: 529089913}
+ - component: {fileID: 529089916}
+ 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 &529089913
+AudioListener:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 529089912}
+ m_Enabled: 1
+--- !u!20 &529089914
+Camera:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 529089912}
+ m_Enabled: 1
+ serializedVersion: 2
+ m_ClearFlags: 1
+ m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
+ m_projectionMatrixMode: 1
+ m_GateFitMode: 2
+ m_FOVAxisMode: 0
+ m_SensorSize: {x: 36, y: 24}
+ m_LensShift: {x: 0, y: 0}
+ m_FocalLength: 50
+ 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: 0
+ m_AllowMSAA: 0
+ m_AllowDynamicResolution: 0
+ m_ForceIntoRT: 0
+ m_OcclusionCulling: 1
+ m_StereoConvergence: 10
+ m_StereoSeparation: 0.022
+--- !u!4 &529089915
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 529089912}
+ m_LocalRotation: {x: 0.22571622, y: 0, z: 0, w: 0.97419316}
+ m_LocalPosition: {x: 0, y: 8, z: -8}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 204534863}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 26.09, y: 0, z: 0}
+--- !u!114 &529089916
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 529089912}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 23c1ce4fb46143f46bc5cb5224c934f6, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ clearColorMode: 0
+ backgroundColorHDR: {r: 0.025, g: 0.07, b: 0.19, a: 0}
+ clearDepth: 1
+ volumeLayerMask:
+ serializedVersion: 2
+ m_Bits: 1
+ volumeAnchorOverride: {fileID: 0}
+ antialiasing: 0
+ SMAAQuality: 2
+ dithering: 0
+ stopNaNs: 0
+ taaSharpenStrength: 0.5
+ TAAQuality: 1
+ taaHistorySharpening: 0.35
+ taaAntiFlicker: 0.5
+ taaMotionVectorRejection: 0
+ taaAntiHistoryRinging: 0
+ taaBaseBlendFactor: 0.875
+ taaJitterScale: 1
+ physicalParameters:
+ m_Iso: 200
+ m_ShutterSpeed: 0.005
+ m_Aperture: 16
+ m_FocusDistance: 10
+ m_BladeCount: 5
+ m_Curvature: {x: 2, y: 11}
+ m_BarrelClipping: 0.25
+ m_Anamorphism: 0
+ flipYMode: 0
+ xrRendering: 1
+ fullscreenPassthrough: 0
+ allowDynamicResolution: 0
+ customRenderingSettings: 0
+ invertFaceCulling: 0
+ probeLayerMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+ hasPersistentHistory: 0
+ allowDeepLearningSuperSampling: 1
+ deepLearningSuperSamplingUseCustomQualitySettings: 0
+ deepLearningSuperSamplingQuality: 0
+ deepLearningSuperSamplingUseCustomAttributes: 0
+ deepLearningSuperSamplingUseOptimalSettings: 1
+ deepLearningSuperSamplingSharpening: 0
+ exposureTarget: {fileID: 0}
+ materialMipBias: 0
+ m_RenderingPathCustomFrameSettings:
+ bitDatas:
+ data1: 72198260625768269
+ data2: 13763000477350330392
+ lodBias: 1
+ lodBiasMode: 0
+ lodBiasQualityLevel: 0
+ maximumLODLevel: 0
+ maximumLODLevelMode: 0
+ maximumLODLevelQualityLevel: 0
+ sssQualityMode: 0
+ sssQualityLevel: 0
+ sssCustomSampleBudget: 20
+ msaaMode: 1
+ materialQuality: 0
+ renderingPathCustomFrameSettingsOverrideMask:
+ mask:
+ data1: 0
+ data2: 0
+ defaultFrameSettings: 0
+ m_Version: 8
+ m_ObsoleteRenderingPath: 0
+ m_ObsoleteFrameSettings:
+ overrides: 0
+ enableShadow: 0
+ enableContactShadows: 0
+ enableShadowMask: 0
+ enableSSR: 0
+ enableSSAO: 0
+ enableSubsurfaceScattering: 0
+ enableTransmission: 0
+ enableAtmosphericScattering: 0
+ enableVolumetrics: 0
+ enableReprojectionForVolumetrics: 0
+ enableLightLayers: 0
+ enableExposureControl: 1
+ diffuseGlobalDimmer: 0
+ specularGlobalDimmer: 0
+ shaderLitMode: 0
+ enableDepthPrepassWithDeferredRendering: 0
+ enableTransparentPrepass: 0
+ enableMotionVectors: 0
+ enableObjectMotionVectors: 0
+ enableDecals: 0
+ enableRoughRefraction: 0
+ enableTransparentPostpass: 0
+ enableDistortion: 0
+ enablePostprocess: 0
+ enableOpaqueObjects: 0
+ enableTransparentObjects: 0
+ enableRealtimePlanarReflection: 0
+ enableMSAA: 0
+ enableAsyncCompute: 0
+ runLightListAsync: 0
+ runSSRAsync: 0
+ runSSAOAsync: 0
+ runContactShadowsAsync: 0
+ runVolumeVoxelizationAsync: 0
+ lightLoopSettings:
+ overrides: 0
+ enableDeferredTileAndCluster: 0
+ enableComputeLightEvaluation: 0
+ enableComputeLightVariants: 0
+ enableComputeMaterialVariants: 0
+ enableFptlForForwardOpaque: 0
+ enableBigTilePrepass: 0
+ isFptlEnabled: 0
+--- !u!1001 &1709176920
+PrefabInstance:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_Modification:
+ m_TransformParent: {fileID: 0}
+ m_Modifications:
+ - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_RootOrder
+ value: 2
+ objectReference: {fileID: 0}
+ - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_LocalPosition.x
+ value: 0.83846664
+ objectReference: {fileID: 0}
+ - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_LocalPosition.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_LocalPosition.z
+ value: 9.838127
+ objectReference: {fileID: 0}
+ - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_LocalRotation.w
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_LocalRotation.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_LocalRotation.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_LocalRotation.z
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_LocalEulerAnglesHint.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_LocalEulerAnglesHint.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_LocalEulerAnglesHint.z
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 8704396752535238434, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_Name
+ value: Turret
+ objectReference: {fileID: 0}
+ m_RemovedComponents: []
+ m_SourcePrefab: {fileID: 100100000, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+--- !u!1 &1723540118
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1723540120}
+ - component: {fileID: 1723540119}
+ m_Layer: 0
+ m_Name: Directional Light
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!108 &1723540119
+Light:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1723540118}
+ m_Enabled: 1
+ serializedVersion: 10
+ m_Type: 1
+ m_Shape: 0
+ m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
+ m_Intensity: 1
+ m_Range: 10
+ m_SpotAngle: 30
+ m_InnerSpotAngle: 21.80208
+ m_CookieSize: 10
+ m_Shadows:
+ m_Type: 2
+ m_Resolution: -1
+ m_CustomResolution: -1
+ m_Strength: 1
+ m_Bias: 0.05
+ m_NormalBias: 0.4
+ m_NearPlane: 0.2
+ m_CullingMatrixOverride:
+ e00: 1
+ e01: 0
+ e02: 0
+ e03: 0
+ e10: 0
+ e11: 1
+ e12: 0
+ e13: 0
+ e20: 0
+ e21: 0
+ e22: 1
+ e23: 0
+ e30: 0
+ e31: 0
+ e32: 0
+ e33: 1
+ m_UseCullingMatrixOverride: 0
+ m_Cookie: {fileID: 0}
+ m_DrawHalo: 0
+ m_Flare: {fileID: 0}
+ m_RenderMode: 0
+ m_CullingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+ m_RenderingLayerMask: 1
+ m_Lightmapping: 4
+ m_LightShadowCasterMode: 0
+ m_AreaSize: {x: 1, y: 1}
+ m_BounceIntensity: 1
+ m_ColorTemperature: 6570
+ m_UseColorTemperature: 0
+ m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
+ m_UseBoundingSphereOverride: 0
+ m_UseViewFrustumForShadowCasterCull: 1
+ m_ShadowRadius: 0
+ m_ShadowAngle: 0
+--- !u!4 &1723540120
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1723540118}
+ m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
+ m_LocalPosition: {x: 0, y: 3, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_ConstrainProportionsScale: 0
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
+--- !u!1001 &1897191913
+PrefabInstance:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_Modification:
+ m_TransformParent: {fileID: 0}
+ m_Modifications:
+ - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_RootOrder
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_LocalPosition.x
+ value: -0.49623775
+ objectReference: {fileID: 0}
+ - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_LocalPosition.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_LocalPosition.z
+ value: 5.590846
+ objectReference: {fileID: 0}
+ - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_LocalRotation.w
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_LocalRotation.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_LocalRotation.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_LocalRotation.z
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_LocalEulerAnglesHint.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_LocalEulerAnglesHint.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 8324879816836607384, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_LocalEulerAnglesHint.z
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 8704396752535238434, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
+ propertyPath: m_Name
+ value: Turret (1)
+ objectReference: {fileID: 0}
+ m_RemovedComponents: []
+ m_SourcePrefab: {fileID: 100100000, guid: 534f8d15e0c83c646887bebfda2bdfd6, type: 3}
diff --git a/Assets/Scenes/Camera Test Scene.unity.meta b/Assets/Scenes/Camera Test Scene.unity.meta
new file mode 100644
index 0000000..941d9b6
--- /dev/null
+++ b/Assets/Scenes/Camera Test Scene.unity.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 1aea12621e4454646ba01f66c0bcdb5b
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts.meta b/Assets/Scripts.meta
new file mode 100644
index 0000000..8903bae
--- /dev/null
+++ b/Assets/Scripts.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 8c0ac7297abde3b43a2adfad45862dbb
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/CameraController.cs b/Assets/Scripts/CameraController.cs
new file mode 100644
index 0000000..0195b36
--- /dev/null
+++ b/Assets/Scripts/CameraController.cs
@@ -0,0 +1,210 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.InputSystem;
+
+namespace AsteroidGame
+{
+ public class CameraController : MonoBehaviour
+ {
+ private CameraControllActions cameraActions;
+ private InputAction movement;
+ private Transform cameraTransform;
+
+ // Horizontal Movement
+ [SerializeField]
+ private float maxSpeed = 5f;
+ private float speed;
+ [SerializeField]
+ private float acceleration = 10f;
+ [SerializeField]
+ private float damping = 15f;
+
+ //Vertial Motion - Zooming
+ [SerializeField]
+ private float stepSize = 2f;
+ [SerializeField]
+ private float zoomDampening = 7.5f;
+ [SerializeField]
+ private float minHeight = 5f;
+ [SerializeField]
+ private float maxHeight = 50f;
+ [SerializeField]
+ private float zoomSpeed = 2f;
+
+ //Rotation
+ [SerializeField]
+ private float maxRotationSpeed = 1f;
+
+ //Screen Edge Motion
+ [SerializeField]
+ [Range(0f, 0.1f)]
+ private float edgeTolerance = 0.05f;
+ [SerializeField]
+ private bool useScreenEdge = false;
+
+ private Vector3 targetPosition;
+ private float zoomHeight;
+ private Vector3 horizontalVelocity;
+ private Vector3 lastPosition;
+
+ Vector3 startDrag;
+
+ private void Awake()
+ {
+ cameraActions = new CameraControllActions();
+ cameraTransform = this.GetComponentInChildren().transform;
+ }
+
+ private void OnEnable()
+ {
+ zoomHeight = cameraTransform.localPosition.y;
+ cameraTransform.LookAt(this.transform);
+ lastPosition = this.transform.position;
+ movement = cameraActions.Camera.Movement;
+ cameraActions.Camera.RotateCamera.performed += RotateCamera;
+ cameraActions.Camera.ZoomCamera.performed += ZoomCamera;
+ cameraActions.Camera.Enable();
+
+ }
+
+ private void OnDisable()
+ {
+ cameraActions.Camera.RotateCamera.performed -= RotateCamera;
+ cameraActions.Camera.ZoomCamera.performed -= ZoomCamera;
+ cameraActions.Disable();
+ }
+
+
+
+ private void Update()
+ {
+ GetKeyboardMovement();
+ if (useScreenEdge)
+ {
+ CheckMouseAtScreenEdge();
+ }
+ DragCamera();
+ UpdateVelocity();
+ UpdateCameraPosition();
+ UpdateBasePosition();
+
+ }
+
+ private void UpdateVelocity()
+ {
+ horizontalVelocity = (this.transform.position - lastPosition) / Time.deltaTime;
+ horizontalVelocity.y = 0;
+ lastPosition = this.transform.position;
+ }
+
+ private void GetKeyboardMovement()
+ {
+ Vector3 inputValue = movement.ReadValue().x * GetCameraRight()
+ + movement.ReadValue().y * GetCameraForward();
+ inputValue = inputValue.normalized;
+
+ if (inputValue.sqrMagnitude > 0.1f)
+ {
+ targetPosition += inputValue;
+ }
+ }
+
+ private Vector3 GetCameraRight()
+ {
+ Vector3 right = cameraTransform.right;
+ right.y = 0;
+ return right;
+ }
+
+ private Vector3 GetCameraForward()
+ {
+ Vector3 forward = cameraTransform.forward;
+ forward.y = 0;
+ return forward;
+ }
+
+ private void UpdateBasePosition()
+ {
+ if (targetPosition.sqrMagnitude > 0.1f)
+ {
+ speed = Mathf.Lerp(speed, maxSpeed, Time.deltaTime * acceleration);
+ transform.position += targetPosition * speed * Time.deltaTime;
+ }
+ else
+ {
+ horizontalVelocity = Vector3.Lerp(horizontalVelocity, Vector3.zero, Time.deltaTime * damping);
+ transform.position += horizontalVelocity * Time.deltaTime;
+ }
+
+ targetPosition = Vector3.zero;
+ }
+
+ private void RotateCamera(InputAction.CallbackContext inputValue)
+ {
+ if (!Mouse.current.middleButton.isPressed) { return; }
+
+ float value = inputValue.ReadValue().x;
+ transform.rotation = Quaternion.Euler(0f, value * maxRotationSpeed + transform.rotation.eulerAngles.y, 0f);
+ }
+
+ private void ZoomCamera(InputAction.CallbackContext inputValue)
+ {
+ float value = -inputValue.ReadValue().y / 100f;
+
+ if (Mathf.Abs(value) > 0.1f)
+ {
+ zoomHeight = cameraTransform.localPosition.y + value * stepSize;
+ if (zoomHeight < minHeight)
+ zoomHeight = minHeight;
+ else if (zoomHeight > maxHeight)
+ zoomHeight = maxHeight;
+ }
+ }
+
+ private void UpdateCameraPosition()
+ {
+ Vector3 zoomTarget = new Vector3(cameraTransform.localPosition.x, zoomHeight, cameraTransform.localPosition.z);
+ zoomTarget -= zoomSpeed * (zoomHeight - cameraTransform.localPosition.y) * Vector3.forward;
+
+ cameraTransform.localPosition = Vector3.Lerp(cameraTransform.localPosition, zoomTarget, Time.deltaTime * zoomDampening);
+ cameraTransform.LookAt(this.transform);
+ }
+
+ private void CheckMouseAtScreenEdge()
+ {
+ Vector2 mousePosition = Mouse.current.position.ReadValue();
+ Vector3 moveDirection = Vector3.zero;
+
+ if (mousePosition.x < edgeTolerance * Screen.width)
+ moveDirection += -GetCameraRight();
+ else if (mousePosition.x > (1f - edgeTolerance) * Screen.width)
+ moveDirection += GetCameraRight();
+
+ if (mousePosition.y < edgeTolerance * Screen.height)
+ moveDirection += -GetCameraForward();
+ else if (mousePosition.y > (1f - edgeTolerance) * Screen.height)
+ moveDirection += GetCameraForward();
+
+ targetPosition += moveDirection;
+ }
+
+ private void DragCamera()
+ {
+ if (!Mouse.current.rightButton.isPressed) { return; }
+
+ Plane plane = new Plane(Vector3.up, Vector3.zero);
+ Ray ray = Camera.main.ScreenPointToRay(Mouse.current.position.ReadValue());
+ if (plane.Raycast(ray,out float distance))
+ {
+ if (Mouse.current.rightButton.wasPressedThisFrame)
+ startDrag = ray.GetPoint(distance);
+ else
+ targetPosition += startDrag - ray.GetPoint(distance);
+ }
+ }
+
+
+ }
+}
diff --git a/Assets/Scripts/CameraController.cs.meta b/Assets/Scripts/CameraController.cs.meta
new file mode 100644
index 0000000..0206e77
--- /dev/null
+++ b/Assets/Scripts/CameraController.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 3aa4e7fcdd1707b4e9384dc1d17779ac
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: