Blocks are all acting correctly, bomb is acting correctly

This commit is contained in:
2018-04-21 14:41:24 +10:00
parent 0001a875a6
commit ed67e81098
25 changed files with 957 additions and 193 deletions
+21
View File
@@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BlockBush : MonoBehaviour {
GameObject burnt;
void Awake() {
burnt = transform.GetChild (0).gameObject;
}
void OnTriggerEnter2D(Collider2D collider) {
//TODO: use durability class?
FireDamager fire = collider.gameObject.GetComponent<FireDamager> ();
if (fire != null) {
burnt.SetActive (true);
transform.DetachChildren ();
Destroy (gameObject);
}
}
}
+13
View File
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 3637ac4ce14452c4cada0ccc2d5d8e75
timeCreated: 1524282472
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+13
View File
@@ -0,0 +1,13 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BlockCracked : MonoBehaviour {
void OnCollisionEnter2D(Collision2D collision) {
//TODO: use durability class?
ExplosionDamager exp = collision.gameObject.GetComponent<ExplosionDamager> ();
if (exp != null) {
Destroy (gameObject);
}
}
}
+13
View File
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 7046e112ee78bae4ab5aa561c4e3c603
timeCreated: 1524277929
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+22
View File
@@ -0,0 +1,22 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BlockIce : MonoBehaviour {
public float bombTimer = -1;
public GameObject bombPrefab;
void OnTriggerEnter2D(Collider2D collider) {
//TODO: use durability class?
FireDamager fire = collider.gameObject.GetComponent<FireDamager> ();
if (fire != null) {
if (bombTimer >= 0) {
GameObject bomb = Instantiate (bombPrefab);
bomb.transform.position = transform.position;
bomb.GetComponent<Bomb> ().timer = bombTimer;
}
Destroy (gameObject);
}
}
}
+13
View File
@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: bb19c1709331b3d44b5ddc164ca9dbbe
timeCreated: 1524283289
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: