28 lines
809 B
C#
28 lines
809 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Obstacle : MonoBehaviour
|
|
{
|
|
void OnTriggerEnter2D(Collider2D other){
|
|
|
|
if(other.tag == "Powerup"){
|
|
LevelGeneratorV2.instance.DespawnPickup(other.gameObject);
|
|
PlayerController.instance.ActivatePowerup();
|
|
return;
|
|
}
|
|
Debug.Log(other.name);
|
|
|
|
if(other.tag == "asteroid"){
|
|
if(PlayerController.instance.PowerupActive){
|
|
PlayerController.instance.SpawnExplosionFX(other.transform.position);
|
|
LevelGeneratorV2.instance.DespawnAsteroid(other.gameObject);
|
|
DataManager.AddItem("add_asteroid.php");
|
|
return;
|
|
}
|
|
}
|
|
|
|
PlayerController.instance.GameOver();
|
|
}
|
|
}
|