diff --git a/Project Undercover/Assets/Prefabs/Guard Camera.prefab b/Project Undercover/Assets/Prefabs/Guard Camera.prefab new file mode 100644 index 0000000..6e02bc9 --- /dev/null +++ b/Project Undercover/Assets/Prefabs/Guard Camera.prefab @@ -0,0 +1,114 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 1889434021946074} + m_IsPrefabParent: 1 +--- !u!1 &1889434021946074 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4661043116803332} + - component: {fileID: 114306799516802978} + - component: {fileID: 20437103875467350} + - component: {fileID: 124909405360866564} + - component: {fileID: 92524413853108834} + - component: {fileID: 81070402336043930} + m_Layer: 0 + m_Name: Guard Camera + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4661043116803332 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1889434021946074} + m_LocalRotation: {x: 0.35355338, y: -0.35355338, z: 0.1464466, w: 0.8535535} + m_LocalPosition: {x: 4.5, y: 3, z: -4.5} + m_LocalScale: {x: 0.5, y: 1, z: 0.5} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 45, y: -45, z: 0} +--- !u!20 &20437103875467350 +Camera: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1889434021946074} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 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: 0 + 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_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 + m_StereoMirrorMode: 0 +--- !u!81 &81070402336043930 +AudioListener: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1889434021946074} + m_Enabled: 1 +--- !u!92 &92524413853108834 +Behaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1889434021946074} + m_Enabled: 1 +--- !u!114 &114306799516802978 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1889434021946074} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1ef9de564c5529c4faeace3894ec9e0b, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!124 &124909405360866564 +Behaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1889434021946074} + m_Enabled: 1 diff --git a/Project Undercover/Assets/Prefabs/Guard Camera.prefab.meta b/Project Undercover/Assets/Prefabs/Guard Camera.prefab.meta new file mode 100644 index 0000000..f8f1380 --- /dev/null +++ b/Project Undercover/Assets/Prefabs/Guard Camera.prefab.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c67fa24334c0f364cad8798522e92116 +timeCreated: 1505745890 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Project Undercover/Assets/Scenes/scene.meta b/Project Undercover/Assets/Scenes/scene.meta new file mode 100644 index 0000000..a7874ba --- /dev/null +++ b/Project Undercover/Assets/Scenes/scene.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 320b8ace903cab542b05f6b990f62ebe +folderAsset: yes +timeCreated: 1505749249 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Project Undercover/Assets/Scenes/scene.unity b/Project Undercover/Assets/Scenes/scene.unity index 2456cfc..082810c 100644 --- a/Project Undercover/Assets/Scenes/scene.unity +++ b/Project Undercover/Assets/Scenes/scene.unity @@ -107,7 +107,7 @@ NavMeshSettings: manualTileSize: 0 tileSize: 256 accuratePlacement: 0 - m_NavMeshData: {fileID: 0} + m_NavMeshData: {fileID: 23800000, guid: d7eb36ff892a3a7438b868633aac89d0, type: 2} --- !u!1 &36514389 GameObject: m_ObjectHideFlags: 0 @@ -154,6 +154,64 @@ Transform: m_PrefabParentObject: {fileID: 4550573785341638, guid: b25e969032ebb1f4089308db11ee93b1, type: 2} m_PrefabInternal: {fileID: 377057537} +--- !u!1001 &339319393 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 1265248828} + m_Modifications: + - target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2} + propertyPath: m_LocalPosition.x + value: 4.5 + objectReference: {fileID: 0} + - target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2} + propertyPath: m_LocalPosition.y + value: -2.2143593 + objectReference: {fileID: 0} + - target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2} + propertyPath: m_LocalPosition.z + value: 2.512637 + objectReference: {fileID: 0} + - target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2} + propertyPath: m_LocalRotation.x + value: -0.12059054 + objectReference: {fileID: 0} + - target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2} + propertyPath: m_LocalRotation.y + value: -0.23296288 + objectReference: {fileID: 0} + - target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2} + propertyPath: m_LocalRotation.z + value: 0.30360317 + objectReference: {fileID: 0} + - target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2} + propertyPath: m_LocalRotation.w + value: 0.9159756 + objectReference: {fileID: 0} + - target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1889434021946074, guid: c67fa24334c0f364cad8798522e92116, type: 2} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2} + propertyPath: m_LocalScale.x + value: 0.5857144 + objectReference: {fileID: 0} + - target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2} + propertyPath: m_LocalScale.y + value: 1.3149345 + objectReference: {fileID: 0} + - target: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, type: 2} + propertyPath: m_LocalScale.z + value: 0.3425328 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: c67fa24334c0f364cad8798522e92116, type: 2} + m_IsPrefabParent: 0 --- !u!1001 &377057537 Prefab: m_ObjectHideFlags: 0 @@ -205,6 +263,11 @@ Transform: m_PrefabParentObject: {fileID: 4550573785341638, guid: b25e969032ebb1f4089308db11ee93b1, type: 2} m_PrefabInternal: {fileID: 1032732991} +--- !u!4 &413537378 stripped +Transform: + m_PrefabParentObject: {fileID: 4661043116803332, guid: c67fa24334c0f364cad8798522e92116, + type: 2} + m_PrefabInternal: {fileID: 339319393} --- !u!1001 &415128191 Prefab: m_ObjectHideFlags: 0 @@ -320,6 +383,7 @@ GameObject: - component: {fileID: 966385052} - component: {fileID: 966385056} - component: {fileID: 966385057} + - component: {fileID: 966385058} m_Layer: 0 m_Name: Player m_TagString: Untagged @@ -387,8 +451,7 @@ Transform: m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0.5, z: 0} m_LocalScale: {x: 0.5, y: 1, z: 0.5} - m_Children: - - {fileID: 1353476744} + m_Children: [] m_Father: {fileID: 0} m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -419,7 +482,27 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: particle: {fileID: 1057615597006810, guid: b25e969032ebb1f4089308db11ee93b1, type: 2} - TransitionSpeed: 1 +--- !u!195 &966385058 +NavMeshAgent: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 966385051} + m_Enabled: 1 + m_AgentTypeID: 0 + m_Radius: 0.5 + m_Speed: 1.3 + m_Acceleration: 20 + avoidancePriority: 50 + m_AngularSpeed: 0 + m_StoppingDistance: 0 + m_AutoTraverseOffMeshLink: 0 + m_AutoBraking: 1 + m_AutoRepath: 1 + m_Height: 1 + m_BaseOffset: 0.5 + m_WalkableMask: 4294967295 + m_ObstacleAvoidanceType: 2 --- !u!4 &984138133 stripped Transform: m_PrefabParentObject: {fileID: 4550573785341638, guid: b25e969032ebb1f4089308db11ee93b1, @@ -558,6 +641,36 @@ Transform: m_Father: {fileID: 1430923538} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1265248827 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1265248828} + m_Layer: 0 + m_Name: Cameras + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1265248828 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1265248827} + m_LocalRotation: {x: 0.5, y: -0, z: -0, w: 0.8660254} + m_LocalPosition: {x: 0, y: 7.5, z: -5.5} + m_LocalScale: {x: 1, y: 0.625, z: 1.7499999} + m_Children: + - {fileID: 413537378} + - {fileID: 1353476744} + m_Father: {fileID: 0} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1267399098 GameObject: m_ObjectHideFlags: 0 @@ -699,12 +812,13 @@ GameObject: serializedVersion: 5 m_Component: - component: {fileID: 1353476744} + - component: {fileID: 1353476745} - component: {fileID: 1353476743} - component: {fileID: 1353476742} - component: {fileID: 1353476741} - component: {fileID: 1353476740} m_Layer: 0 - m_Name: Main Camera + m_Name: Spy Camera m_TagString: MainCamera m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -773,13 +887,24 @@ Transform: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1353476739} - m_LocalRotation: {x: 0.5, y: 0, z: 0, w: 0.8660254} - m_LocalPosition: {x: 0, y: 7, z: -11} - m_LocalScale: {x: 2, y: 1, z: 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_Children: [] - m_Father: {fileID: 966385055} - m_RootOrder: 0 + m_Father: {fileID: 1265248828} + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 60, y: 0, z: 0} +--- !u!114 &1353476745 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1353476739} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5277ef44f4e110947993697cba721d20, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1430923537 GameObject: m_ObjectHideFlags: 0 @@ -802,8 +927,8 @@ Transform: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1430923537} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0.37170354, y: 1.9782486, z: -0.23928754} - m_LocalScale: {x: 1, y: 1, z: 1} + m_LocalPosition: {x: 0.37170354, y: 6, z: -0.23928754} + m_LocalScale: {x: 1, y: 3, z: 1} m_Children: - {fileID: 1141970351} - {fileID: 1267399102} @@ -1007,7 +1132,7 @@ GameObject: m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 + m_StaticEditorFlags: 8 m_IsActive: 1 --- !u!23 &1873926729 MeshRenderer: diff --git a/Project Undercover/Assets/Scenes/scene/NavMesh.asset b/Project Undercover/Assets/Scenes/scene/NavMesh.asset new file mode 100644 index 0000000..c81ff1d Binary files /dev/null and b/Project Undercover/Assets/Scenes/scene/NavMesh.asset differ diff --git a/Project Undercover/Assets/Scenes/scene/NavMesh.asset.meta b/Project Undercover/Assets/Scenes/scene/NavMesh.asset.meta new file mode 100644 index 0000000..a37967f --- /dev/null +++ b/Project Undercover/Assets/Scenes/scene/NavMesh.asset.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d7eb36ff892a3a7438b868633aac89d0 +timeCreated: 1505749249 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 23800000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Project Undercover/Assets/Scripts/GuardCameraController.cs b/Project Undercover/Assets/Scripts/GuardCameraController.cs new file mode 100644 index 0000000..38f1539 --- /dev/null +++ b/Project Undercover/Assets/Scripts/GuardCameraController.cs @@ -0,0 +1,22 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class GuardCameraController : MonoBehaviour { + + private float camSens = 120.0f; + private float xRotation = 0.0f; + private float yRotation = 0.0f; + + void Start () { + xRotation = transform.eulerAngles.y; + yRotation = transform.eulerAngles.x; + } + + void Update () { + xRotation += Time.deltaTime * Input.GetAxis ("Horizontal") * camSens; + yRotation += Time.deltaTime * Input.GetAxis ("Vertical") * camSens; + transform.localRotation = Quaternion.AngleAxis (xRotation, Vector3.up); + transform.localRotation *= Quaternion.AngleAxis (yRotation, -Vector3.right); + } +} \ No newline at end of file diff --git a/Project Undercover/Assets/Scripts/GuardCameraController.cs.meta b/Project Undercover/Assets/Scripts/GuardCameraController.cs.meta new file mode 100644 index 0000000..82cce4c --- /dev/null +++ b/Project Undercover/Assets/Scripts/GuardCameraController.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 1ef9de564c5529c4faeace3894ec9e0b +timeCreated: 1505422157 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Project Undercover/Assets/Scripts/PlayerController.cs b/Project Undercover/Assets/Scripts/PlayerController.cs index 62c8c93..e7eaaa1 100644 --- a/Project Undercover/Assets/Scripts/PlayerController.cs +++ b/Project Undercover/Assets/Scripts/PlayerController.cs @@ -1,27 +1,31 @@ using UnityEngine; using System.Collections; +using UnityEngine.AI; public class PlayerController : MonoBehaviour { + // Testing public GameObject particle; - public float TransitionSpeed; - private Rigidbody rigi; - private Vector3 velocity = Vector3.zero; + // Player as a nav mesh agent + private NavMeshAgent agent; void Start() { - rigi = GetComponent(); + agent = GetComponent (); } void Update() { + /* // WASD or Arrow keys movement var x = Input.GetAxis("Horizontal") * Time.deltaTime * 150.0f; var z = Input.GetAxis("Vertical") * Time.deltaTime * 3.0f; transform.Rotate(0, x, 0); transform.Translate(0, 0, z); + */ RaycastHit hit; + // Testing if (Input.GetButtonDown("Fire1")) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { @@ -30,12 +34,13 @@ public class PlayerController : MonoBehaviour Instantiate (particle, wantedPos, transform.rotation); } } - if (Input.GetButtonDown("Fire2")) { + // Walking + else if (Input.GetButtonDown("Fire2")) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { Vector3 wantedPos = hit.point; wantedPos.y = 0.5f; - transform.position = Vector3.Lerp (transform.position, wantedPos, Time.deltaTime * TransitionSpeed); + agent.destination = wantedPos; } } } diff --git a/Project Undercover/Assets/Scripts/SpyCameraController.cs b/Project Undercover/Assets/Scripts/SpyCameraController.cs new file mode 100644 index 0000000..c065421 --- /dev/null +++ b/Project Undercover/Assets/Scripts/SpyCameraController.cs @@ -0,0 +1,19 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class SpyCameraController : MonoBehaviour { + + private float camSens = 100.0f; + private float xRotation; + private Vector3 rotation; + + void Start () { + rotation = new Vector3(0.0f, 0.0f, 0.0f); + } + + void LateUpdate () { + xRotation = Time.deltaTime * Input.GetAxis ("Horizontal") * camSens; + transform.RotateAround (Vector3.zero, Vector3.up, -xRotation); + } +} diff --git a/Project Undercover/Assets/Scripts/SpyCameraController.cs.meta b/Project Undercover/Assets/Scripts/SpyCameraController.cs.meta new file mode 100644 index 0000000..c0edd7d --- /dev/null +++ b/Project Undercover/Assets/Scripts/SpyCameraController.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5277ef44f4e110947993697cba721d20 +timeCreated: 1505750194 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Project Undercover/ProjectSettings/InputManager.asset b/Project Undercover/ProjectSettings/InputManager.asset index 17c8f53..a9222b6 100644 --- a/Project Undercover/ProjectSettings/InputManager.asset +++ b/Project Undercover/ProjectSettings/InputManager.asset @@ -13,9 +13,9 @@ InputManager: positiveButton: right altNegativeButton: a altPositiveButton: d - gravity: 3 + gravity: 10 dead: 0.001 - sensitivity: 3 + sensitivity: 5 snap: 1 invert: 0 type: 0 @@ -29,9 +29,9 @@ InputManager: positiveButton: up altNegativeButton: s altPositiveButton: w - gravity: 3 + gravity: 10 dead: 0.001 - sensitivity: 3 + sensitivity: 5 snap: 1 invert: 0 type: 0