Skip to content

Commit

Permalink
fix modified damagetypeQuantity
Browse files Browse the repository at this point in the history
  • Loading branch information
stilnat committed Aug 25, 2023
1 parent 4ff22ac commit ddf59d5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion Assets/Scripts/SS3D/Systems/Health/BodyLayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ public BodyLayer(BodyPart bodyPart, List<DamageTypeQuantity> damages, List<Damag
/// Add damage without going above max damage for any given type.
/// </summary>
/// <param name="damageQuantity"></param>
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);

Expand Down
10 changes: 8 additions & 2 deletions Assets/Scripts/SS3D/Systems/Health/DamageTypeQuantity.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -12,4 +13,9 @@ public DamageTypeQuantity(DamageType damageType, float quantity)
this.damageType = damageType;
this.quantity = quantity;
}

public object Clone()
{
return new DamageTypeQuantity(damageType, quantity);
}
}

0 comments on commit ddf59d5

Please sign in to comment.