modify strength of explosion based on vehicle mass

This commit is contained in:
in0finite 2020-06-21 15:43:19 +02:00
parent 44fe30d8df
commit 2e02d0dab2

View file

@ -1,6 +1,7 @@
using System.Linq;
using SanAndreasUnity.Utilities;
using UnityEngine;
using UnityStandardAssets.Effects;
namespace SanAndreasUnity.Behaviours.Vehicles
{
@ -182,7 +183,10 @@ namespace SanAndreasUnity.Behaviours.Vehicles
// create explosion effect
Object.Instantiate(VehicleManager.Instance.explosionPrefab, this.transform.position, this.transform.rotation);
GameObject explosionGo = Object.Instantiate(VehicleManager.Instance.explosionPrefab, this.transform.position, this.transform.rotation);
// modify strength of explosion based on vehicle mass
explosionGo.GetComponentOrThrow<ExplosionPhysicsForce>().explosionForce *= this.HandlingData.Mass / 1500f;
}