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 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) { float a = (transform.position - GlobalInfo.playerCamera.transform.position).magnitude; if (a < 100.0f) { // _heatwave = gameObject.AddComponent("DetonatorHeatwave") as DetonatorHeatwave; // _heatwave.Reset(); GameObject go = (GameObject)GameObject.Instantiate(heatHazePref, transform.position, Quaternion.identity); go.transform.parent = transform; } } components = this.GetComponents(typeof(DetonatorComponent)); }
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(); //Apply the force here because it's easier than figuring out how many explosions happen Vector3 _explosionPosition = transform.position; //- Vector3.Normalize(MyDetonator().direction); Collider[] _colliders = Physics.OverlapSphere (_explosionPosition, size/2); foreach (Collider hit in _colliders) { if (!hit) { continue; } hit.gameObject.SendMessage("LoseLife", 1, SendMessageOptions.DontRequireReceiver); } } if (!_heatwave && autoCreateHeatwave && SystemInfo.supportsImageEffects) { _heatwave = gameObject.AddComponent("DetonatorHeatwave") as DetonatorHeatwave; _heatwave.Reset(); } components = this.GetComponents(typeof(DetonatorComponent)); }
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 Awake() //S'utilitza per inicialitzar variables o parametres abans de que s'inici el joc { FillDefaultMaterials(); components = this.GetComponents(typeof(DetonatorComponent)); //Comprova el component de la detonacio foreach (DetonatorComponent dc in components) //Aconsegueix els components de la detonacio { if (dc is DetonatorFireball) //Comprovacio dels component que pot tenir { _fireball = dc as DetonatorFireball; } if (dc is DetonatorSparks) //Comprovacio dels component que pot tenir { _sparks = dc as DetonatorSparks; } if (dc is DetonatorShockwave) //Comprovacio dels component que pot tenir { _shockwave = dc as DetonatorShockwave; } if (dc is DetonatorSmoke) //Comprovacio dels component que pot tenir { _smoke = dc as DetonatorSmoke; } if (dc is DetonatorGlow) //Comprovacio dels component que pot tenir { _glow = dc as DetonatorGlow; } if (dc is DetonatorLight) //Comprovacio dels component que pot tenir { _light = dc as DetonatorLight; } if (dc is DetonatorForce) //Comprovacio dels component que pot tenir { _force = dc as DetonatorForce; } if (dc is DetonatorHeatwave) //Comprovacio dels component que pot tenir { _heatwave = dc as DetonatorHeatwave; } } if (!_fireball && autoCreateFireball) //En cas de no tenir fireball i tenir una opcio per defecte { //Deprecated _fireball = gameObject.AddComponent("DetonatorFireball") as DetonatorFireball; _fireball = gameObject.AddComponent <DetonatorFireball> () as DetonatorFireball; _fireball.Reset(); } if (!_smoke && autoCreateSmoke) //En cas de no tenir smoke i tenir una opcio per defecte { _smoke = gameObject.AddComponent <DetonatorSmoke>() as DetonatorSmoke; _smoke.Reset(); } if (!_sparks && autoCreateSparks) //En cas de no tenir sparks i tenir una opcio per defecte activada { _sparks = gameObject.AddComponent <DetonatorSparks>() as DetonatorSparks; _sparks.Reset(); } if (!_shockwave && autoCreateShockwave) //En cas de no tenir shockwave i tenir una opcio per defecte activada { _shockwave = gameObject.AddComponent <DetonatorShockwave>() as DetonatorShockwave; _shockwave.Reset(); } if (!_glow && autoCreateGlow) //En cas de no tenir glow i tenir una opcio per defecte activada { _glow = gameObject.AddComponent <DetonatorGlow>() as DetonatorGlow; _glow.Reset(); } if (!_light && autoCreateLight) //En cas de no tenir light i tenir un per defecte activada { _light = gameObject.AddComponent <DetonatorLight>() as DetonatorLight; _light.Reset(); } if (!_force && autoCreateForce) //En cas de no tenir force i tenir una opcio per defecte activada { _force = gameObject.AddComponent <DetonatorForce>() as DetonatorForce; _force.Reset(); } if (!_heatwave && autoCreateHeatwave && SystemInfo.supportsImageEffects) //En cas de no tenir heatwave i tenir una opcio per defecte activada { _heatwave = gameObject.AddComponent <DetonatorHeatwave>() as DetonatorHeatwave; _heatwave.Reset(); } components = this.GetComponents(typeof(DetonatorComponent)); }