add some extra assets FX and SFX
This commit is contained in:
@@ -27,7 +27,9 @@ public class crate : MonoBehaviour
|
||||
public bool useCustomShader;
|
||||
public Shader customShader;
|
||||
|
||||
[Space]
|
||||
public string colorPropertyName = "_Color";
|
||||
|
||||
[Space]
|
||||
[Header ("Debug")]
|
||||
[Space]
|
||||
|
||||
@@ -54,8 +56,10 @@ public class crate : MonoBehaviour
|
||||
|
||||
Coroutine mainCoroutine;
|
||||
|
||||
int colorID;
|
||||
|
||||
private void InitializeAudioElements ()
|
||||
|
||||
private void InitializeAudioElements ()
|
||||
{
|
||||
if (brokenSound != null) {
|
||||
brokenAudioElement.clip = brokenSound;
|
||||
@@ -96,15 +100,19 @@ public class crate : MonoBehaviour
|
||||
for (i = 0; i < rendererPartsCount; i++) {
|
||||
currentMaterial = rendererParts [i];
|
||||
|
||||
Color alpha = currentMaterial.color;
|
||||
alpha.a -= Time.deltaTime / 5;
|
||||
currentMaterial.color = alpha;
|
||||
if (currentMaterial.HasProperty (colorID)) {
|
||||
Color alpha = currentMaterial.GetColor (colorID);
|
||||
|
||||
//once the alpha is 0, remove the gameObject
|
||||
if (currentMaterial.color.a > 0) {
|
||||
allPiecesFaded = false;
|
||||
}
|
||||
}
|
||||
alpha.a -= Time.deltaTime / 5;
|
||||
|
||||
currentMaterial.SetColor (colorID, alpha);
|
||||
|
||||
//once the alpha is 0, remove the gameObject
|
||||
if (alpha.a > 0) {
|
||||
allPiecesFaded = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (allPiecesFaded) {
|
||||
Destroy (gameObject);
|
||||
@@ -148,7 +156,11 @@ public class crate : MonoBehaviour
|
||||
transparentShader = Shader.Find (defaultShaderName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fadeBrokenPieces) {
|
||||
colorID = Shader.PropertyToID (colorPropertyName);
|
||||
}
|
||||
}
|
||||
|
||||
Component[] components = brokenCrateClone.GetComponentsInChildren (typeof(MeshRenderer));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user