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

21 lines
531 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GunController : MonoBehaviour, IPooledObject{
// Start is called before the first frame update
public void OnObjectSpawn(){
StartCoroutine(Remove());
}
IEnumerator Remove(){
yield return new WaitForSeconds(12f);
gameObject.SetActive(false);
}
void OnTriggerEnter2D(Collider2D col){
if(col.gameObject.tag == "Player"){
gameObject.SetActive(false);
}
}
}