コード例 #1
0
ファイル: Detonator.cs プロジェクト: OlegSmelov/old-projects
	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));
	}
コード例 #2
0
    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));
    }
コード例 #3
0
    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));
    }
コード例 #4
0
 private void Awake()
 {
     this.FillDefaultMaterials();
     this.components = base.GetComponents(typeof(DetonatorComponent));
     Component[] array = this.components;
     for (int i = 0; i < array.Length; i++)
     {
         DetonatorComponent detonatorComponent = (DetonatorComponent)array[i];
         if (detonatorComponent is DetonatorFireball)
         {
             this._fireball = (detonatorComponent as DetonatorFireball);
         }
         if (detonatorComponent is DetonatorSparks)
         {
             this._sparks = (detonatorComponent as DetonatorSparks);
         }
         if (detonatorComponent is DetonatorShockwave)
         {
             this._shockwave = (detonatorComponent as DetonatorShockwave);
         }
         if (detonatorComponent is DetonatorSmoke)
         {
             this._smoke = (detonatorComponent as DetonatorSmoke);
         }
         if (detonatorComponent is DetonatorGlow)
         {
             this._glow = (detonatorComponent as DetonatorGlow);
         }
         if (detonatorComponent is DetonatorLight)
         {
             this._light = (detonatorComponent as DetonatorLight);
         }
         if (detonatorComponent is DetonatorForce)
         {
             this._force = (detonatorComponent as DetonatorForce);
         }
         if (detonatorComponent is DetonatorHeatwave)
         {
             this._heatwave = (detonatorComponent as DetonatorHeatwave);
         }
     }
     if (!this._fireball && this.autoCreateFireball)
     {
         this._fireball = (base.get_gameObject().AddComponent("DetonatorFireball") as DetonatorFireball);
         this._fireball.Reset();
     }
     if (!this._smoke && this.autoCreateSmoke)
     {
         this._smoke = (base.get_gameObject().AddComponent("DetonatorSmoke") as DetonatorSmoke);
         this._smoke.Reset();
     }
     if (!this._sparks && this.autoCreateSparks)
     {
         this._sparks = (base.get_gameObject().AddComponent("DetonatorSparks") as DetonatorSparks);
         this._sparks.Reset();
     }
     if (!this._shockwave && this.autoCreateShockwave)
     {
         this._shockwave = (base.get_gameObject().AddComponent("DetonatorShockwave") as DetonatorShockwave);
         this._shockwave.Reset();
     }
     if (!this._glow && this.autoCreateGlow)
     {
         this._glow = (base.get_gameObject().AddComponent("DetonatorGlow") as DetonatorGlow);
         this._glow.Reset();
     }
     if (!this._light && this.autoCreateLight)
     {
         this._light = (base.get_gameObject().AddComponent("DetonatorLight") as DetonatorLight);
         this._light.Reset();
     }
     if (!this._force && this.autoCreateForce)
     {
         this._force = (base.get_gameObject().AddComponent("DetonatorForce") as DetonatorForce);
         this._force.Reset();
     }
     if (!this._heatwave && this.autoCreateHeatwave && SystemInfo.get_supportsImageEffects())
     {
         this._heatwave = (base.get_gameObject().AddComponent("DetonatorHeatwave") as DetonatorHeatwave);
         this._heatwave.Reset();
     }
     this.components = base.GetComponents(typeof(DetonatorComponent));
 }
コード例 #5
0
ファイル: Detonator.cs プロジェクト: ulyssesp/OneArmedBandit
    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));
    }
コード例 #6
0
    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));
    }