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));
}