mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-14 16:27:19 +00:00
ped can not be damaged by explosion while he is in vehicle
This commit is contained in:
parent
e5c6144706
commit
99c1cf8ecc
3 changed files with 15 additions and 3 deletions
|
@ -195,6 +195,17 @@ namespace SanAndreasUnity.Behaviours.Peds.States
|
|||
return base.GetCameraFocusPos();
|
||||
}
|
||||
|
||||
public override void OnDamaged(DamageInfo damageInfo)
|
||||
{
|
||||
if (damageInfo.damageType == DamageType.Explosion)
|
||||
{
|
||||
// ped should not be damaged by explosion while he is in vehicle
|
||||
return;
|
||||
}
|
||||
|
||||
base.OnDamaged(damageInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -187,7 +187,8 @@ namespace SanAndreasUnity.Behaviours.Vehicles
|
|||
explosionCenter,
|
||||
VehicleManager.Instance.explosionDamageRadius,
|
||||
Mathf.Pow(this.HandlingData.Mass, VehicleManager.Instance.explosionMassToDamageExponent),
|
||||
VehicleManager.Instance.explosionDamageOverDistanceCurve);
|
||||
VehicleManager.Instance.explosionDamageOverDistanceCurve,
|
||||
DamageType.Explosion);
|
||||
|
||||
// create explosion effect
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace SanAndreasUnity.Utilities
|
|||
}
|
||||
|
||||
public static void InflictDamageToObjectsInArea(
|
||||
Vector3 center, float radius, float damageAmount, AnimationCurve damageOverDistanceCurve)
|
||||
Vector3 center, float radius, float damageAmount, AnimationCurve damageOverDistanceCurve, string damageType)
|
||||
{
|
||||
Collider[] overlappingColliders = Physics.OverlapSphere(center, radius);
|
||||
|
||||
|
@ -102,7 +102,7 @@ namespace SanAndreasUnity.Utilities
|
|||
float distanceFactor = damageOverDistanceCurve.Evaluate(Mathf.Clamp01(distance / radius));
|
||||
float damageAmountBasedOnDistance = damageAmount * distanceFactor;
|
||||
|
||||
F.RunExceptionSafe(() => damageable.Damage(new DamageInfo() { amount = damageAmountBasedOnDistance }));
|
||||
F.RunExceptionSafe(() => damageable.Damage(new DamageInfo() { amount = damageAmountBasedOnDistance, damageType = damageType }));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue