test
testing
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3254ddff8f1e1194294c6b20a8113330
|
||||
DefaultImporter:
|
||||
userData:
|
||||
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6f1bcea5f862f8945ab68538a5b22594
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e02e06584f51ab42986fd44c73d976e
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 809320482fb694b6e8149a226202b86a
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c8fd86fe5050dc04bb501b291c30f591
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5aa57d4bf54d5d4cb8a2bcc8eec4389
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a5dc44bfe769d94ba1bcab91c5c3107
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a6951ec14b27ed4da27d13818dbebd2
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 49ee383306650b645b8a12b582a38b10
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc533b4ca16d3cd4d94b4d9e8b3376f0
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 13266a9cf8da28e41bfa61b378dfabc5
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d036894dd2a9024a978924c521444bf
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b9dd5ecd168e0b54295932b5b107b983
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 67e5b9f09995840449c988b145cc1d7b
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7514e3ecececf4075a101607065d0ea5
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f600b4a5a289d0548842df7f27d883ea
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7cf49b5115533ab4786dba0288372de8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bcc881012ce9b1a44a003cb95f5ac882
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97eae260bcd9a654290b75c24c875fe6
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b188f2597c4e6d845becfdd5b89e9c83
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1f04e36f76ff4d24c94d1948542b7767
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 390c715cc29152a439ae151137689eb5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 80e636784b9da5c44816995db7529034
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+47
@@ -0,0 +1,47 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 60e1d0a96221932478bd7120d0e366c9
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
linearTexture: 0
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 2
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapMode: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 0
|
||||
textureType: -1
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+47
@@ -0,0 +1,47 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e151393df889e545a0c0e295799dd39
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
linearTexture: 0
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 2
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapMode: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 0
|
||||
textureType: -1
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+47
@@ -0,0 +1,47 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c2557bac1251fb84aa9cfb8484770b19
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
linearTexture: 0
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 2
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapMode: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 0
|
||||
textureType: -1
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
// Per pixel bumped refraction.
|
||||
// Uses a normal map to distort the image behind, and
|
||||
// an additional texture to tint the color.
|
||||
|
||||
Shader "HeatDistort" {
|
||||
Properties {
|
||||
_BumpAmt ("Distortion", range (0,128)) = 10
|
||||
_MainTex ("Tint Color (RGB)", 2D) = "white" {}
|
||||
_BumpMap ("Normalmap", 2D) = "bump" {}
|
||||
}
|
||||
|
||||
CGINCLUDE
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#pragma fragmentoption ARB_fog_exp2
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
sampler2D _GrabTexture : register(s0);
|
||||
float4 _GrabTexture_TexelSize;
|
||||
sampler2D _BumpMap : register(s1);
|
||||
sampler2D _MainTex : register(s2);
|
||||
|
||||
struct v2f {
|
||||
float4 vertex : POSITION;
|
||||
float4 uvgrab : TEXCOORD0;
|
||||
float2 uvbump : TEXCOORD1;
|
||||
float2 uvmain : TEXCOORD2;
|
||||
};
|
||||
|
||||
uniform float _BumpAmt;
|
||||
|
||||
|
||||
half4 frag( v2f i ) : COLOR
|
||||
{
|
||||
// calculate perturbed coordinates
|
||||
half2 bump = UnpackNormal(tex2D( _BumpMap, i.uvbump )).rg; // we could optimize this by just reading the x & y without reconstructing the Z
|
||||
float2 offset = bump * _BumpAmt * _GrabTexture_TexelSize.xy;
|
||||
i.uvgrab.xy = offset * i.uvgrab.z + i.uvgrab.xy;
|
||||
|
||||
half4 col = tex2Dproj( _GrabTexture, i.uvgrab.xyw );
|
||||
half4 tint = tex2D( _MainTex, i.uvmain );
|
||||
return col * tint;
|
||||
}
|
||||
ENDCG
|
||||
|
||||
Category {
|
||||
|
||||
// We must be transparent, so other objects are drawn before this one.
|
||||
Tags { "Queue"="Transparent+100" "RenderType"="Opaque" }
|
||||
|
||||
|
||||
SubShader {
|
||||
|
||||
// This pass grabs the screen behind the object into a texture.
|
||||
// We can access the result in the next pass as _GrabTexture
|
||||
GrabPass {
|
||||
Name "BASE"
|
||||
Tags { "LightMode" = "Always" }
|
||||
}
|
||||
|
||||
// Main pass: Take the texture grabbed above and use the bumpmap to perturb it
|
||||
// on to the screen
|
||||
Pass {
|
||||
Name "BASE"
|
||||
Tags { "LightMode" = "Always" }
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
struct appdata_t {
|
||||
float4 vertex : POSITION;
|
||||
float2 texcoord: TEXCOORD0;
|
||||
};
|
||||
|
||||
v2f vert (appdata_t v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
float scale = -1.0;
|
||||
#else
|
||||
float scale = 1.0;
|
||||
#endif
|
||||
o.uvgrab.xy = (float2(o.vertex.x, o.vertex.y*scale) + o.vertex.w) * 0.5;
|
||||
o.uvgrab.zw = o.vertex.zw;
|
||||
o.uvbump = MultiplyUV( UNITY_MATRIX_TEXTURE1, v.texcoord );
|
||||
o.uvmain = MultiplyUV( UNITY_MATRIX_TEXTURE2, v.texcoord );
|
||||
return o;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Fallback for older cards and Unity non-Pro
|
||||
|
||||
SubShader {
|
||||
Blend DstColor Zero
|
||||
Pass {
|
||||
Name "BASE"
|
||||
SetTexture [_MainTex] { combine texture }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5e4f5945c634c4261985dc9a1204b410
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
BIN
Binary file not shown.
+47
@@ -0,0 +1,47 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6afb434a05206a8498be9dcdde17038e
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
linearTexture: 0
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 2
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 1
|
||||
externalNormalMap: 1
|
||||
heightScale: .128125012
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapMode: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 0
|
||||
textureType: 5
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+47
@@ -0,0 +1,47 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b7460a00d2f78cc48a5f7acbafe163e8
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
linearTexture: 0
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 2
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapMode: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 0
|
||||
textureType: -1
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+47
@@ -0,0 +1,47 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a6221eb1b1c50a4cb69a62e2f264e58
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
linearTexture: 1
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 2
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 1
|
||||
heightScale: .113163069
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapMode: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 0
|
||||
textureType: 1
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f885f3a9d8713434a8460cf20777afb6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 49d7999f9fb85954c9541f9a0b0486c3
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5cae1a02f5362443284e452c3020967f
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
var startTimeMin : float = 0;
|
||||
var startTimeMax : float = 0;
|
||||
var stopTimeMin : float = 10;
|
||||
var stopTimeMax : float = 10;
|
||||
|
||||
var firstMaterial : Material;
|
||||
var secondMaterial : Material;
|
||||
|
||||
private var startTime : float;
|
||||
private var stopTime : float;
|
||||
|
||||
//the time at which this came into existence
|
||||
private var spawnTime : float;
|
||||
private var isReallyOn : boolean;
|
||||
function Start ()
|
||||
{
|
||||
isReallyOn = this.particleEmitter.emit;
|
||||
|
||||
//this kind of emitter should always start off
|
||||
this.particleEmitter.emit = false;
|
||||
|
||||
spawnTime = Time.time;
|
||||
|
||||
//get a random number between startTimeMin and Max
|
||||
startTime = (Random.value * (startTimeMax - startTimeMin)) + startTimeMin + Time.time;
|
||||
stopTime = (Random.value * (stopTimeMax - stopTimeMin)) + stopTimeMin + Time.time;
|
||||
|
||||
//assign a random material
|
||||
if (Random.value > 0.5)
|
||||
{
|
||||
this.renderer.material = firstMaterial;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.renderer.material = secondMaterial;
|
||||
}
|
||||
}
|
||||
|
||||
function FixedUpdate ()
|
||||
{
|
||||
//is the start time passed? turn emit on
|
||||
if (Time.time > startTime)
|
||||
{
|
||||
this.particleEmitter.emit = isReallyOn;
|
||||
}
|
||||
|
||||
if (Time.time > stopTime)
|
||||
{
|
||||
this.particleEmitter.emit = false;
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: df92d695c4ff68242accb9e653b5d492
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: abdc837d9a07acd409959e581ef68e61
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 73f397fcfa3321a49ac827430c240174
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3049dffabc5225d40b27675901977fdd
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02a46fb295082ed488cab61782ddc01f
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b74c77ac638a7df4888a2868fe0c8da3
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b4d8055067ce04d4c98367d69c10b358
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 21588279b895eef48a0448f7f2519813
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d7e594d401a7524e82695dcd66c2bc0
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 36aa334bd0865ca459c9b3dfbbaf7198
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 89e463182d43fd449ad551ac8dbeb99f
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35c8aea4fddc3f842bd829a8fd3d7e1c
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
BIN
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f06b8099b9784ec43ba5312c467321e4
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a9c22f8fd34f1f408046a7f6c33b781
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f03951fee9bec9478d1ec979ba44677
|
||||
AudioImporter:
|
||||
serializedVersion: 4
|
||||
format: 0
|
||||
quality: .5
|
||||
stream: 1
|
||||
3D: 1
|
||||
forceToMono: 0
|
||||
useHardware: 0
|
||||
loopable: 0
|
||||
userData:
|
||||
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 33cd429e81395944088573e40e271f18
|
||||
AudioImporter:
|
||||
serializedVersion: 4
|
||||
format: 0
|
||||
quality: .5
|
||||
stream: 1
|
||||
3D: 1
|
||||
forceToMono: 0
|
||||
useHardware: 0
|
||||
loopable: 0
|
||||
userData:
|
||||
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1792989a5a33779428d2dbe9a9430605
|
||||
AudioImporter:
|
||||
serializedVersion: 4
|
||||
format: 0
|
||||
quality: .5
|
||||
stream: 1
|
||||
3D: 1
|
||||
forceToMono: 0
|
||||
useHardware: 0
|
||||
loopable: 0
|
||||
userData:
|
||||
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 395ebd3d6fca1ec40a6b3c7415c1edb7
|
||||
AudioImporter:
|
||||
serializedVersion: 4
|
||||
format: 0
|
||||
quality: .5
|
||||
stream: 1
|
||||
3D: 1
|
||||
forceToMono: 0
|
||||
useHardware: 0
|
||||
loopable: 0
|
||||
userData:
|
||||
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cff41edee98c9f34594c01e2565d4e3f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
@@ -0,0 +1,461 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
/*
|
||||
|
||||
Detonator - A parametric explosion system for Unity
|
||||
Created by Ben Throop in August 2009 for the Unity Summer of Code
|
||||
|
||||
Simplest use case:
|
||||
|
||||
1) Use a prefab
|
||||
|
||||
OR
|
||||
|
||||
1) Attach a Detonator to a GameObject, either through code or the Unity UI
|
||||
2) Either set the Detonator's ExplodeOnStart = true or call Explode() yourself when the time is right
|
||||
3) View explosion :)
|
||||
|
||||
Medium Complexity Use Case:
|
||||
|
||||
1) Attach a Detonator as above
|
||||
2) Change parameters, add your own materials, etc
|
||||
3) Explode()
|
||||
4) View Explosion
|
||||
|
||||
Super Fun Use Case:
|
||||
|
||||
1) Attach a Detonator as above
|
||||
2) Drag one or more DetonatorComponents to that same GameObject
|
||||
3) Tweak those parameters
|
||||
4) Explode()
|
||||
5) View Explosion
|
||||
|
||||
Better documentation is included as a PDF with this package, or is available online. Check the Unity site for a link
|
||||
or visit my site, listed below.
|
||||
|
||||
Ben Throop
|
||||
http://variancetheory.com
|
||||
@benimaru
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
All pieces of Detonator inherit from this.
|
||||
*/
|
||||
public abstract class DetonatorComponent : MonoBehaviour
|
||||
{
|
||||
public bool on = true;
|
||||
public bool detonatorControlled = true;
|
||||
|
||||
[HideInInspector]
|
||||
public float startSize = 1f;
|
||||
public float size = 1f;
|
||||
|
||||
public float explodeDelayMin = 0f;
|
||||
public float explodeDelayMax = 0f;
|
||||
|
||||
[HideInInspector]
|
||||
public float startDuration = 2f;
|
||||
public float duration = 2f;
|
||||
|
||||
[HideInInspector]
|
||||
public float timeScale = 1f;
|
||||
|
||||
[HideInInspector]
|
||||
public float startDetail = 1f;
|
||||
public float detail = 1f;
|
||||
|
||||
[HideInInspector]
|
||||
public Color startColor = Color.white;
|
||||
public Color color = Color.white;
|
||||
|
||||
[HideInInspector]
|
||||
public Vector3 startLocalPosition = Vector3.zero;
|
||||
public Vector3 localPosition = Vector3.zero;
|
||||
|
||||
[HideInInspector]
|
||||
public Vector3 startForce = Vector3.zero;
|
||||
public Vector3 force = Vector3.zero;
|
||||
|
||||
[HideInInspector]
|
||||
public Vector3 startVelocity = Vector3.zero;
|
||||
public Vector3 velocity = Vector3.zero;
|
||||
|
||||
public abstract void Explode();
|
||||
|
||||
//The main Detonator calls this instead of using Awake() or Start() on subcomponents
|
||||
//which ensures it happens when we want.
|
||||
public abstract void Init();
|
||||
|
||||
public float detailThreshold;
|
||||
|
||||
/*
|
||||
This exists because Detonator makes relative changes
|
||||
to set values once the game is running, so we need to store their beginning
|
||||
values somewhere to calculate against. An improved design could probably
|
||||
avoid this.
|
||||
*/
|
||||
public void SetStartValues()
|
||||
{
|
||||
startSize = size;
|
||||
startForce = force;
|
||||
startVelocity = velocity;
|
||||
startDuration = duration;
|
||||
startDetail = detail;
|
||||
startColor = color;
|
||||
startLocalPosition = localPosition;
|
||||
}
|
||||
|
||||
//implement functions to find the Detonator on this GO and get materials if they are defined
|
||||
public Detonator MyDetonator()
|
||||
{
|
||||
Detonator _myDetonator = GetComponent("Detonator") as Detonator;
|
||||
return _myDetonator;
|
||||
}
|
||||
}
|
||||
|
||||
[AddComponentMenu("Detonator/Detonator")]
|
||||
public class Detonator : MonoBehaviour {
|
||||
|
||||
private static float _baseSize = 30f;
|
||||
private static Color _baseColor = new Color(1f, .423f, 0f, .5f);
|
||||
private static float _baseDuration = 3f;
|
||||
|
||||
/*
|
||||
_baseSize reflects the size that DetonatorComponents at size 1 match. Yes, this is really big (30m)
|
||||
size below is the default Detonator size, which is more reasonable for typical useage.
|
||||
It wasn't my intention for them to be different, and I may change that, but for now, that's how it is.
|
||||
*/
|
||||
public float size = 10f;
|
||||
public Color color = Detonator._baseColor;
|
||||
public bool explodeOnStart = true;
|
||||
public float duration = Detonator._baseDuration;
|
||||
public float detail = 1f;
|
||||
public float upwardsBias = 0f;
|
||||
|
||||
public float destroyTime = 7f; //sorry this is not auto calculated... yet.
|
||||
public bool useWorldSpace = true;
|
||||
public Vector3 direction = Vector3.zero;
|
||||
|
||||
public Material fireballAMaterial;
|
||||
public Material fireballBMaterial;
|
||||
public Material smokeAMaterial;
|
||||
public Material smokeBMaterial;
|
||||
public Material shockwaveMaterial;
|
||||
public Material sparksMaterial;
|
||||
public Material glowMaterial;
|
||||
public Material heatwaveMaterial;
|
||||
|
||||
private Component[] components;
|
||||
|
||||
private DetonatorFireball _fireball;
|
||||
private DetonatorSparks _sparks;
|
||||
private DetonatorShockwave _shockwave;
|
||||
private DetonatorSmoke _smoke;
|
||||
private DetonatorGlow _glow;
|
||||
private DetonatorLight _light;
|
||||
private DetonatorForce _force;
|
||||
private DetonatorHeatwave _heatwave;
|
||||
public bool autoCreateFireball = true;
|
||||
public bool autoCreateSparks = true;
|
||||
public bool autoCreateShockwave = true;
|
||||
public bool autoCreateSmoke = true;
|
||||
public bool autoCreateGlow = true;
|
||||
public bool autoCreateLight = true;
|
||||
public bool autoCreateForce = true;
|
||||
public bool autoCreateHeatwave = false;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
FillDefaultMaterials();
|
||||
|
||||
components = this.GetComponents(typeof(DetonatorComponent));
|
||||
foreach (DetonatorComponent dc in components)
|
||||
{
|
||||
if (dc is DetonatorFireball)
|
||||
{
|
||||
_fireball = dc as DetonatorFireball;
|
||||
}
|
||||
if (dc is DetonatorSparks)
|
||||
{
|
||||
_sparks = dc as DetonatorSparks;
|
||||
}
|
||||
if (dc is DetonatorShockwave)
|
||||
{
|
||||
_shockwave = dc as DetonatorShockwave;
|
||||
}
|
||||
if (dc is DetonatorSmoke)
|
||||
{
|
||||
_smoke = dc as DetonatorSmoke;
|
||||
}
|
||||
if (dc is DetonatorGlow)
|
||||
{
|
||||
_glow = dc as DetonatorGlow;
|
||||
}
|
||||
if (dc is DetonatorLight)
|
||||
{
|
||||
_light = dc as DetonatorLight;
|
||||
}
|
||||
if (dc is DetonatorForce)
|
||||
{
|
||||
_force = dc as DetonatorForce;
|
||||
}
|
||||
if (dc is DetonatorHeatwave)
|
||||
{
|
||||
_heatwave = dc as DetonatorHeatwave;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_fireball && autoCreateFireball)
|
||||
{
|
||||
_fireball = gameObject.AddComponent("DetonatorFireball") as DetonatorFireball;
|
||||
_fireball.Reset();
|
||||
}
|
||||
|
||||
if (!_smoke && autoCreateSmoke)
|
||||
{
|
||||
_smoke = gameObject.AddComponent("DetonatorSmoke") as DetonatorSmoke;
|
||||
_smoke.Reset();
|
||||
}
|
||||
|
||||
if (!_sparks && autoCreateSparks)
|
||||
{
|
||||
_sparks = gameObject.AddComponent("DetonatorSparks") as DetonatorSparks;
|
||||
_sparks.Reset();
|
||||
}
|
||||
|
||||
if (!_shockwave && autoCreateShockwave)
|
||||
{
|
||||
_shockwave = gameObject.AddComponent("DetonatorShockwave") as DetonatorShockwave;
|
||||
_shockwave.Reset();
|
||||
}
|
||||
|
||||
if (!_glow && autoCreateGlow)
|
||||
{
|
||||
_glow = gameObject.AddComponent("DetonatorGlow") as DetonatorGlow;
|
||||
_glow.Reset();
|
||||
}
|
||||
|
||||
if (!_light && autoCreateLight)
|
||||
{
|
||||
_light = gameObject.AddComponent("DetonatorLight") as DetonatorLight;
|
||||
_light.Reset();
|
||||
}
|
||||
|
||||
if (!_force && autoCreateForce)
|
||||
{
|
||||
_force = gameObject.AddComponent("DetonatorForce") as DetonatorForce;
|
||||
_force.Reset();
|
||||
}
|
||||
|
||||
if (!_heatwave && autoCreateHeatwave && SystemInfo.supportsImageEffects)
|
||||
{
|
||||
_heatwave = gameObject.AddComponent("DetonatorHeatwave") as DetonatorHeatwave;
|
||||
_heatwave.Reset();
|
||||
}
|
||||
|
||||
components = this.GetComponents(typeof(DetonatorComponent));
|
||||
}
|
||||
|
||||
void FillDefaultMaterials()
|
||||
{
|
||||
if (!fireballAMaterial) fireballAMaterial = DefaultFireballAMaterial();
|
||||
if (!fireballBMaterial) fireballBMaterial = DefaultFireballBMaterial();
|
||||
if (!smokeAMaterial) smokeAMaterial = DefaultSmokeAMaterial();
|
||||
if (!smokeBMaterial) smokeBMaterial = DefaultSmokeBMaterial();
|
||||
if (!shockwaveMaterial) shockwaveMaterial = DefaultShockwaveMaterial();
|
||||
if (!sparksMaterial) sparksMaterial = DefaultSparksMaterial();
|
||||
if (!glowMaterial) glowMaterial = DefaultGlowMaterial();
|
||||
if (!heatwaveMaterial) heatwaveMaterial = DefaultHeatwaveMaterial();
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (explodeOnStart)
|
||||
{
|
||||
UpdateComponents();
|
||||
this.Explode();
|
||||
}
|
||||
}
|
||||
|
||||
private float _lastExplosionTime = 1000f;
|
||||
void Update ()
|
||||
{
|
||||
if (destroyTime > 0f)
|
||||
{
|
||||
if (_lastExplosionTime + destroyTime <= Time.time)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool _firstComponentUpdate = true;
|
||||
void UpdateComponents()
|
||||
{
|
||||
if (_firstComponentUpdate)
|
||||
{
|
||||
foreach (DetonatorComponent component in components)
|
||||
{
|
||||
component.Init();
|
||||
component.SetStartValues();
|
||||
}
|
||||
_firstComponentUpdate = false;
|
||||
}
|
||||
|
||||
if (!_firstComponentUpdate)
|
||||
{
|
||||
foreach (DetonatorComponent component in components)
|
||||
{
|
||||
if (component.detonatorControlled)
|
||||
{
|
||||
component.size = component.startSize * (size / _baseSize);
|
||||
component.timeScale = (duration / _baseDuration);
|
||||
component.detail = component.startDetail * detail;
|
||||
component.force = (component.startForce * (size /_baseSize)) + (direction * (size /_baseSize));
|
||||
component.velocity = (component.startVelocity * (size /_baseSize)) + (direction * (size /_baseSize));
|
||||
|
||||
//take the alpha of detonator color and consider it a weight - 1=use all detonator, 0=use all components
|
||||
component.color = Color.Lerp(component.startColor, color, color.a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Component[] _subDetonators;
|
||||
|
||||
public void Explode()
|
||||
{
|
||||
_lastExplosionTime = Time.time;
|
||||
|
||||
foreach (DetonatorComponent component in components)
|
||||
{
|
||||
UpdateComponents();
|
||||
component.Explode();
|
||||
}
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
size = 10f; //this is hardcoded because _baseSize up top is not really the default as much as what we match to
|
||||
color = _baseColor;
|
||||
duration = _baseDuration;
|
||||
FillDefaultMaterials();
|
||||
}
|
||||
|
||||
|
||||
//Default Materials
|
||||
//The statics are so that even if there are multiple Detonators in the world, they
|
||||
//don't each create their own default materials. Theoretically this will reduce draw calls, but I haven't really
|
||||
//tested that.
|
||||
public static Material defaultFireballAMaterial;
|
||||
public static Material defaultFireballBMaterial;
|
||||
public static Material defaultSmokeAMaterial;
|
||||
public static Material defaultSmokeBMaterial;
|
||||
public static Material defaultShockwaveMaterial;
|
||||
public static Material defaultSparksMaterial;
|
||||
public static Material defaultGlowMaterial;
|
||||
public static Material defaultHeatwaveMaterial;
|
||||
|
||||
public static Material DefaultFireballAMaterial()
|
||||
{
|
||||
if (defaultFireballAMaterial != null) return defaultFireballAMaterial;
|
||||
defaultFireballAMaterial = new Material(Shader.Find("Particles/Additive"));
|
||||
defaultFireballAMaterial.name = "FireballA-Default";
|
||||
Texture2D tex = Resources.Load("Detonator/Textures/Fireball") as Texture2D;
|
||||
defaultFireballAMaterial.SetColor("_TintColor", Color.white);
|
||||
defaultFireballAMaterial.mainTexture = tex;
|
||||
defaultFireballAMaterial.mainTextureScale = new Vector2(0.5f, 1f);
|
||||
return defaultFireballAMaterial;
|
||||
}
|
||||
|
||||
public static Material DefaultFireballBMaterial()
|
||||
{
|
||||
if (defaultFireballBMaterial != null) return defaultFireballBMaterial;
|
||||
defaultFireballBMaterial = new Material(Shader.Find("Particles/Additive"));
|
||||
defaultFireballBMaterial.name = "FireballB-Default";
|
||||
Texture2D tex = Resources.Load("Detonator/Textures/Fireball") as Texture2D;
|
||||
defaultFireballBMaterial.SetColor("_TintColor", Color.white);
|
||||
defaultFireballBMaterial.mainTexture = tex;
|
||||
defaultFireballBMaterial.mainTextureScale = new Vector2(0.5f, 1f);
|
||||
defaultFireballBMaterial.mainTextureOffset = new Vector2(0.5f, 0f);
|
||||
return defaultFireballBMaterial;
|
||||
}
|
||||
|
||||
public static Material DefaultSmokeAMaterial()
|
||||
{
|
||||
if (defaultSmokeAMaterial != null) return defaultSmokeAMaterial;
|
||||
defaultSmokeAMaterial = new Material(Shader.Find("Particles/Alpha Blended"));
|
||||
defaultSmokeAMaterial.name = "SmokeA-Default";
|
||||
Texture2D tex = Resources.Load("Detonator/Textures/Smoke") as Texture2D;
|
||||
defaultSmokeAMaterial.SetColor("_TintColor", Color.white);
|
||||
defaultSmokeAMaterial.mainTexture = tex;
|
||||
defaultSmokeAMaterial.mainTextureScale = new Vector2(0.5f, 1f);
|
||||
return defaultSmokeAMaterial;
|
||||
}
|
||||
|
||||
public static Material DefaultSmokeBMaterial()
|
||||
{
|
||||
if (defaultSmokeBMaterial != null) return defaultSmokeBMaterial;
|
||||
defaultSmokeBMaterial = new Material(Shader.Find("Particles/Alpha Blended"));
|
||||
defaultSmokeBMaterial.name = "SmokeB-Default";
|
||||
Texture2D tex = Resources.Load("Detonator/Textures/Smoke") as Texture2D;
|
||||
defaultSmokeBMaterial.SetColor("_TintColor", Color.white);
|
||||
defaultSmokeBMaterial.mainTexture = tex;
|
||||
defaultSmokeBMaterial.mainTextureScale = new Vector2(0.5f, 1f);
|
||||
defaultSmokeBMaterial.mainTextureOffset = new Vector2(0.5f, 0f);
|
||||
return defaultSmokeBMaterial;
|
||||
}
|
||||
|
||||
public static Material DefaultSparksMaterial()
|
||||
{
|
||||
if (defaultSparksMaterial != null) return defaultSparksMaterial;
|
||||
defaultSparksMaterial = new Material(Shader.Find("Particles/Additive"));
|
||||
defaultSparksMaterial.name = "Sparks-Default";
|
||||
Texture2D tex = Resources.Load("Detonator/Textures/GlowDot") as Texture2D;
|
||||
defaultSparksMaterial.SetColor("_TintColor", Color.white);
|
||||
defaultSparksMaterial.mainTexture = tex;
|
||||
return defaultSparksMaterial;
|
||||
}
|
||||
|
||||
public static Material DefaultShockwaveMaterial()
|
||||
{
|
||||
if (defaultShockwaveMaterial != null) return defaultShockwaveMaterial;
|
||||
defaultShockwaveMaterial = new Material(Shader.Find("Particles/Additive"));
|
||||
defaultShockwaveMaterial.name = "Shockwave-Default";
|
||||
Texture2D tex = Resources.Load("Detonator/Textures/Shockwave") as Texture2D;
|
||||
defaultShockwaveMaterial.SetColor("_TintColor", new Color(0.1f,0.1f,0.1f,1f));
|
||||
defaultShockwaveMaterial.mainTexture = tex;
|
||||
return defaultShockwaveMaterial;
|
||||
}
|
||||
|
||||
public static Material DefaultGlowMaterial()
|
||||
{
|
||||
if (defaultGlowMaterial != null) return defaultGlowMaterial;
|
||||
defaultGlowMaterial = new Material(Shader.Find("Particles/Additive"));
|
||||
defaultGlowMaterial.name = "Glow-Default";
|
||||
Texture2D tex = Resources.Load("Detonator/Textures/Glow") as Texture2D;
|
||||
defaultGlowMaterial.SetColor("_TintColor", Color.white);
|
||||
defaultGlowMaterial.mainTexture = tex;
|
||||
return defaultGlowMaterial;
|
||||
}
|
||||
|
||||
public static Material DefaultHeatwaveMaterial()
|
||||
{
|
||||
//Unity Pro Only
|
||||
if (SystemInfo.supportsImageEffects)
|
||||
{
|
||||
if (defaultHeatwaveMaterial != null) return defaultHeatwaveMaterial;
|
||||
defaultHeatwaveMaterial = new Material(Shader.Find("HeatDistort"));
|
||||
defaultHeatwaveMaterial.name = "Heatwave-Default";
|
||||
Texture2D tex = Resources.Load("Detonator/Textures/Heatwave") as Texture2D;
|
||||
defaultHeatwaveMaterial.SetTexture("_BumpMap", tex);
|
||||
return defaultHeatwaveMaterial;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b4007f1233a9b74fa9be42583fafba6
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,238 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
/*
|
||||
DetonatorBurstEmitter is an interface for DetonatorComponents to use to create particles
|
||||
|
||||
- Handles common tasks for Detonator... almost every DetonatorComponent uses this for particles
|
||||
- Builds the gameobject with emitter, animator, renderer
|
||||
- Everything incoming is automatically scaled by size, timeScale, color
|
||||
- Enable oneShot functionality
|
||||
|
||||
You probably don't want to use this directly... though you certainly can.
|
||||
*/
|
||||
|
||||
public class DetonatorBurstEmitter : DetonatorComponent
|
||||
{
|
||||
private ParticleEmitter _particleEmitter;
|
||||
private ParticleRenderer _particleRenderer;
|
||||
private ParticleAnimator _particleAnimator;
|
||||
|
||||
private float _baseDamping = 0.1300004f;
|
||||
private float _baseSize = 1f;
|
||||
private Color _baseColor = Color.white;
|
||||
|
||||
public float damping = 1f;
|
||||
public float startRadius = 1f;
|
||||
public float maxScreenSize = 2f;
|
||||
public bool explodeOnAwake = false;
|
||||
public bool oneShot = true;
|
||||
public float sizeVariation = 0f;
|
||||
public float particleSize = 1f;
|
||||
public float count = 1;
|
||||
public float sizeGrow = 20f;
|
||||
public bool exponentialGrowth = true;
|
||||
public float durationVariation = 0f;
|
||||
public bool useWorldSpace = true;
|
||||
public float upwardsBias = 0f;
|
||||
public float angularVelocity = 20f;
|
||||
public bool randomRotation = true;
|
||||
|
||||
public ParticleRenderMode renderMode;
|
||||
|
||||
//TODO make this based on some var
|
||||
/*
|
||||
_sparksRenderer.particleRenderMode = ParticleRenderMode.Stretch;
|
||||
_sparksRenderer.lengthScale = 0f;
|
||||
_sparksRenderer.velocityScale = 0.7f;
|
||||
*/
|
||||
|
||||
public bool useExplicitColorAnimation = false;
|
||||
public Color[] colorAnimation = new Color[5];
|
||||
|
||||
private bool _delayedExplosionStarted = false;
|
||||
private float _explodeDelay;
|
||||
|
||||
public Material material;
|
||||
|
||||
//unused
|
||||
override public void Init()
|
||||
{
|
||||
print ("UNUSED");
|
||||
}
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
_particleEmitter = (gameObject.AddComponent("EllipsoidParticleEmitter")) as ParticleEmitter;
|
||||
_particleRenderer = (gameObject.AddComponent("ParticleRenderer")) as ParticleRenderer;
|
||||
_particleAnimator = (gameObject.AddComponent("ParticleAnimator")) as ParticleAnimator;
|
||||
|
||||
_particleEmitter.hideFlags = HideFlags.HideAndDontSave;
|
||||
_particleRenderer.hideFlags = HideFlags.HideAndDontSave;
|
||||
_particleAnimator.hideFlags = HideFlags.HideAndDontSave;
|
||||
|
||||
_particleAnimator.damping = _baseDamping;
|
||||
|
||||
_particleEmitter.emit = false;
|
||||
_particleRenderer.maxParticleSize = maxScreenSize;
|
||||
_particleRenderer.material = material;
|
||||
_particleRenderer.material.color = Color.white; //workaround for this not being settable elsewhere
|
||||
_particleAnimator.sizeGrow = sizeGrow;
|
||||
|
||||
if (explodeOnAwake)
|
||||
{
|
||||
Explode();
|
||||
}
|
||||
}
|
||||
|
||||
private float _emitTime;
|
||||
private float speed = 3.0f;
|
||||
private float initFraction = 0.1f;
|
||||
static float epsilon = 0.01f;
|
||||
|
||||
void Update ()
|
||||
{
|
||||
//do exponential particle scaling once emitted
|
||||
if (exponentialGrowth)
|
||||
{
|
||||
float elapsed = Time.time - _emitTime;
|
||||
float oldSize = SizeFunction(elapsed - epsilon);
|
||||
float newSize = SizeFunction(elapsed);
|
||||
float growth = ((newSize / oldSize) - 1) / epsilon;
|
||||
_particleAnimator.sizeGrow = growth;
|
||||
}
|
||||
else
|
||||
{
|
||||
_particleAnimator.sizeGrow = sizeGrow;
|
||||
}
|
||||
|
||||
//delayed explosion
|
||||
if (_delayedExplosionStarted)
|
||||
{
|
||||
_explodeDelay = (_explodeDelay - Time.deltaTime);
|
||||
if (_explodeDelay <= 0f)
|
||||
{
|
||||
Explode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private float SizeFunction (float elapsedTime)
|
||||
{
|
||||
float divided = 1 - (1 / (1 + elapsedTime * speed));
|
||||
return initFraction + (1 - initFraction) * divided;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
size = _baseSize;
|
||||
color = _baseColor;
|
||||
damping = _baseDamping;
|
||||
}
|
||||
|
||||
|
||||
private float _tmpParticleSize; //calculated particle size... particleSize * randomized size (by sizeVariation)
|
||||
private Vector3 _tmpPos; //calculated position... randomized inside sphere of incoming radius * size
|
||||
private Vector3 _tmpDir; //calculated velocity - randomized inside sphere - incoming velocity * size
|
||||
private Vector3 _thisPos; //handle on this gameobject's position, set inside
|
||||
private float _tmpDuration; //calculated duration... incoming duration * incoming timescale
|
||||
private float _tmpCount; //calculated count... incoming count * incoming detail
|
||||
private float _scaledDuration; //calculated duration... duration * timescale
|
||||
private float _scaledDurationVariation;
|
||||
private float _scaledStartRadius;
|
||||
private float _scaledColor; //color with alpha adjusted according to detail and duration
|
||||
private float _randomizedRotation;
|
||||
private float _tmpAngularVelocity; //random angular velocity from -angularVelocity to +angularVelocity, if randomRotation is true;
|
||||
|
||||
override public void Explode()
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
_particleEmitter.useWorldSpace = useWorldSpace;
|
||||
|
||||
_scaledDuration = timeScale * duration;
|
||||
_scaledDurationVariation = timeScale * durationVariation;
|
||||
_scaledStartRadius = size * startRadius;
|
||||
|
||||
_particleRenderer.particleRenderMode = renderMode;
|
||||
|
||||
if (!_delayedExplosionStarted)
|
||||
{
|
||||
_explodeDelay = explodeDelayMin + (Random.value * (explodeDelayMax - explodeDelayMin));
|
||||
}
|
||||
if (_explodeDelay <= 0)
|
||||
{
|
||||
Color[] modifiedColors = _particleAnimator.colorAnimation;
|
||||
|
||||
if (useExplicitColorAnimation)
|
||||
{
|
||||
modifiedColors[0] = colorAnimation[0];
|
||||
modifiedColors[1] = colorAnimation[1];
|
||||
modifiedColors[2] = colorAnimation[2];
|
||||
modifiedColors[3] = colorAnimation[3];
|
||||
modifiedColors[4] = colorAnimation[4];
|
||||
}
|
||||
else //auto fade
|
||||
{
|
||||
modifiedColors[0] = new Color(color.r, color.g, color.b, (color.a * .7f));
|
||||
modifiedColors[1] = new Color(color.r, color.g, color.b, (color.a * 1f));
|
||||
modifiedColors[2] = new Color(color.r, color.g, color.b, (color.a * .5f));
|
||||
modifiedColors[3] = new Color(color.r, color.g, color.b, (color.a * .3f));
|
||||
modifiedColors[4] = new Color(color.r, color.g, color.b, (color.a * 0f));
|
||||
}
|
||||
_particleAnimator.colorAnimation = modifiedColors;
|
||||
_particleRenderer.material = material;
|
||||
_particleAnimator.force = force;
|
||||
_tmpCount = count * detail;
|
||||
if (_tmpCount < 1) _tmpCount = 1;
|
||||
|
||||
if (_particleEmitter.useWorldSpace == true)
|
||||
{
|
||||
_thisPos = this.gameObject.transform.position;
|
||||
}
|
||||
else
|
||||
{
|
||||
_thisPos = new Vector3(0,0,0);
|
||||
}
|
||||
|
||||
for (int i = 1; i <= _tmpCount; i++)
|
||||
{
|
||||
_tmpPos = Vector3.Scale(Random.insideUnitSphere, new Vector3(_scaledStartRadius, _scaledStartRadius, _scaledStartRadius));
|
||||
_tmpPos = _thisPos + _tmpPos;
|
||||
|
||||
_tmpDir = Vector3.Scale(Random.insideUnitSphere, new Vector3(velocity.x, velocity.y, velocity.z));
|
||||
_tmpDir.y = (_tmpDir.y + (2 * (Mathf.Abs(_tmpDir.y) * upwardsBias)));
|
||||
|
||||
if (randomRotation == true)
|
||||
{
|
||||
_randomizedRotation = Random.Range(-1f,1f);
|
||||
_tmpAngularVelocity = Random.Range(-1f,1f) * angularVelocity;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_randomizedRotation = 0f;
|
||||
_tmpAngularVelocity = angularVelocity;
|
||||
}
|
||||
|
||||
_tmpDir = Vector3.Scale(_tmpDir, new Vector3(size, size, size));
|
||||
|
||||
_tmpParticleSize = size * (particleSize + (Random.value * sizeVariation));
|
||||
|
||||
_tmpDuration = _scaledDuration + (Random.value * _scaledDurationVariation);
|
||||
_particleEmitter.Emit(_tmpPos, _tmpDir, _tmpParticleSize, _tmpDuration, color, _randomizedRotation, _tmpAngularVelocity);
|
||||
}
|
||||
|
||||
_emitTime = Time.time;
|
||||
_delayedExplosionStarted = false;
|
||||
_explodeDelay = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
//tell update to start reducing the start delay and call explode again when it's zero
|
||||
_delayedExplosionStarted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b739e859c3f20354bbd47c572d0b5aa5
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,100 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
// This one isn't ready for prime time and is not in the menu. Feel free to modify or complete. :)
|
||||
[RequireComponent (typeof (Detonator))]
|
||||
public class DetonatorCloudRing : DetonatorComponent
|
||||
{
|
||||
private float _baseSize = 1f;
|
||||
private float _baseDuration = 5f;
|
||||
private Vector3 _baseVelocity = new Vector3(155f, 5f, 155f);
|
||||
private Color _baseColor = Color.white;
|
||||
private Vector3 _baseForce = new Vector3(0.162f, 2.56f, 0f);
|
||||
|
||||
private GameObject _cloudRing;
|
||||
private DetonatorBurstEmitter _cloudRingEmitter;
|
||||
public Material cloudRingMaterial;
|
||||
|
||||
override public void Init()
|
||||
{
|
||||
//make sure there are materials at all
|
||||
FillMaterials(false);
|
||||
BuildCloudRing();
|
||||
}
|
||||
|
||||
//if materials are empty fill them with defaults
|
||||
public void FillMaterials(bool wipe)
|
||||
{
|
||||
if (!cloudRingMaterial || wipe)
|
||||
{
|
||||
cloudRingMaterial = MyDetonator().smokeBMaterial;
|
||||
}
|
||||
}
|
||||
|
||||
//Build these to look correct at the stock Detonator size of 10m... then let the size parameter
|
||||
//cascade through to the emitters and let them do the scaling work... keep these absolute.
|
||||
public void BuildCloudRing()
|
||||
{
|
||||
_cloudRing = new GameObject("CloudRing");
|
||||
_cloudRingEmitter = (DetonatorBurstEmitter)_cloudRing.AddComponent("DetonatorBurstEmitter");
|
||||
_cloudRing.transform.parent = this.transform;
|
||||
_cloudRing.transform.localPosition = localPosition;
|
||||
_cloudRingEmitter.material = cloudRingMaterial;
|
||||
_cloudRingEmitter.useExplicitColorAnimation = true;
|
||||
}
|
||||
|
||||
public void UpdateCloudRing()
|
||||
{
|
||||
_cloudRing.transform.localPosition = Vector3.Scale(localPosition,(new Vector3(size, size, size)));
|
||||
|
||||
_cloudRingEmitter.color = color;
|
||||
_cloudRingEmitter.duration = duration;
|
||||
_cloudRingEmitter.durationVariation = duration/4f;
|
||||
_cloudRingEmitter.count = (int)(detail * 50f);
|
||||
_cloudRingEmitter.particleSize = 10f;
|
||||
_cloudRingEmitter.sizeVariation = 2f;
|
||||
_cloudRingEmitter.velocity = velocity;
|
||||
_cloudRingEmitter.startRadius = 3f;
|
||||
_cloudRingEmitter.size = size;
|
||||
_cloudRingEmitter.force = force;
|
||||
_cloudRingEmitter.explodeDelayMin = explodeDelayMin;
|
||||
_cloudRingEmitter.explodeDelayMax = explodeDelayMax;
|
||||
|
||||
//make the starting colors more intense, towards white
|
||||
Color color1 = Color.Lerp(color, (new Color(.2f, .2f, .2f, .6f)), 0.5f);
|
||||
Color color2 = new Color(.2f, .2f, .2f, .5f);
|
||||
Color color3 = new Color(.2f, .2f, .2f, .3f);
|
||||
Color color4 = new Color(.2f, .2f, .2f, 0f);
|
||||
|
||||
_cloudRingEmitter.colorAnimation[0] = color1;
|
||||
_cloudRingEmitter.colorAnimation[1] = color2;
|
||||
_cloudRingEmitter.colorAnimation[2] = color2;
|
||||
_cloudRingEmitter.colorAnimation[3] = color3;
|
||||
_cloudRingEmitter.colorAnimation[4] = color4;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
FillMaterials(true);
|
||||
on = true;
|
||||
size = _baseSize;
|
||||
duration = _baseDuration;
|
||||
explodeDelayMin = 0f;
|
||||
explodeDelayMax = 0f;
|
||||
color = _baseColor;
|
||||
velocity = _baseVelocity;
|
||||
force = _baseForce;
|
||||
}
|
||||
|
||||
override public void Explode()
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
UpdateCloudRing();
|
||||
_cloudRingEmitter.Explode();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user