diff --git a/DarkFlow/Assets/Prefabs/PlayerFollowCamera.prefab b/DarkFlow/Assets/Prefabs/PlayerFollowCamera.prefab index e4593e1..f0b1a11 100644 --- a/DarkFlow/Assets/Prefabs/PlayerFollowCamera.prefab +++ b/DarkFlow/Assets/Prefabs/PlayerFollowCamera.prefab @@ -75,7 +75,7 @@ GameObject: - component: {fileID: 368218139850001400} m_Layer: 0 m_Name: PlayerFollowCamera - m_TagString: Untagged + m_TagString: PlayerFollowCamera m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 diff --git a/DarkFlow/Assets/Scenes/Gameplay.unity b/DarkFlow/Assets/Scenes/Gameplay.unity index a5c2414..da9636d 100644 --- a/DarkFlow/Assets/Scenes/Gameplay.unity +++ b/DarkFlow/Assets/Scenes/Gameplay.unity @@ -125,6 +125,55 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!1 &107306944 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 3984814823395178536, guid: 773b39ed367c011418f28a8bc3b8ca31, + type: 3} + m_PrefabInstance: {fileID: 1889354785} + m_PrefabAsset: {fileID: 0} +--- !u!114 &107306948 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 107306944} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bd6043bde05a7fc4cba197d06915c1e3, type: 3} + m_Name: + m_EditorClassIdentifier: + Damping: {x: 0.1, y: 0.5, z: 0.3} + ShoulderOffset: {x: 0, y: 0, z: -4} + VerticalArmLength: 0.4 + CameraSide: 1 + CameraDistance: 2 + CameraCollisionFilter: + serializedVersion: 2 + m_Bits: 0 + IgnoreTag: + CameraRadius: 0.2 + DampingIntoCollision: 0 + DampingFromCollision: 2 +--- !u!1 &826060407 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 8854747452121219810, guid: 773b39ed367c011418f28a8bc3b8ca31, + type: 3} + m_PrefabInstance: {fileID: 1889354785} + m_PrefabAsset: {fileID: 0} +--- !u!114 &826060411 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 826060407} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 437c8746001a80e4cba174abbfefa9ed, type: 3} + m_Name: + m_EditorClassIdentifier: + m_CamFollow: {fileID: 1889354786} --- !u!1001 &898180339 PrefabInstance: m_ObjectHideFlags: 0 @@ -229,7 +278,7 @@ PrefabInstance: - target: {fileID: 6818833442393802120, guid: 154519ab488f20d468de4e06396e2441, type: 3} propertyPath: field of view - value: 40 + value: 39.9 objectReference: {fileID: 0} - target: {fileID: 6818833442393802120, guid: 154519ab488f20d468de4e06396e2441, type: 3} @@ -259,12 +308,12 @@ PrefabInstance: - target: {fileID: 6818833442393802123, guid: 154519ab488f20d468de4e06396e2441, type: 3} propertyPath: m_LocalPosition.y - value: 0.66 + value: 112.660286 objectReference: {fileID: 0} - target: {fileID: 6818833442393802123, guid: 154519ab488f20d468de4e06396e2441, type: 3} propertyPath: m_LocalPosition.z - value: -8.07 + value: -1688.0701 objectReference: {fileID: 0} - target: {fileID: 6818833442393802123, guid: 154519ab488f20d468de4e06396e2441, type: 3} @@ -438,11 +487,26 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: + - target: {fileID: 368218139850001400, guid: 773b39ed367c011418f28a8bc3b8ca31, + type: 3} + propertyPath: m_Lens.FieldOfView + value: 39.9 + objectReference: {fileID: 0} + - target: {fileID: 8854747452121219810, guid: 773b39ed367c011418f28a8bc3b8ca31, + type: 3} + propertyPath: m_Icon + value: + objectReference: {fileID: 2800000, guid: ec2f01df0bb1bfe459b5562a9e71c8d4, type: 3} - target: {fileID: 8854747452121219810, guid: 773b39ed367c011418f28a8bc3b8ca31, type: 3} propertyPath: m_Name value: PlayerFollowCamera objectReference: {fileID: 0} + - target: {fileID: 8854747452121219810, guid: 773b39ed367c011418f28a8bc3b8ca31, + type: 3} + propertyPath: m_TagString + value: PlayerFollowCamera + objectReference: {fileID: 0} - target: {fileID: 8854747452121219813, guid: 773b39ed367c011418f28a8bc3b8ca31, type: 3} propertyPath: GlobalObjectIdHash @@ -456,12 +520,12 @@ PrefabInstance: - target: {fileID: 8854747452121219814, guid: 773b39ed367c011418f28a8bc3b8ca31, type: 3} propertyPath: m_LocalPosition.y - value: 0.66 + value: 112.660286 objectReference: {fileID: 0} - target: {fileID: 8854747452121219814, guid: 773b39ed367c011418f28a8bc3b8ca31, type: 3} propertyPath: m_LocalPosition.z - value: -8.07 + value: -1688.0701 objectReference: {fileID: 0} - target: {fileID: 8854747452121219814, guid: 773b39ed367c011418f28a8bc3b8ca31, type: 3} @@ -501,8 +565,28 @@ PrefabInstance: m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] - m_AddedComponents: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 8854747452121219810, guid: 773b39ed367c011418f28a8bc3b8ca31, + type: 3} + insertIndex: -1 + addedObject: {fileID: 826060411} + - targetCorrespondingSourceObject: {fileID: 3984814823395178536, guid: 773b39ed367c011418f28a8bc3b8ca31, + type: 3} + insertIndex: -1 + addedObject: {fileID: 107306948} m_SourcePrefab: {fileID: 100100000, guid: 773b39ed367c011418f28a8bc3b8ca31, type: 3} +--- !u!114 &1889354786 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 368218139850001400, guid: 773b39ed367c011418f28a8bc3b8ca31, + type: 3} + m_PrefabInstance: {fileID: 1889354785} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 826060407} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 45e653bab7fb20e499bda25e1b646fea, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1001 &7539522792693849209 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/DarkFlow/Assets/Scripts/CameraController.cs b/DarkFlow/Assets/Scripts/CameraController.cs new file mode 100644 index 0000000..5b9ac4f --- /dev/null +++ b/DarkFlow/Assets/Scripts/CameraController.cs @@ -0,0 +1,42 @@ +using Cinemachine; +using UnityEngine; +//using UnityEngine.Assertions; + +public class CameraController : MonoBehaviour +{ + + //private CinemachineVirtualCamera m_MainCamera; + private Transform m_CharFollow; + public CinemachineVirtualCamera m_CamFollow; + + void Start() + { + AttachCamera(); + } + + private void AttachCamera() + { + //m_MainCamera = GameObject.FindObjectOfType(); + //Assert.IsNotNull(m_MainCamera, "Couldn't find gameplay camera"); + + m_CharFollow = GameObject.FindGameObjectWithTag("Player").transform.GetChild(0).transform; + + //if (m_MainCamera) + if (m_CamFollow) + { + //m_MainCamera.Follow = m_CharFollow; + m_CamFollow.Follow = m_CharFollow; + //m_MainCamera.LookAt = m_CharFollow; + m_CamFollow.LookAt = m_CharFollow; + + // camera body / aim + //m_MainCamera.Follow = transform; + //m_MainCamera.LookAt = transform; + // default rotation / zoom + // m_MainCamera.m_Heading.m_Bias = 40f; + //m_MainCamera.m_YAxis.Value = 0.5f; + + } + } +} + diff --git a/DarkFlow/Assets/Scripts/CameraController.cs.meta b/DarkFlow/Assets/Scripts/CameraController.cs.meta new file mode 100644 index 0000000..89ce0b6 --- /dev/null +++ b/DarkFlow/Assets/Scripts/CameraController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 437c8746001a80e4cba174abbfefa9ed +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/DarkFlow/ProjectSettings/TagManager.asset b/DarkFlow/ProjectSettings/TagManager.asset index 867d715..af3fa0f 100644 --- a/DarkFlow/ProjectSettings/TagManager.asset +++ b/DarkFlow/ProjectSettings/TagManager.asset @@ -3,7 +3,8 @@ --- !u!78 &1 TagManager: serializedVersion: 2 - tags: [] + tags: + - PlayerFollowCamera layers: - Default - TransparentFX