diff --git a/game/Assets/Prefabs/Traps/RollingBoulder.prefab b/game/Assets/Prefabs/Traps/RollingBoulder.prefab new file mode 100644 index 0000000..fa12fb1 --- /dev/null +++ b/game/Assets/Prefabs/Traps/RollingBoulder.prefab @@ -0,0 +1,381 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1157356545022895102 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3284889540147964939} + - component: {fileID: 1767268791732459175} + - component: {fileID: 6231901549469343104} + - component: {fileID: 6896559390184638598} + m_Layer: 0 + m_Name: Target + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3284889540147964939 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1157356545022895102} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 5.47, y: -0.91722655, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 6536764240838670284} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &1767268791732459175 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1157356545022895102} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &6231901549469343104 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1157356545022895102} + m_Enabled: 0 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, 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!65 &6896559390184638598 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1157356545022895102} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!1 &6536764240838670287 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6536764240838670284} + m_Layer: 0 + m_Name: RollingBoulder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6536764240838670284 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6536764240838670287} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -52.4, y: 0.91722655, z: 81.8881} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 6536764241329740425} + - {fileID: 6536764242362416353} + - {fileID: 3284889540147964939} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &6536764241329740421 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6536764241329740425} + - component: {fileID: 6536764241329740424} + - component: {fileID: 6536764241329740427} + - component: {fileID: 6536764241329740426} + m_Layer: 0 + m_Name: Plane + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6536764241329740425 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6536764241329740421} + m_LocalRotation: {x: -0, y: -0, z: -0.2118744, w: 0.97729695} + m_LocalPosition: {x: 0, y: 1.29, z: 0} + m_LocalScale: {x: 1, y: 1, z: 0.29492} + m_Children: [] + m_Father: {fileID: 6536764240838670284} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: -24.464} +--- !u!33 &6536764241329740424 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6536764241329740421} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &6536764241329740427 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6536764241329740421} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, 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!64 &6536764241329740426 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6536764241329740421} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 4 + m_Convex: 0 + m_CookingOptions: 30 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &6536764242362416381 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6536764242362416353} + - component: {fileID: 6536764242362416352} + - component: {fileID: 6536764242362416355} + - component: {fileID: 6536764242362416354} + - component: {fileID: 6536764242362416358} + - component: {fileID: 6536764242362416359} + - component: {fileID: 6536764242362416356} + - component: {fileID: 8693320603023675547} + m_Layer: 0 + m_Name: Sphere + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6536764242362416353 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6536764242362416381} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: -2.5, y: 3.5827737, z: 0} + m_LocalScale: {x: 2.1579, y: 2.1579, z: 2.1579} + m_Children: [] + m_Father: {fileID: 6536764240838670284} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &6536764242362416352 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6536764242362416381} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &6536764242362416355 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6536764242362416381} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, 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!135 &6536764242362416354 +SphereCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6536764242362416381} + 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!54 &6536764242362416358 +Rigidbody: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6536764242362416381} + serializedVersion: 2 + m_Mass: 1 + m_Drag: 0 + m_AngularDrag: 0.05 + m_UseGravity: 0 + m_IsKinematic: 0 + m_Interpolate: 0 + m_Constraints: 0 + m_CollisionDetection: 0 +--- !u!114 &6536764242362416359 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6536764242362416381} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bc988e5ddd582e443b8e078aa3518654, type: 3} + m_Name: + m_EditorClassIdentifier: + waitToDestroy: 10 +--- !u!65 &6536764242362416356 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6536764242362416381} + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1.3} + m_Center: {x: 4.1, y: -1.6, z: 0.03} +--- !u!114 &8693320603023675547 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6536764242362416381} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 364f9139f6e39a244a53d33f7eca4c65, type: 3} + m_Name: + m_EditorClassIdentifier: + speed: 2 + target: {fileID: 1157356545022895102} diff --git a/game/Assets/Prefabs/Traps/RollingBoulder.prefab.meta b/game/Assets/Prefabs/Traps/RollingBoulder.prefab.meta new file mode 100644 index 0000000..c5279a8 --- /dev/null +++ b/game/Assets/Prefabs/Traps/RollingBoulder.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: baf177258b70ed448964e62915be41ee +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/game/Assets/Scenes/Main.unity b/game/Assets/Scenes/Main.unity index b4f78a5..eff5bd5 100644 --- a/game/Assets/Scenes/Main.unity +++ b/game/Assets/Scenes/Main.unity @@ -4620,6 +4620,68 @@ Transform: m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: e20114b5c13a067488940c5cc8e13b60, type: 3} m_PrefabInstance: {fileID: 3060674077961207736} m_PrefabAsset: {fileID: 0} +--- !u!1001 &1462391825 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 1571618361} + m_Modifications: + - target: {fileID: 6536764240838670284, guid: baf177258b70ed448964e62915be41ee, type: 3} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 6536764240838670284, guid: baf177258b70ed448964e62915be41ee, type: 3} + propertyPath: m_LocalPosition.x + value: -40 + objectReference: {fileID: 0} + - target: {fileID: 6536764240838670284, guid: baf177258b70ed448964e62915be41ee, type: 3} + propertyPath: m_LocalPosition.y + value: 0.91722655 + objectReference: {fileID: 0} + - target: {fileID: 6536764240838670284, guid: baf177258b70ed448964e62915be41ee, type: 3} + propertyPath: m_LocalPosition.z + value: 83.5 + objectReference: {fileID: 0} + - target: {fileID: 6536764240838670284, guid: baf177258b70ed448964e62915be41ee, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6536764240838670284, guid: baf177258b70ed448964e62915be41ee, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6536764240838670284, guid: baf177258b70ed448964e62915be41ee, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6536764240838670284, guid: baf177258b70ed448964e62915be41ee, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6536764240838670284, guid: baf177258b70ed448964e62915be41ee, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6536764240838670284, guid: baf177258b70ed448964e62915be41ee, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6536764240838670284, guid: baf177258b70ed448964e62915be41ee, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6536764240838670287, guid: baf177258b70ed448964e62915be41ee, type: 3} + propertyPath: m_Name + value: RollingBoulder + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: baf177258b70ed448964e62915be41ee, type: 3} +--- !u!4 &1462391826 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 6536764240838670284, guid: baf177258b70ed448964e62915be41ee, type: 3} + m_PrefabInstance: {fileID: 1462391825} + m_PrefabAsset: {fileID: 0} --- !u!4 &1464700863 stripped Transform: m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 584f9522dd055c543863c0c60d13776e, type: 3} @@ -5052,6 +5114,7 @@ Transform: m_Children: - {fileID: 300150933} - {fileID: 1511725763} + - {fileID: 1462391826} m_Father: {fileID: 0} m_RootOrder: 10 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/game/Assets/Scripts/Traps/Mover.cs b/game/Assets/Scripts/Traps/Mover.cs new file mode 100644 index 0000000..39c930a --- /dev/null +++ b/game/Assets/Scripts/Traps/Mover.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Mover : MonoBehaviour +{ + [SerializeField] private float speed; + [SerializeField] private GameObject target; + + private void OnEnable() + { + float dt = Time.fixedDeltaTime; + Quaternion targetRotation = Quaternion.LookRotation(target.transform.position - transform.position); + transform.rotation = targetRotation; + } + + // Update is called once per frame + void FixedUpdate() + { + float dt = Time.fixedDeltaTime; + transform.position += transform.forward * speed * dt; + } +} diff --git a/game/Assets/Scripts/Traps/Mover.cs.meta b/game/Assets/Scripts/Traps/Mover.cs.meta new file mode 100644 index 0000000..2c901f1 --- /dev/null +++ b/game/Assets/Scripts/Traps/Mover.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 364f9139f6e39a244a53d33f7eca4c65 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/game/Assets/Scripts/Traps/RollingBoulder.cs b/game/Assets/Scripts/Traps/RollingBoulder.cs new file mode 100644 index 0000000..85a7cd0 --- /dev/null +++ b/game/Assets/Scripts/Traps/RollingBoulder.cs @@ -0,0 +1,50 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class RollingBoulder : MonoBehaviour +{ + Rigidbody rb; + // Float for time in seconds to wait to destroy the arrow on contact with any other gameobject that is no the player. + [SerializeField] private float waitToDestroy; + + private void Start() + { + rb = GetComponent(); + } + + private void OnTriggerEnter(Collider other) + { + // Checks to make sure other collider is the Player using tag. + if (other.gameObject.CompareTag("Player")) + { + Mover mover = + gameObject.GetComponent(); + mover.enabled = true; + } + } + + private void OnCollisionEnter(Collision collision) + { + if (collision.gameObject.TryGetComponent(out PlayerDeath playerDeath)) + { + // Start Respawn coroutine. + playerDeath.Respawn(); + // Destroy arrow on contact with player. + Destroy(gameObject); + } + else + { + // If boulder makes contact with any other gameobject start DestroyBoulder corountine. + StartCoroutine(DestoryBoulder()); + } + } + + public IEnumerator DestoryBoulder() + { + // set boulder velocity to zero wait for destory time and then destory the boulder. + rb.velocity = Vector3.zero; + yield return new WaitForSeconds(waitToDestroy); + Destroy(gameObject); + } +} diff --git a/game/Assets/Scripts/Traps/RollingBoulder.cs.meta b/game/Assets/Scripts/Traps/RollingBoulder.cs.meta new file mode 100644 index 0000000..b3c6556 --- /dev/null +++ b/game/Assets/Scripts/Traps/RollingBoulder.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bc988e5ddd582e443b8e078aa3518654 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: