add some extra assets FX and SFX
This commit is contained in:
@@ -46,7 +46,9 @@ public class simpleBreakObject : MonoBehaviour
|
||||
public Shader transparentShader;
|
||||
public string defaultShaderName = "Legacy Shaders/Transparent/Diffuse";
|
||||
|
||||
[Space]
|
||||
public string colorPropertyName = "_Color";
|
||||
|
||||
[Space]
|
||||
[Header ("Explosion Damage Settings")]
|
||||
[Space]
|
||||
|
||||
@@ -161,6 +163,8 @@ public class simpleBreakObject : MonoBehaviour
|
||||
|
||||
float currentTimeToRemovePieces;
|
||||
|
||||
int colorID = -1;
|
||||
|
||||
|
||||
private void Start ()
|
||||
{
|
||||
@@ -198,17 +202,19 @@ public class simpleBreakObject : MonoBehaviour
|
||||
for (i = 0; i < rendererPartsCount; i++) {
|
||||
currentMaterial = rendererParts [i];
|
||||
|
||||
Color alpha = currentMaterial.color;
|
||||
if (currentMaterial.HasProperty (colorID)) {
|
||||
Color alpha = currentMaterial.GetColor (colorID);
|
||||
|
||||
alpha.a -= Time.deltaTime / fadePiecesSpeed;
|
||||
alpha.a -= Time.deltaTime / fadePiecesSpeed;
|
||||
|
||||
currentMaterial.color = alpha;
|
||||
currentMaterial.SetColor (colorID, alpha);
|
||||
|
||||
//once the alpha is 0, remove the gameObject
|
||||
if (currentMaterial.color.a > 0) {
|
||||
allPiecesFaded = false;
|
||||
}
|
||||
}
|
||||
//once the alpha is 0, remove the gameObject
|
||||
if (alpha.a > 0) {
|
||||
allPiecesFaded = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (allPiecesFaded) {
|
||||
if (destroyObjectAfterFade) {
|
||||
@@ -309,6 +315,10 @@ public class simpleBreakObject : MonoBehaviour
|
||||
if (transparentShader == null) {
|
||||
transparentShader = Shader.Find (defaultShaderName);
|
||||
}
|
||||
|
||||
if (colorID == -1) {
|
||||
colorID = Shader.PropertyToID (colorPropertyName);
|
||||
}
|
||||
}
|
||||
|
||||
if (useExplosionAroundEnabled) {
|
||||
|
||||
Reference in New Issue
Block a user