mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-10 06:34:16 +00:00
flame VFX done
This commit is contained in:
parent
ea6e45b593
commit
c56dad1950
5 changed files with 23252 additions and 1 deletions
23220
Assets/Prefabs/Flame.prefab
Normal file
23220
Assets/Prefabs/Flame.prefab
Normal file
File diff suppressed because it is too large
Load diff
7
Assets/Prefabs/Flame.prefab.meta
Normal file
7
Assets/Prefabs/Flame.prefab.meta
Normal file
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5b0110178dbbb784cab63b7529b07cc1
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -101,3 +101,4 @@ MonoBehaviour:
|
|||
explosionLeftoverPartsMaxDepenetrationVelocity: 15
|
||||
explosionLeftoverPartsMass: 100
|
||||
smokePrefab: {fileID: 100000, guid: c5d4e25823f45c946b9dd01264b40a1b, type: 3}
|
||||
flamePrefab: {fileID: 100000, guid: 5b0110178dbbb784cab63b7529b07cc1, type: 3}
|
||||
|
|
|
@ -29,6 +29,7 @@ namespace SanAndreasUnity.Behaviours.Vehicles
|
|||
public float explosionLeftoverPartsMass = 100f;
|
||||
|
||||
public GameObject smokePrefab;
|
||||
public GameObject flamePrefab;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace SanAndreasUnity.Behaviours.Vehicles
|
|||
public float TimeWhenBecameUnderFlame { get; private set; } = float.NegativeInfinity;
|
||||
|
||||
GameObject m_smokeGameObject;
|
||||
GameObject m_flameGameObject;
|
||||
|
||||
|
||||
|
||||
|
@ -72,7 +73,7 @@ namespace SanAndreasUnity.Behaviours.Vehicles
|
|||
if (this.IsUnderFlame)
|
||||
this.TimeWhenBecameUnderFlame = Time.time;
|
||||
// update vfx
|
||||
|
||||
this.UpdateFlameVfx();
|
||||
}
|
||||
|
||||
if (this.IsUnderFlame && Time.time - this.TimeWhenBecameUnderFlame >= 5)
|
||||
|
@ -104,6 +105,27 @@ namespace SanAndreasUnity.Behaviours.Vehicles
|
|||
}
|
||||
}
|
||||
|
||||
void UpdateFlameVfx()
|
||||
{
|
||||
if (this.IsUnderFlame)
|
||||
{
|
||||
if (null == m_flameGameObject)
|
||||
{
|
||||
Transform parent = this.EngineTransform != null ? this.EngineTransform : this.transform;
|
||||
m_flameGameObject = Object.Instantiate(
|
||||
VehicleManager.Instance.flamePrefab, parent.position, parent.rotation, parent);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (null != m_flameGameObject)
|
||||
{
|
||||
Object.Destroy(m_flameGameObject);
|
||||
m_flameGameObject = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Explode()
|
||||
{
|
||||
F.RunExceptionSafe(() => this.ExplodeInternal());
|
||||
|
|
Loading…
Reference in a new issue