From 67effcab6dc01892d567945361481c6012e20a2c Mon Sep 17 00:00:00 2001 From: Kotrba Filip Date: Sat, 1 Feb 2020 23:28:26 +0100 Subject: [PATCH] Remake baricade spice and tree --- Assets/Prefabs/Barricade.prefab | 19 ++++---- Assets/Prefabs/Tree_LOD.prefab | 37 +++++++++++---- Assets/Scenes/Test-Haitem.unity | 82 ++++++++++++++++++++++++++------- Assets/Scripts/BlockManager.cs | 8 ++-- Assets/Scripts/EnemyManager.cs | 16 ++++++- 5 files changed, 123 insertions(+), 39 deletions(-) diff --git a/Assets/Prefabs/Barricade.prefab b/Assets/Prefabs/Barricade.prefab index 935539f..0f10fe1 100644 --- a/Assets/Prefabs/Barricade.prefab +++ b/Assets/Prefabs/Barricade.prefab @@ -10,7 +10,7 @@ GameObject: m_Component: - component: {fileID: 874380372637160946} - component: {fileID: 1908658187181555171} - - component: {fileID: 2165015337968088775} + - component: {fileID: 1402357855717081948} m_Layer: 0 m_Name: Barricade m_TagString: Spikes @@ -51,19 +51,22 @@ MonoBehaviour: amountModels: [] audioSource: {fileID: 0} doorSound: {fileID: 0} ---- !u!65 &2165015337968088775 -BoxCollider: +--- !u!208 &1402357855717081948 +NavMeshObstacle: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1999182813209888360} - m_Material: {fileID: 0} - m_IsTrigger: 1 m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 0.8, z: 1} - m_Center: {x: -0.1, y: 1, z: 1.2} + serializedVersion: 3 + m_Shape: 1 + m_Extents: {x: 0.5, y: 0.75, z: 1} + m_MoveThreshold: 0.1 + m_Carve: 0 + m_CarveOnlyStationary: 0 + m_Center: {x: -0.05, y: 0.75, z: 1} + m_TimeToStationary: 0.5 --- !u!1001 &8380342326956505725 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Tree_LOD.prefab b/Assets/Prefabs/Tree_LOD.prefab index 6b52566..198a838 100644 --- a/Assets/Prefabs/Tree_LOD.prefab +++ b/Assets/Prefabs/Tree_LOD.prefab @@ -24,12 +24,13 @@ GameObject: m_Component: - component: {fileID: 6132983532685291387} - component: {fileID: 792143903499247558} + - component: {fileID: 7073027306475143712} m_Layer: 0 m_Name: Tree_LOD m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 - m_StaticEditorFlags: 4294967295 + m_StaticEditorFlags: 0 m_IsActive: 1 --- !u!4 &6132983532685291387 Transform: @@ -94,6 +95,22 @@ LODGroup: - renderer: {fileID: 3790753686469841987} - renderer: {fileID: 7477384831301876712} m_Enabled: 1 +--- !u!208 &7073027306475143712 +NavMeshObstacle: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7706219202001118132} + m_Enabled: 1 + serializedVersion: 3 + m_Shape: 0 + m_Extents: {x: 0.28, y: 2.5, z: 0.28} + m_MoveThreshold: 0.1 + m_Carve: 0 + m_CarveOnlyStationary: 1 + m_Center: {x: 0, y: 2.29, z: 0} + m_TimeToStationary: 0.5 --- !u!1001 &6890689231084320501 PrefabInstance: m_ObjectHideFlags: 0 @@ -104,12 +121,12 @@ PrefabInstance: - target: {fileID: -7462036371361415008, guid: 603fd957a7e40e24993b27cc7f9f5cb8, type: 3} propertyPath: m_StaticEditorFlags - value: 4294967295 + value: 0 objectReference: {fileID: 0} - target: {fileID: -4425609515867240179, guid: 603fd957a7e40e24993b27cc7f9f5cb8, type: 3} propertyPath: m_StaticEditorFlags - value: 4294967295 + value: 0 objectReference: {fileID: 0} - target: {fileID: -4216859302048453862, guid: 603fd957a7e40e24993b27cc7f9f5cb8, type: 3} @@ -204,37 +221,37 @@ PrefabInstance: - target: {fileID: -927199367670048503, guid: 603fd957a7e40e24993b27cc7f9f5cb8, type: 3} propertyPath: m_StaticEditorFlags - value: 4294967295 + value: 0 objectReference: {fileID: 0} - target: {fileID: -594094835925579944, guid: 603fd957a7e40e24993b27cc7f9f5cb8, type: 3} propertyPath: m_StaticEditorFlags - value: 4294967295 + value: 0 objectReference: {fileID: 0} - target: {fileID: -492420421572216379, guid: 603fd957a7e40e24993b27cc7f9f5cb8, type: 3} propertyPath: m_StaticEditorFlags - value: 4294967295 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2502203975881118265, guid: 603fd957a7e40e24993b27cc7f9f5cb8, type: 3} propertyPath: m_StaticEditorFlags - value: 4294967295 + value: 0 objectReference: {fileID: 0} - target: {fileID: 3667633384733631754, guid: 603fd957a7e40e24993b27cc7f9f5cb8, type: 3} propertyPath: m_StaticEditorFlags - value: 4294967295 + value: 0 objectReference: {fileID: 0} - target: {fileID: 4695666576454475813, guid: 603fd957a7e40e24993b27cc7f9f5cb8, type: 3} propertyPath: m_StaticEditorFlags - value: 4294967295 + value: 0 objectReference: {fileID: 0} - target: {fileID: 7469484624682501897, guid: 603fd957a7e40e24993b27cc7f9f5cb8, type: 3} propertyPath: m_StaticEditorFlags - value: 4294967295 + value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 603fd957a7e40e24993b27cc7f9f5cb8, type: 3} diff --git a/Assets/Scenes/Test-Haitem.unity b/Assets/Scenes/Test-Haitem.unity index d3c659b..161503d 100644 --- a/Assets/Scenes/Test-Haitem.unity +++ b/Assets/Scenes/Test-Haitem.unity @@ -20,10 +20,10 @@ RenderSettings: m_FogDensity: 0.01 m_LinearFogStart: 0 m_LinearFogEnd: 300 - m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientSkyColor: {r: 0.092381604, g: 0.09932358, b: 0.11320752, 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_AmbientIntensity: 2.47 m_AmbientMode: 3 m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} @@ -1034,13 +1034,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 876986471} - m_LocalRotation: {x: -0, y: -0, z: -0.11264427, w: 0.99363536} - m_LocalPosition: {x: -0.017, y: 0.315, z: 0} + m_LocalRotation: {x: -0.993747, y: 0.10965279, z: 0.01177046, w: 0.017452931} + m_LocalPosition: {x: -0.017, y: 0.315, z: -0.99} m_LocalScale: {x: 0.14999999, y: 0.14999999, z: 1.4999999} m_Children: [] m_Father: {fileID: 1551585526} m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: -2.1360002, y: 181.122, z: -167.42801} --- !u!108 &876986473 Light: m_ObjectHideFlags: 0 @@ -1050,13 +1050,13 @@ Light: m_GameObject: {fileID: 876986471} m_Enabled: 1 serializedVersion: 10 - m_Type: 2 + m_Type: 0 m_Shape: 0 m_Color: {r: 0.8396226, g: 0.46486092, b: 0.24951048, a: 1} m_Intensity: 1 m_Range: 10 - m_SpotAngle: 30 - m_InnerSpotAngle: 21.80208 + m_SpotAngle: 145 + m_InnerSpotAngle: 14 m_CookieSize: 10 m_Shadows: m_Type: 0 @@ -11493,13 +11493,18 @@ PrefabInstance: m_Modifications: - target: {fileID: 305547904, guid: b4e392e2cdb417b4c8bdf8e683bceb9b, type: 3} propertyPath: m_Enabled - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 3545622996904709018, guid: b4e392e2cdb417b4c8bdf8e683bceb9b, type: 3} propertyPath: m_Name value: Enemy objectReference: {fileID: 0} + - target: {fileID: 4593238991022112296, guid: b4e392e2cdb417b4c8bdf8e683bceb9b, + type: 3} + propertyPath: m_Enabled + value: 1 + objectReference: {fileID: 0} - target: {fileID: 5004747464968674621, guid: b4e392e2cdb417b4c8bdf8e683bceb9b, type: 3} propertyPath: m_LocalPosition.x @@ -11584,6 +11589,36 @@ PrefabInstance: propertyPath: m_Name value: Sun objectReference: {fileID: 0} + - target: {fileID: 8150345748488139402, guid: b5bdffdb5058d5e458831042023d3abc, + type: 3} + propertyPath: m_Color.r + value: 0.754717 + objectReference: {fileID: 0} + - target: {fileID: 8150345748488139402, guid: b5bdffdb5058d5e458831042023d3abc, + type: 3} + propertyPath: m_Color.g + value: 0.754717 + objectReference: {fileID: 0} + - target: {fileID: 8150345748488139402, guid: b5bdffdb5058d5e458831042023d3abc, + type: 3} + propertyPath: m_Color.b + value: 0.754717 + objectReference: {fileID: 0} + - target: {fileID: 8150345748488139402, guid: b5bdffdb5058d5e458831042023d3abc, + type: 3} + propertyPath: m_Intensity + value: 0.1 + objectReference: {fileID: 0} + - target: {fileID: 8150345748488139402, guid: b5bdffdb5058d5e458831042023d3abc, + type: 3} + propertyPath: m_BounceIntensity + value: 0.45 + objectReference: {fileID: 0} + - target: {fileID: 8150345748488139402, guid: b5bdffdb5058d5e458831042023d3abc, + type: 3} + propertyPath: m_Shadows.m_Strength + value: 1 + objectReference: {fileID: 0} - target: {fileID: 8150345748488139403, guid: b5bdffdb5058d5e458831042023d3abc, type: 3} propertyPath: m_LocalPosition.x @@ -11602,22 +11637,22 @@ PrefabInstance: - target: {fileID: 8150345748488139403, guid: b5bdffdb5058d5e458831042023d3abc, type: 3} propertyPath: m_LocalRotation.x - value: 0 + value: 0.7055664 objectReference: {fileID: 0} - target: {fileID: 8150345748488139403, guid: b5bdffdb5058d5e458831042023d3abc, type: 3} propertyPath: m_LocalRotation.y - value: 0 + value: 0.20568764 objectReference: {fileID: 0} - target: {fileID: 8150345748488139403, guid: b5bdffdb5058d5e458831042023d3abc, type: 3} propertyPath: m_LocalRotation.z - value: 0 + value: 0.44618693 objectReference: {fileID: 0} - target: {fileID: 8150345748488139403, guid: b5bdffdb5058d5e458831042023d3abc, type: 3} propertyPath: m_LocalRotation.w - value: 1 + value: 0.51067203 objectReference: {fileID: 0} - target: {fileID: 8150345748488139403, guid: b5bdffdb5058d5e458831042023d3abc, type: 3} @@ -11627,17 +11662,17 @@ PrefabInstance: - target: {fileID: 8150345748488139403, guid: b5bdffdb5058d5e458831042023d3abc, type: 3} propertyPath: m_LocalEulerAnglesHint.x - value: 0 + value: 147.515 objectReference: {fileID: 0} - target: {fileID: 8150345748488139403, guid: b5bdffdb5058d5e458831042023d3abc, type: 3} propertyPath: m_LocalEulerAnglesHint.y - value: 0 + value: -84.53998 objectReference: {fileID: 0} - target: {fileID: 8150345748488139403, guid: b5bdffdb5058d5e458831042023d3abc, type: 3} propertyPath: m_LocalEulerAnglesHint.z - value: 0 + value: -62.169006 objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: b5bdffdb5058d5e458831042023d3abc, type: 3} @@ -12501,6 +12536,21 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 7985979213387740677, guid: 204c7411afdd01a478b1a1e25607d50c, + type: 3} + propertyPath: m_BackGroundColor.r + value: 0.21573514 + objectReference: {fileID: 0} + - target: {fileID: 7985979213387740677, guid: 204c7411afdd01a478b1a1e25607d50c, + type: 3} + propertyPath: m_BackGroundColor.g + value: 0.30793875 + objectReference: {fileID: 0} + - target: {fileID: 7985979213387740677, guid: 204c7411afdd01a478b1a1e25607d50c, + type: 3} + propertyPath: m_BackGroundColor.b + value: 0.4528302 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 204c7411afdd01a478b1a1e25607d50c, type: 3} --- !u!1001 &9169310669941808785 diff --git a/Assets/Scripts/BlockManager.cs b/Assets/Scripts/BlockManager.cs index 0e5984a..218e0cf 100644 --- a/Assets/Scripts/BlockManager.cs +++ b/Assets/Scripts/BlockManager.cs @@ -133,13 +133,13 @@ public class BlockManager : MonoBehaviour } } - void OnTriggerEnter(Collider collider) + void OnCollisionEnter(Collision collision) { if (blockType == BlockType.Barricade) { - Debug.Log(collider.transform.tag); - if (collider.transform.CompareTag("Enemy")) + Debug.Log(collision.transform.tag); + if (collision.transform.CompareTag("Enemy")) { - EnemyManager enemyManager = collider.transform.GetComponent(); + EnemyManager enemyManager = collision.transform.GetComponent(); if (enemyManager != null) { enemyManager.Damage(100); diff --git a/Assets/Scripts/EnemyManager.cs b/Assets/Scripts/EnemyManager.cs index 534276f..37c3704 100644 --- a/Assets/Scripts/EnemyManager.cs +++ b/Assets/Scripts/EnemyManager.cs @@ -188,7 +188,6 @@ public class EnemyManager : MonoBehaviour void OnTriggerEnter(Collider collider) { - Debug.Log(collider.transform.tag); if (collider.transform.CompareTag("Meele")) { WeaponManager weaponManager = collider.transform.GetComponent(); @@ -198,4 +197,19 @@ public class EnemyManager : MonoBehaviour } } } + + void OnCollisionEnter(Collision collision) + { + if (collision.transform.CompareTag("Spikes")) + { + BlockManager blockManager = GetComponent().transform.GetComponent(); + if (blockManager != null && blockManager.blockType == BlockManager.BlockType.Barricade) + { + Damage(100); + blockManager.health = 0; + Destroy(blockManager); + Destroy(blockManager.gameObject, 3); + } + } + } }