2023-04-11 19:55:24 -07:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
2023-05-06 22:09:15 -07:00
|
|
|
public class ProjectileBehavior : MonoBehaviour
|
|
|
|
{
|
2023-04-11 19:55:24 -07:00
|
|
|
|
|
|
|
public bool pinned = false;
|
|
|
|
|
2023-05-06 22:09:15 -07:00
|
|
|
public void Explode()
|
|
|
|
{
|
2023-04-11 19:55:24 -07:00
|
|
|
Destroy(this.gameObject);
|
|
|
|
}
|
|
|
|
|
2023-05-06 22:09:15 -07:00
|
|
|
public void Pin()
|
|
|
|
{
|
2023-04-11 19:55:24 -07:00
|
|
|
this.gameObject.GetComponent<Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeAll;
|
|
|
|
this.gameObject.GetComponent<BoxCollider2D>().enabled = false;
|
|
|
|
}
|
|
|
|
|
2023-05-06 22:09:15 -07:00
|
|
|
public void OnCollisionEnter2D(Collision2D col)
|
|
|
|
{
|
2023-05-07 00:09:37 -07:00
|
|
|
if (col.gameObject.tag == "wall" || col.gameObject.tag == "Player")
|
2023-05-06 22:09:15 -07:00
|
|
|
{
|
2023-04-11 19:55:24 -07:00
|
|
|
Explode();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|