Pong-Pong/Assets/Scripts/DeathParticle.cs
Gerard Gascón 16da8e4dde init
2025-04-24 17:09:22 +02:00

37 lines
1.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DeathParticle : MonoBehaviour, IPooledObject{
public Color level1Color;
public Color level2Color;
public Color level3Color;
GameController gameController;
// Start is called before the first frame update
public void OnObjectSpawn(){
gameController = FindObjectOfType<GameController>();
if (gameController.level == 1 || gameController.level == 0){
ParticleSystem ps = GetComponent<ParticleSystem>();
var main = ps.main;
main.startColor = level1Color;
}
if (gameController.level == 2){
ParticleSystem ps = GetComponent<ParticleSystem>();
var main = ps.main;
main.startColor = level2Color;
}
if (gameController.level == 3){
ParticleSystem ps = GetComponent<ParticleSystem>();
var main = ps.main;
main.startColor = level3Color;
}
}
// Update is called once per frame
void Update(){
}
}