Commit aa46cc77 authored by Tanner Grehawick's avatar Tanner Grehawick

breakable object

parent f8f9a2ec
using UnityEngine;
using UnityEngine.Events;
using System.Collections;
using System.Collections.Generic;
public class DashBreakable : MonoBehaviour {
public UnityEvent onBreak;
void OnCollisionEnter2D(Collision2D collision) {
if (collision.gameObject.CompareTag("Player")) {
Dash dash = collision.gameObject.GetComponent<Dash>();
if (dash != null && dash.isDashing) {
Break();
}
}
}
void Break() {
// handle animation and stuff here
onBreak.Invoke();
Destroy(gameObject);
}
}
fileFormatVersion: 2
guid: 3a07c26186d61461d8bb2547dfa73f32
timeCreated: 1487898154
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
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