Respawners are disabled when their creation exists
This commit is contained in:
Generated
+3
-1
@@ -78,6 +78,8 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 379e789da7c069c4fa9e34de20cb23bc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
trigger: {fileID: 0}
|
||||
inverted: 0
|
||||
--- !u!212 &212264353888458790
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
@@ -112,7 +114,7 @@ SpriteRenderer:
|
||||
m_SortingLayerID: 1398306609
|
||||
m_SortingLayer: 2
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 21300010, guid: f0425e92c7345064ab2dccbd778f3b15, type: 3}
|
||||
m_Sprite: {fileID: 21300024, guid: f0425e92c7345064ab2dccbd778f3b15, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
|
||||
Generated
+30
@@ -311,6 +311,11 @@ Prefab:
|
||||
propertyPath: bombTimer
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 114831880267786856, guid: c4d410a301c013a468dc133a094e5478,
|
||||
type: 2}
|
||||
propertyPath: respawner
|
||||
value:
|
||||
objectReference: {fileID: 1113148580}
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 100100000, guid: c4d410a301c013a468dc133a094e5478, type: 2}
|
||||
m_IsPrefabParent: 0
|
||||
@@ -6964,6 +6969,11 @@ Prefab:
|
||||
propertyPath: timer
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 114937917394596370, guid: 37dd8e63a4accd043b621e3886a2e847,
|
||||
type: 2}
|
||||
propertyPath: respawner
|
||||
value:
|
||||
objectReference: {fileID: 1127108196}
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 100100000, guid: 37dd8e63a4accd043b621e3886a2e847, type: 2}
|
||||
m_IsPrefabParent: 0
|
||||
@@ -9008,6 +9018,11 @@ Prefab:
|
||||
propertyPath: timer
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 114937917394596370, guid: 37dd8e63a4accd043b621e3886a2e847,
|
||||
type: 2}
|
||||
propertyPath: respawner
|
||||
value:
|
||||
objectReference: {fileID: 1407204881}
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 100100000, guid: 37dd8e63a4accd043b621e3886a2e847, type: 2}
|
||||
m_IsPrefabParent: 0
|
||||
@@ -13165,6 +13180,11 @@ Prefab:
|
||||
propertyPath: timer
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 114937917394596370, guid: 37dd8e63a4accd043b621e3886a2e847,
|
||||
type: 2}
|
||||
propertyPath: respawner
|
||||
value:
|
||||
objectReference: {fileID: 875103198}
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 100100000, guid: 37dd8e63a4accd043b621e3886a2e847, type: 2}
|
||||
m_IsPrefabParent: 0
|
||||
@@ -14779,6 +14799,11 @@ Prefab:
|
||||
propertyPath: timer
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 114937917394596370, guid: 37dd8e63a4accd043b621e3886a2e847,
|
||||
type: 2}
|
||||
propertyPath: respawner
|
||||
value:
|
||||
objectReference: {fileID: 1531377536}
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 100100000, guid: 37dd8e63a4accd043b621e3886a2e847, type: 2}
|
||||
m_IsPrefabParent: 0
|
||||
@@ -15772,6 +15797,11 @@ Prefab:
|
||||
propertyPath: timer
|
||||
value: -1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 114937917394596370, guid: 37dd8e63a4accd043b621e3886a2e847,
|
||||
type: 2}
|
||||
propertyPath: respawner
|
||||
value:
|
||||
objectReference: {fileID: 1529703469}
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 100100000, guid: 37dd8e63a4accd043b621e3886a2e847, type: 2}
|
||||
m_IsPrefabParent: 0
|
||||
|
||||
@@ -11,6 +11,8 @@ public class BlockIce : MonoBehaviour {
|
||||
public GameObject bombPrefab;
|
||||
public Sprite alternateSprite;
|
||||
|
||||
public Respawner respawner; //can be respawned
|
||||
|
||||
void Awake() {
|
||||
spriteRenderer = GetComponent<SpriteRenderer> ();
|
||||
rigidBody = GetComponent<Rigidbody2D> ();
|
||||
@@ -35,7 +37,9 @@ public class BlockIce : MonoBehaviour {
|
||||
GameObject bomb = Instantiate (bombPrefab);
|
||||
bomb.transform.position = transform.position;
|
||||
bomb.GetComponent<Bomb> ().timer = bombTimer;
|
||||
bomb.GetComponent<Bomb> ().respawner = respawner;
|
||||
}
|
||||
respawner.enabled = true;
|
||||
Destroy (gameObject);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ public class Bomb : MonoBehaviour {
|
||||
GameObject explosion;
|
||||
public GameObject iceBlockPrefab;
|
||||
|
||||
public Respawner respawner; //this can be respawned
|
||||
|
||||
float birthTime;
|
||||
|
||||
void Awake() {
|
||||
@@ -36,6 +38,7 @@ public class Bomb : MonoBehaviour {
|
||||
GameObject iceBlock = Instantiate (iceBlockPrefab);
|
||||
iceBlock.transform.position = transform.position;
|
||||
iceBlock.GetComponent<BlockIce> ().bombTimer = timer - (Time.time - birthTime);
|
||||
iceBlock.GetComponent<BlockIce> ().respawner = respawner;
|
||||
Destroy (gameObject);
|
||||
}
|
||||
|
||||
@@ -50,6 +53,7 @@ public class Bomb : MonoBehaviour {
|
||||
yield return new WaitForSeconds (delay);
|
||||
explosion.SetActive (true);
|
||||
transform.DetachChildren ();
|
||||
respawner.enabled = true;
|
||||
Destroy (gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,23 @@ public class Respawner : MonoBehaviour {
|
||||
instance.SetActive (true);
|
||||
instance.transform.position = startPos;
|
||||
timer = float.NegativeInfinity;
|
||||
|
||||
//what is it?
|
||||
if (instance.GetComponent<Bomb>() != null) {
|
||||
instance.GetComponent<Bomb> ().respawner = this;
|
||||
}
|
||||
|
||||
if (instance.GetComponent<BlockIce>() != null) {
|
||||
instance.GetComponent<BlockIce> ().respawner = this;
|
||||
}
|
||||
|
||||
this.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
void OnEnable() {
|
||||
if (timer != float.NegativeInfinity) {
|
||||
timer = Time.time;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5393e4691a47a5e469998cf5228a87c8188f50ca4987a000db028a66c9840f2b
|
||||
size 1249
|
||||
oid sha256:a5f7aadde193468b39db8c2b88e6132c006e29dfb727e0932d952cf056bc0bef
|
||||
size 1301
|
||||
|
||||
Generated
+15
@@ -16,6 +16,7 @@ TextureImporter:
|
||||
21300018: tiles_ip_9
|
||||
21300020: tiles_ip_10
|
||||
21300022: tiles_ip_11
|
||||
21300024: tiles_ip_12
|
||||
externalObjects: {}
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
@@ -270,6 +271,20 @@ TextureImporter:
|
||||
outline: []
|
||||
physicsShape: []
|
||||
tessellationDetail: 0
|
||||
- serializedVersion: 2
|
||||
name: tiles_ip_12
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 64
|
||||
y: 0
|
||||
width: 16
|
||||
height: 16
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
outline: []
|
||||
physicsShape: []
|
||||
tessellationDetail: 0
|
||||
outline: []
|
||||
physicsShape: []
|
||||
spritePackingTag:
|
||||
|
||||
Reference in New Issue
Block a user