From 162ce61132296c72a82efbe7f8588e7547057a04 Mon Sep 17 00:00:00 2001 From: SpoodyTheOne Date: Sun, 4 Feb 2024 09:52:47 +0100 Subject: [PATCH] FUCK JER --- Assets/Scenes/GameScene.unity | 75 ++++++++++++++++++++ Assets/Scripts/BloodComputeShader.cs | 2 +- Assets/Scripts/Managers/GameManager.cs | 26 ++++++- Assets/Scripts/Player/HealthComponent.cs | 5 +- Assets/Scripts/Player/PlayerCollideAttack.cs | 2 + Assets/Scripts/Player/PlayerMovement.cs | 10 ++- 6 files changed, 113 insertions(+), 7 deletions(-) diff --git a/Assets/Scenes/GameScene.unity b/Assets/Scenes/GameScene.unity index 3cad8d2..d860d3b 100644 --- a/Assets/Scenes/GameScene.unity +++ b/Assets/Scenes/GameScene.unity @@ -665,6 +665,38 @@ PrefabInstance: propertyPath: m_IncludeLayers.m_Bits value: 4294967295 objectReference: {fileID: 0} + - target: {fileID: 3086165646112058191, guid: 30e0cc55a67f02d4f92b2677ec4b1511, type: 3} + propertyPath: OnHealthZero.m_PersistentCalls.m_Calls.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3086165646112058191, guid: 30e0cc55a67f02d4f92b2677ec4b1511, type: 3} + propertyPath: OnHealthZero.m_PersistentCalls.m_Calls.Array.data[0].m_Mode + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 3086165646112058191, guid: 30e0cc55a67f02d4f92b2677ec4b1511, type: 3} + propertyPath: OnHealthZero.m_PersistentCalls.m_Calls.Array.data[0].m_Target + value: + objectReference: {fileID: 1566837125} + - target: {fileID: 3086165646112058191, guid: 30e0cc55a67f02d4f92b2677ec4b1511, type: 3} + propertyPath: OnHealthZero.m_PersistentCalls.m_Calls.Array.data[0].m_CallState + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 3086165646112058191, guid: 30e0cc55a67f02d4f92b2677ec4b1511, type: 3} + propertyPath: OnHealthZero.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: playerDied + objectReference: {fileID: 0} + - target: {fileID: 3086165646112058191, guid: 30e0cc55a67f02d4f92b2677ec4b1511, type: 3} + propertyPath: OnHealthZero.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName + value: GameManager, Assembly-CSharp + objectReference: {fileID: 0} + - target: {fileID: 3086165646112058191, guid: 30e0cc55a67f02d4f92b2677ec4b1511, type: 3} + propertyPath: OnHealthZero.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_IntArgument + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3086165646112058191, guid: 30e0cc55a67f02d4f92b2677ec4b1511, type: 3} + propertyPath: OnHealthZero.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName + value: UnityEngine.Object, UnityEngine + objectReference: {fileID: 0} - target: {fileID: 3120938410244321186, guid: 30e0cc55a67f02d4f92b2677ec4b1511, type: 3} propertyPath: m_Name value: Player2 @@ -1253,6 +1285,34 @@ PrefabInstance: propertyPath: m_Parameters.widthCurve.m_Curve.Array.data[1].outWeight value: 0.33333334 objectReference: {fileID: 0} + - target: {fileID: 3086165646112058191, guid: 99a6ff8b9591949439b620b13bd249a4, type: 3} + propertyPath: OnHealthZero.m_PersistentCalls.m_Calls.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3086165646112058191, guid: 99a6ff8b9591949439b620b13bd249a4, type: 3} + propertyPath: OnHealthZero.m_PersistentCalls.m_Calls.Array.data[0].m_Mode + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 3086165646112058191, guid: 99a6ff8b9591949439b620b13bd249a4, type: 3} + propertyPath: OnHealthZero.m_PersistentCalls.m_Calls.Array.data[0].m_Target + value: + objectReference: {fileID: 1566837125} + - target: {fileID: 3086165646112058191, guid: 99a6ff8b9591949439b620b13bd249a4, type: 3} + propertyPath: OnHealthZero.m_PersistentCalls.m_Calls.Array.data[0].m_CallState + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 3086165646112058191, guid: 99a6ff8b9591949439b620b13bd249a4, type: 3} + propertyPath: OnHealthZero.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: playerDied + objectReference: {fileID: 0} + - target: {fileID: 3086165646112058191, guid: 99a6ff8b9591949439b620b13bd249a4, type: 3} + propertyPath: OnHealthZero.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName + value: GameManager, Assembly-CSharp + objectReference: {fileID: 0} + - target: {fileID: 3086165646112058191, guid: 99a6ff8b9591949439b620b13bd249a4, type: 3} + propertyPath: OnHealthZero.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName + value: UnityEngine.Object, UnityEngine + objectReference: {fileID: 0} - target: {fileID: 3120938410244321186, guid: 99a6ff8b9591949439b620b13bd249a4, type: 3} propertyPath: m_Name value: Player1 @@ -3042,6 +3102,18 @@ MonoBehaviour: textParent: {fileID: 1481267923} damageTextPrefab: {fileID: 8357464303304312906, guid: 25c9a2db8fc5b7c4f8feebba5c73e7a3, type: 3} lifeTime: 3 +--- !u!114 &1566837125 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1566837117} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cfcb795658e5b9d8bbbf6d6e238c21a0, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1579580564 stripped GameObject: m_CorrespondingSourceObject: {fileID: 3120938410244321186, guid: 30e0cc55a67f02d4f92b2677ec4b1511, type: 3} @@ -3234,6 +3306,9 @@ PrefabInstance: - targetCorrespondingSourceObject: {fileID: 809911508645467208, guid: ec5007446d8bbca48bf02b3a7e752da1, type: 3} insertIndex: -1 addedObject: {fileID: 1566837120} + - targetCorrespondingSourceObject: {fileID: 809911508645467208, guid: ec5007446d8bbca48bf02b3a7e752da1, type: 3} + insertIndex: -1 + addedObject: {fileID: 1566837125} m_SourcePrefab: {fileID: 100100000, guid: ec5007446d8bbca48bf02b3a7e752da1, type: 3} --- !u!1001 &4158834148864819266 PrefabInstance: diff --git a/Assets/Scripts/BloodComputeShader.cs b/Assets/Scripts/BloodComputeShader.cs index 3dba8e6..db6cc72 100644 --- a/Assets/Scripts/BloodComputeShader.cs +++ b/Assets/Scripts/BloodComputeShader.cs @@ -163,7 +163,7 @@ public class BloodComputeShader : MonoBehaviour activeParticles -= (int)totalBloodCleaned; - score += bufferData[0]; + score += totalBloodCleaned; // this doesnt exist but ok // float mappedRumble = Convert.ToSingle(bufferData[0]).Remap(0, RumbleAmount, 0, 0.1f); diff --git a/Assets/Scripts/Managers/GameManager.cs b/Assets/Scripts/Managers/GameManager.cs index 1c6702c..e6ae095 100644 --- a/Assets/Scripts/Managers/GameManager.cs +++ b/Assets/Scripts/Managers/GameManager.cs @@ -1,18 +1,38 @@ using System.Collections; using System.Collections.Generic; +using System; using UnityEngine; +using UnityEngine.Events; public class GameManager : MonoBehaviour { - // Start is called before the first frame update + public static GameManager Instance { get; private set; } + + public Action OnPlayerDied; + + void Awake() + { + if (Instance != null) + { + Instance = this; + DontDestroyOnLoad(gameObject); + } + + Destroy(gameObject); + } + void Start() { - + } + + public void playerDied(int who) + { + Debug.Break(); } // Update is called once per frame void Update() { - + } } diff --git a/Assets/Scripts/Player/HealthComponent.cs b/Assets/Scripts/Player/HealthComponent.cs index 25aedc0..5d4a9d2 100644 --- a/Assets/Scripts/Player/HealthComponent.cs +++ b/Assets/Scripts/Player/HealthComponent.cs @@ -77,9 +77,10 @@ public class HealthComponent : MonoBehaviour, ISquezeDamageReceiver if (BloodComputeShader.Instance != null) { int blood = (int)(maxHealth * 100.0f * BloodComputeShader.Instance.scoreMult); + float power = 10.0f + (maxHealth / 25.0f); - BloodComputeShader.Instance.createBlood(transform.position, blood / 2, maxHealth / 8.0f); - BloodComputeShader.Instance.createBlood(transform.position, blood / 2, maxHealth / 8.0f); + BloodComputeShader.Instance.createBlood(transform.position, blood / 2, power); + BloodComputeShader.Instance.createBlood(transform.position, blood / 2, power); } } } diff --git a/Assets/Scripts/Player/PlayerCollideAttack.cs b/Assets/Scripts/Player/PlayerCollideAttack.cs index 458f924..70bc38c 100644 --- a/Assets/Scripts/Player/PlayerCollideAttack.cs +++ b/Assets/Scripts/Player/PlayerCollideAttack.cs @@ -9,6 +9,8 @@ public class PlayerCollideAttack : MonoBehaviour [SerializeField] AnimationCurve speedToDamage; + public float speedYouNeedToNotTakeDamageFromRammingOrSomtmh = 10f; + public void OnCollisionEnter2D(Collision2D collision) { if (collision.collider.tag != "Enemy") return; diff --git a/Assets/Scripts/Player/PlayerMovement.cs b/Assets/Scripts/Player/PlayerMovement.cs index ea59093..adcc109 100644 --- a/Assets/Scripts/Player/PlayerMovement.cs +++ b/Assets/Scripts/Player/PlayerMovement.cs @@ -18,6 +18,8 @@ public class PlayerMovement : MonoBehaviour [Header("Whipping")] [SerializeField] RopeWhipAttack whipAttack; + public float whipSmashSpeed = 2f; + public float whipSmashDamageMult = 2f; [SerializeField] private float whipMoveSpeed = 25f; @@ -28,6 +30,7 @@ public class PlayerMovement : MonoBehaviour private PlayerInput playerInput; private HealthComponent hp; + private PlayerCollideAttack attack; private void Start() { @@ -85,7 +88,12 @@ public class PlayerMovement : MonoBehaviour { if (collision.collider.gameObject.CompareTag("Enemy")) { // Other object is an enemy - hp.TakeDamage(1f); + Debug.Log("Hit enememenemy"); + if (whipAttack.IsBeingWhipped && rb.velocity.magnitude > attack.speedYouNeedToNotTakeDamageFromRammingOrSomtmh) { + // collision.collider.gameObject.GetComponent().TakeDamage(rb.velocity.magnitude * whipSmashDamageMult); + } else { + hp.TakeDamage(1f); + } } } }