From 2beb3298c636090f00a08cab864bf6a6cb19f43a Mon Sep 17 00:00:00 2001 From: jonasty Date: Mon, 2 May 2022 16:09:20 +0300 Subject: [PATCH] to master merge --- .../Materials/Foliage/URP_Grass.mat | 26 +++--- .../Foliage/URP_GrassInteractive.mat | 2 +- .../Materials/Foliage/URP_TreeBillboard.mat | 2 +- .../Materials/Terrain/URP_4Splats.mat | 26 +++--- .../Materials/Terrain/URP_4Splats4Normals.mat | 2 +- .../Materials/Terrain/URP_8Splats.mat | 26 +++--- .../Materials/Terrain/URP_GradientLookup.mat | 2 +- .../Materials/Terrain/URP_VertexColor.mat | 26 +++--- .../Animations/Arlo/Slime.controller | 86 +++++++++---------- Assets/Project Files/Scripts/Arlo/SlimeAI.cs | 57 ++++++++---- 10 files changed, 138 insertions(+), 117 deletions(-) diff --git a/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Foliage/URP_Grass.mat b/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Foliage/URP_Grass.mat index 34d38138..00776f7c 100644 --- a/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Foliage/URP_Grass.mat +++ b/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Foliage/URP_Grass.mat @@ -1,18 +1,5 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: ---- !u!114 &-1458936301379465483 -MonoBehaviour: - m_ObjectHideFlags: 11 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} - m_Name: - m_EditorClassIdentifier: - version: 5 --- !u!21 &2100000 Material: serializedVersion: 6 @@ -135,3 +122,16 @@ Material: - _WavingTint: {r: 1, g: 1, b: 1, a: 1} - _Wind: {r: 1, g: 1, b: 4, a: 8} m_BuildTextureStacks: [] +--- !u!114 &132002584372362984 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 5 diff --git a/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Foliage/URP_GrassInteractive.mat b/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Foliage/URP_GrassInteractive.mat index bb1f2e2f..2d00e6da 100644 --- a/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Foliage/URP_GrassInteractive.mat +++ b/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Foliage/URP_GrassInteractive.mat @@ -1,6 +1,6 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: ---- !u!114 &-8850970943120936482 +--- !u!114 &-6731343359379762165 MonoBehaviour: m_ObjectHideFlags: 11 m_CorrespondingSourceObject: {fileID: 0} diff --git a/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Foliage/URP_TreeBillboard.mat b/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Foliage/URP_TreeBillboard.mat index 14963f15..858aa487 100644 --- a/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Foliage/URP_TreeBillboard.mat +++ b/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Foliage/URP_TreeBillboard.mat @@ -82,7 +82,7 @@ Material: - _Color: {r: 1, g: 1, b: 1, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} m_BuildTextureStacks: [] ---- !u!114 &7435650071506671124 +--- !u!114 &2766792793257514549 MonoBehaviour: m_ObjectHideFlags: 11 m_CorrespondingSourceObject: {fileID: 0} diff --git a/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Terrain/URP_4Splats.mat b/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Terrain/URP_4Splats.mat index 555b87a1..52028eda 100644 --- a/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Terrain/URP_4Splats.mat +++ b/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Terrain/URP_4Splats.mat @@ -1,18 +1,5 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: ---- !u!114 &-8356627826014067786 -MonoBehaviour: - m_ObjectHideFlags: 11 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} - m_Name: - m_EditorClassIdentifier: - version: 5 --- !u!21 &2100000 Material: serializedVersion: 6 @@ -178,3 +165,16 @@ Material: - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _SpecColor: {r: 1, g: 1, b: 1, a: 1} m_BuildTextureStacks: [] +--- !u!114 &265111258872561219 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 5 diff --git a/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Terrain/URP_4Splats4Normals.mat b/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Terrain/URP_4Splats4Normals.mat index 1c1fcce9..978e927e 100644 --- a/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Terrain/URP_4Splats4Normals.mat +++ b/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Terrain/URP_4Splats4Normals.mat @@ -1,6 +1,6 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: ---- !u!114 &-7070093524437990947 +--- !u!114 &-3454129911339181364 MonoBehaviour: m_ObjectHideFlags: 11 m_CorrespondingSourceObject: {fileID: 0} diff --git a/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Terrain/URP_8Splats.mat b/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Terrain/URP_8Splats.mat index 70802567..ba38b6e5 100644 --- a/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Terrain/URP_8Splats.mat +++ b/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Terrain/URP_8Splats.mat @@ -1,5 +1,18 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!114 &-307200169094690312 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 5 --- !u!21 &2100000 Material: serializedVersion: 6 @@ -173,16 +186,3 @@ Material: - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _SpecColor: {r: 1, g: 1, b: 1, a: 1} m_BuildTextureStacks: [] ---- !u!114 &7603444385800986913 -MonoBehaviour: - m_ObjectHideFlags: 11 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} - m_Name: - m_EditorClassIdentifier: - version: 5 diff --git a/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Terrain/URP_GradientLookup.mat b/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Terrain/URP_GradientLookup.mat index 82cf851e..2b36d5cd 100644 --- a/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Terrain/URP_GradientLookup.mat +++ b/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Terrain/URP_GradientLookup.mat @@ -97,7 +97,7 @@ Material: - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _SpecColor: {r: 1, g: 1, b: 1, a: 1} m_BuildTextureStacks: [] ---- !u!114 &6004310884688239859 +--- !u!114 &4114504498260272113 MonoBehaviour: m_ObjectHideFlags: 11 m_CorrespondingSourceObject: {fileID: 0} diff --git a/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Terrain/URP_VertexColor.mat b/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Terrain/URP_VertexColor.mat index e88ab306..e30037f1 100644 --- a/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Terrain/URP_VertexColor.mat +++ b/Assets/Polaris - Low Poly Ecosystem/Polaris Extension - URP Support/Materials/Terrain/URP_VertexColor.mat @@ -1,18 +1,5 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: ---- !u!114 &-5876665935919361285 -MonoBehaviour: - m_ObjectHideFlags: 11 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} - m_Name: - m_EditorClassIdentifier: - version: 5 --- !u!21 &2100000 Material: serializedVersion: 6 @@ -93,3 +80,16 @@ Material: - _Color: {r: 1, g: 1, b: 1, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} m_BuildTextureStacks: [] +--- !u!114 &8185076140583842307 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 5 diff --git a/Assets/Project Files/Animations/Arlo/Slime.controller b/Assets/Project Files/Animations/Arlo/Slime.controller index 305e7c3d..fd032f4c 100644 --- a/Assets/Project Files/Animations/Arlo/Slime.controller +++ b/Assets/Project Files/Animations/Arlo/Slime.controller @@ -140,31 +140,6 @@ AnimatorStateTransition: m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 ---- !u!1101 &-3741334239111002070 -AnimatorStateTransition: - m_ObjectHideFlags: 1 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: - m_Conditions: - - m_ConditionMode: 1 - m_ConditionEvent: Dead - m_EventTreshold: 0 - m_DstStateMachine: {fileID: 0} - m_DstState: {fileID: 1102835054974116572} - m_Solo: 0 - m_Mute: 0 - m_IsExit: 0 - serializedVersion: 3 - m_TransitionDuration: 0.25 - m_TransitionOffset: 0 - m_ExitTime: 0.75 - m_HasExitTime: 0 - m_HasFixedDuration: 1 - m_InterruptionSource: 0 - m_OrderedInterruption: 1 - m_CanTransitionToSelf: 1 --- !u!1102 &-1989803667490188130 AnimatorState: serializedVersion: 6 @@ -242,6 +217,28 @@ AnimatorStateTransition: m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 +--- !u!1101 &-661908585856255301 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: [] + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 0} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 1 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 2 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!91 &9100000 AnimatorController: m_ObjectHideFlags: 0 @@ -275,18 +272,6 @@ AnimatorController: m_DefaultInt: 0 m_DefaultBool: 0 m_Controller: {fileID: 9100000} - - m_Name: Dead - m_Type: 4 - m_DefaultFloat: 0 - m_DefaultInt: 0 - m_DefaultBool: 0 - m_Controller: {fileID: 9100000} - - m_Name: DeathComplete - m_Type: 4 - m_DefaultFloat: 0 - m_DefaultInt: 0 - m_DefaultBool: 0 - m_Controller: {fileID: 9100000} m_AnimatorLayers: - serializedVersion: 5 m_Name: Base Layer @@ -897,8 +882,10 @@ AnimatorState: m_Name: Die m_Speed: 1 m_CycleOffset: 0 - m_Transitions: [] - m_StateMachineBehaviours: [] + m_Transitions: + - {fileID: -661908585856255301} + m_StateMachineBehaviours: + - {fileID: 7912422198382985104} m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 m_WriteDefaultValues: 1 @@ -1080,7 +1067,7 @@ AnimatorStateMachine: m_Position: {x: 670, y: 550, z: 0} - serializedVersion: 1 m_State: {fileID: 1102835054974116572} - m_Position: {x: 300, y: -80, z: 0} + m_Position: {x: 40, y: 380, z: 0} - serializedVersion: 1 m_State: {fileID: 8194647877007136643} m_Position: {x: 300, y: 220, z: 0} @@ -1091,14 +1078,13 @@ AnimatorStateMachine: m_State: {fileID: -6878085496064969341} m_Position: {x: 300, y: 300, z: 0} m_ChildStateMachines: [] - m_AnyStateTransitions: - - {fileID: -3741334239111002070} + m_AnyStateTransitions: [] m_EntryTransitions: [] m_StateMachineTransitions: {} m_StateMachineBehaviours: [] - m_AnyStatePosition: {x: 60, y: -70, z: 0} + m_AnyStatePosition: {x: 50, y: 20, z: 0} m_EntryPosition: {x: 100, y: 150, z: 0} - m_ExitPosition: {x: 90, y: 510, z: 0} + m_ExitPosition: {x: 50, y: 440, z: 0} m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} m_DefaultState: {fileID: 1102546605246812244} --- !u!1101 &4009614032068998235 @@ -1151,6 +1137,18 @@ AnimatorStateTransition: m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 +--- !u!114 &7912422198382985104 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: aa7306c35f4c27d4daefb1259633b9d0, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1102 &8194647877007136643 AnimatorState: serializedVersion: 6 diff --git a/Assets/Project Files/Scripts/Arlo/SlimeAI.cs b/Assets/Project Files/Scripts/Arlo/SlimeAI.cs index b8f872b2..53302dbd 100644 --- a/Assets/Project Files/Scripts/Arlo/SlimeAI.cs +++ b/Assets/Project Files/Scripts/Arlo/SlimeAI.cs @@ -19,8 +19,10 @@ public class SlimeAI : MonoBehaviour private bool isRotatingRight = false; private bool isWalking = false; - public UnityEvent onDeathComplete; + private bool isAttacking = false; + private float attackStartTime; + public UnityEvent onDeathComplete; //[SerializeField] //private UnityEvent onAttack; @@ -29,14 +31,20 @@ public class SlimeAI : MonoBehaviour { animator = GetComponent(); player = GameObject.FindWithTag("Player"); - HP = 2; - + HP = 0; + } // Update is called once per frame void Update() { playerDistance = Vector3.Distance(player.transform.position, transform.position); + + if (HP <= 0) + { + animator.Play("Die"); + onDeathComplete.Invoke(); + } if (playerDistance < 1.5) //Attack { animator.SetBool("Wandering", false); @@ -44,6 +52,7 @@ public class SlimeAI : MonoBehaviour animator.SetBool("EnemyInAggroRange", true); animator.SetBool("EnemyInVisionRange", true); Rotate(); + Attack(); } else if (playerDistance < 10) //Chase { @@ -69,12 +78,15 @@ public class SlimeAI : MonoBehaviour animator.SetBool("EnemyInAggroRange", false); animator.SetBool("EnemyInVisionRange", false); } - + if (!isWandering) { //Idle StartCoroutine("Wander"); } + Debug.Log(isWandering); + Debug.Log(isRotatingLeft); + Debug.Log(isRotatingRight); if (isRotatingRight == true) { animator.SetBool("Wandering", false); @@ -90,18 +102,6 @@ public class SlimeAI : MonoBehaviour animator.SetBool("Wandering", true); transform.position += transform.forward * moveSpeed * Time.deltaTime; } - if (HP <= 0) - { - animator.SetBool("Dead", true); - - } - if (animator.GetBool("Dead")) - { - print("asd"); - Destroy(this.gameObject); - onDeathComplete.Invoke(); - - } @@ -124,6 +124,29 @@ public class SlimeAI : MonoBehaviour HP -= dmg; } + void Attack() + { + if (!isAttacking) + { + isAttacking = true; + attackStartTime = Time.time; + StartCoroutine(DelayedAttack()); + } + else if (Time.time - attackStartTime > 0.833) + { + isAttacking = false; + attackStartTime = 0.0f; + } + + } + + IEnumerator DelayedAttack() + { + yield return new WaitForSeconds(0.2f); + Debug.Log("Attack"); + //do attack e.g check for player in range/hit collider + } + IEnumerator Wander() { int rotTime = Random.Range(1, 3); @@ -154,4 +177,4 @@ public class SlimeAI : MonoBehaviour isWandering = false; } -} +} \ No newline at end of file