TO SQUASH: Added spark effect to game over screen.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Smoke : MonoBehaviour
|
||||
{
|
||||
public float smokeDuration = 1.5f; // Duration in seconds for the smoke effect
|
||||
|
||||
public float sparkTimer = 0.1f; // Timer for spark effect
|
||||
|
||||
public GameObject sparkEffectPrefab; // Prefab for the spark effect
|
||||
|
||||
private float smokeTimer = 0.0f;
|
||||
|
||||
private float sparkEffectTimer = 0.0f;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
smokeTimer += Time.deltaTime;
|
||||
|
||||
if (smokeTimer >= smokeDuration)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
sparkEffectTimer += Time.deltaTime;
|
||||
|
||||
if (sparkEffectTimer >= sparkTimer)
|
||||
{
|
||||
sparkEffectTimer = 0.0f;
|
||||
Vector2 randomOffset = Random.insideUnitCircle * 0.1f;
|
||||
|
||||
Instantiate(
|
||||
sparkEffectPrefab,
|
||||
transform.position + new Vector3(randomOffset.x, randomOffset.y, 0),
|
||||
Quaternion.identity
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7af5b2b00cae60da5867ed21470d4d7f
|
||||
Reference in New Issue
Block a user