Commit 2f3253fb authored by Tanner Grehawick's avatar Tanner Grehawick

DashBreakable -> Breakable

generalize breakable object
parent aa46cc77
......@@ -3,20 +3,14 @@ using UnityEngine.Events;
using System.Collections;
using System.Collections.Generic;
public class DashBreakable : MonoBehaviour {
// breakable object
public class Breakable : MonoBehaviour {
public UnityEvent onBreak;
public bool breakOnPlayerDash = false;
void OnCollisionEnter2D(Collision2D collision) {
if (collision.gameObject.CompareTag("Player")) {
Dash dash = collision.gameObject.GetComponent<Dash>();
if (dash != null && dash.isDashing) {
Break();
}
}
}
public UnityEvent onBreak;
void Break() {
public void Break() {
// handle animation and stuff here
onBreak.Invoke();
Destroy(gameObject);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment