Commit ed0f382b authored by Rene's avatar Rene

heart explosion

parent 83e63986
......@@ -77,6 +77,12 @@ PrefabInstance:
propertyPath: bombType
value: 5
objectReference: {fileID: 0}
- target: {fileID: 6031096278621627649, guid: 19b57e3b0f03e9647a086dba76b26a94,
type: 3}
propertyPath: winParticle
value:
objectReference: {fileID: 6886124997041062844, guid: e59fea3f96b8f490f951d3b7f7de21e0,
type: 3}
- target: {fileID: 5492802657688666183, guid: 19b57e3b0f03e9647a086dba76b26a94,
type: 3}
propertyPath: m_Materials.Array.size
......
......@@ -103,6 +103,8 @@ MonoBehaviour:
BlocksToDestroy: 010000000200000004000000
explosionParticlesPrefab: {fileID: 2947187129184063510, guid: cfd312151975c4765aa0ee9072de5d94,
type: 3}
winParticle: {fileID: 6886124997041062844, guid: e59fea3f96b8f490f951d3b7f7de21e0,
type: 3}
--- !u!95 &6538770151698867305
Animator:
serializedVersion: 3
......
......@@ -9,6 +9,7 @@ public class Explosion : MonoBehaviour
[SerializeField]
List<Globals.BoxType> BlocksToDestroy;
public GameObject explosionParticlesPrefab;
public GameObject winParticle;
private LayerMask explodableMask;
private LayerMask obstacleMask;
private float strength;
......@@ -42,13 +43,7 @@ public class Explosion : MonoBehaviour
public void Explode()
{
GameObject explosionPartices = Instantiate(explosionParticlesPrefab, transform.position, Quaternion.Euler(0f, 0f, 0f));
Destroy(explosionPartices, 5f);
SoundPlayer player = explosionPartices.GetComponent<SoundPlayer>();
if (player != null)
{
player.PlayExplosionSound(bombType);
}
Collider[] hits = Physics.OverlapSphere(transform.position, strength, explodableMask);
for (int i = 0; i < hits.Length; i++)
{
......@@ -66,6 +61,27 @@ public class Explosion : MonoBehaviour
destructable.ExplosionDestroy();
}
}
if (GameManager.Instance.GotThePrincess)
{
GameObject explosionPartices = Instantiate(winParticle, transform.position, Quaternion.Euler(0f, 0f, 0f));
Destroy(explosionPartices, 5f);
SoundPlayer player = explosionPartices.GetComponent<SoundPlayer>();
if (player != null)
{
player.PlayExplosionSound(bombType);
}
}
else
{
GameObject explosionPartices = Instantiate(explosionParticlesPrefab, transform.position, Quaternion.Euler(0f, 0f, 0f));
Destroy(explosionPartices, 5f);
SoundPlayer player = explosionPartices.GetComponent<SoundPlayer>();
if (player != null)
{
player.PlayExplosionSound(bombType);
}
}
Destroy(gameObject);
}
......
......@@ -6,6 +6,8 @@ MonoImporter:
defaultReferences:
- explosionParticlesPrefab: {fileID: 2947187129184063510, guid: cfd312151975c4765aa0ee9072de5d94,
type: 3}
- winParticle: {fileID: 6886124997041062844, guid: e59fea3f96b8f490f951d3b7f7de21e0,
type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:
......
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