From ddf59d58fffb78f6c4c34e4331da270b34335516 Mon Sep 17 00:00:00 2001 From: stilnat Date: Fri, 25 Aug 2023 22:16:53 +0200 Subject: [PATCH] fix modified damagetypeQuantity --- .../WorldObjects/Entities/Humanoids/Human/Human.prefab | 2 +- Assets/Scripts/SS3D/Systems/Health/BodyLayer.cs | 4 +++- .../Scripts/SS3D/Systems/Health/DamageTypeQuantity.cs | 10 ++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Assets/Content/WorldObjects/Entities/Humanoids/Human/Human.prefab b/Assets/Content/WorldObjects/Entities/Humanoids/Human/Human.prefab index 7bd7bc0644..753c29086c 100644 --- a/Assets/Content/WorldObjects/Entities/Humanoids/Human/Human.prefab +++ b/Assets/Content/WorldObjects/Entities/Humanoids/Human/Human.prefab @@ -7866,7 +7866,7 @@ MonoBehaviour: _networkObjectCache: {fileID: 2930813178971533500} attackParticleEffect: {fileID: 7714517724079113232, guid: 17b0d9163e9cdf14aa557557e7d9d76b, type: 3} attackType: 0 - damageAmount: 7.83 + damageAmount: 5 --- !u!114 &4947016969258934535 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/SS3D/Systems/Health/BodyLayer.cs b/Assets/Scripts/SS3D/Systems/Health/BodyLayer.cs index 088846356c..9517c3fb28 100644 --- a/Assets/Scripts/SS3D/Systems/Health/BodyLayer.cs +++ b/Assets/Scripts/SS3D/Systems/Health/BodyLayer.cs @@ -78,8 +78,10 @@ public BodyLayer(BodyPart bodyPart, List damages, List /// - public virtual void InflictDamage(DamageTypeQuantity damage) + public virtual void InflictDamage(DamageTypeQuantity damageToInflict) { + DamageTypeQuantity damage = (DamageTypeQuantity) damageToInflict.Clone(); + float currentDamageQuantity = GetDamageTypeQuantity(damage.damageType); damage.quantity = ApplyResistanceAndSusceptibility(damage); diff --git a/Assets/Scripts/SS3D/Systems/Health/DamageTypeQuantity.cs b/Assets/Scripts/SS3D/Systems/Health/DamageTypeQuantity.cs index 9a0132df19..ec8520c11a 100644 --- a/Assets/Scripts/SS3D/Systems/Health/DamageTypeQuantity.cs +++ b/Assets/Scripts/SS3D/Systems/Health/DamageTypeQuantity.cs @@ -1,8 +1,9 @@ -using System.Collections; +using System.Collections; using System.Collections.Generic; using UnityEngine; +using System; -public class DamageTypeQuantity +public class DamageTypeQuantity : ICloneable { public DamageType damageType; public float quantity; @@ -12,4 +13,9 @@ public DamageTypeQuantity(DamageType damageType, float quantity) this.damageType = damageType; this.quantity = quantity; } + + public object Clone() + { + return new DamageTypeQuantity(damageType, quantity); + } }