28 lines
619 B
C#
28 lines
619 B
C#
|
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
public class ExplodingPlayerController : MonoBehaviour {
|
||
|
|
[SerializeField] private float ttl = 2f; // seconds
|
||
|
|
[SerializeField] private float flash = 0.1f; // seconds
|
||
|
|
// Start is called before the first frame update
|
||
|
|
void Start() {
|
||
|
|
Invoke("SpriteOff", flash);
|
||
|
|
Invoke("Die", ttl);
|
||
|
|
}
|
||
|
|
|
||
|
|
void SpriteOff() {
|
||
|
|
GetComponent<SpriteRenderer>().color = Color.clear;
|
||
|
|
}
|
||
|
|
|
||
|
|
void Die() {
|
||
|
|
Destroy(gameObject);
|
||
|
|
}
|
||
|
|
|
||
|
|
// Update is called once per frame
|
||
|
|
void Update()
|
||
|
|
{
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|