当前位置: 首页>>代码示例>>C#>>正文


C# ParticleSystem.GetComponent方法代码示例

本文整理汇总了C#中ParticleSystem.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# ParticleSystem.GetComponent方法的具体用法?C# ParticleSystem.GetComponent怎么用?C# ParticleSystem.GetComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ParticleSystem的用法示例。


在下文中一共展示了ParticleSystem.GetComponent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

 /// <summary>
 /// Initialises the script
 /// </summary>
 void Start()
 {
     m_particles = GetComponent<ParticleSystem> ();
     m_particles.GetComponent<Renderer>().sortingLayerName = "World";
     m_particles.GetComponent<Renderer>().sortingOrder = 4;
     m_rigidBody = transform.parent.GetComponent<Rigidbody>();
 }
开发者ID:ActionAtSea,项目名称:action-at-sea,代码行数:10,代码来源:ParticleSpray.cs

示例2: Start

    void Start()
    {
        ps = GetComponent<ParticleSystem>();
        ps.GetComponent<Renderer>().sortingLayerName = sortingLayer;
        ps.GetComponent<Renderer>().sortingOrder = sortingOrder;
        if (killAfterLifetime) StartCoroutine("Kill");

        if (transform.parent == null)
            transform.parent = GameObject.Find("Slots").transform;
    }
开发者ID:amisiak7,项目名称:jewels2,代码行数:10,代码来源:ParticleEffect.cs

示例3: Awake

    private void Awake()
    {
        m_ExplosionParticles = Instantiate(m_ExplosionPrefab).GetComponent<ParticleSystem>();
        m_ExplosionAudio = m_ExplosionParticles.GetComponent<AudioSource>();

        m_ExplosionParticles.gameObject.SetActive(false); //Always better to keep particle systems in memory and work with them so the GC does not kick in and there are no spikes in performance
    }
开发者ID:rnabeth,项目名称:tanks,代码行数:7,代码来源:TankHealth.cs

示例4: Awake

    private void Awake()
    {
        m_ExplosionParticles = Instantiate(m_ExplosionPrefab).GetComponent<ParticleSystem>();
        m_ExplosionAudio = m_ExplosionParticles.GetComponent<AudioSource>();

        m_ExplosionParticles.gameObject.SetActive(false);
    }
开发者ID:adityasan92,项目名称:TankFightGame,代码行数:7,代码来源:TankHealth.cs

示例5: SetParticleSystemScale

	static public void SetParticleSystemScale(ParticleSystem particleSystem, float scale)
	{
		particleSystem.startLifetime *= scale;
		particleSystem.startSize *= scale;

		if (particleSystem.GetComponent<ParticleEmitter>() != null)
		{
			particleSystem.GetComponent<ParticleEmitter>().minSize *= scale;
			particleSystem.GetComponent<ParticleEmitter>().maxSize *= scale;
		}

		if (particleSystem.GetComponent<ConstantForce>() != null)
		{
			particleSystem.GetComponent<ConstantForce>().force *= scale;
		}
	}
开发者ID:zhaoqingqing,项目名称:Unity_Utlity_Scripts,代码行数:16,代码来源:UnityHelper.cs

示例6: Initialize

		protected bool Initialize() {
			// initialize members
			if (_transform == null) {
				_transform = transform;
			}
			if (_particleSystem == null) {
				_particleSystem = GetComponent<ParticleSystem>();
	 
				if (_particleSystem == null) {
					return false;
				}
	 
				// automatically set material to UI/Particles/Hidden shader, and get previous texture
				ParticleSystemRenderer renderer = _particleSystem.GetComponent<ParticleSystemRenderer>();
				if (renderer == null) {
					renderer = _particleSystem.gameObject.AddComponent<ParticleSystemRenderer>();
				}
				Material currentMaterial = renderer.sharedMaterial;
				if (currentMaterial && currentMaterial.HasProperty("_MainTex")) {
					particleTexture = currentMaterial.mainTexture;
				}
				Material material = new Material(Shader.Find("UI/Particles/Hidden")); // TODO - You should create this discard shader
				if (Application.isPlaying) {
					renderer.material = material;
				}
#if UNITY_EDITOR
				else {
					material.hideFlags = HideFlags.DontSave;
					renderer.sharedMaterial = material;
				}
#endif
	 
				// automatically set scaling
				_particleSystem.scalingMode = ParticleSystemScalingMode.Hierarchy;
	 
				_particles = null;
			}
			if (_particles == null) {
				_particles = new ParticleSystem.Particle[_particleSystem.maxParticles];
			}
	 
			// prepare uvs
			if (particleTexture) {
				_uv = new Vector4(0, 0, 1, 1);
			} else if (particleSprite) {
				_uv = UnityEngine.Sprites.DataUtility.GetOuterUV(particleSprite);
			}
	 
			// prepare texture sheet animation
			_textureSheetAnimation = _particleSystem.textureSheetAnimation;
			_textureSheetAnimationFrames = 0;
			_textureSheedAnimationFrameSize = Vector2.zero;
			if (_textureSheetAnimation.enabled) {
				_textureSheetAnimationFrames = _textureSheetAnimation.numTilesX * _textureSheetAnimation.numTilesY;
				_textureSheedAnimationFrameSize = new Vector2(1f / _textureSheetAnimation.numTilesX, 1f / _textureSheetAnimation.numTilesY);
			}
	 
			return true;
		}
开发者ID:Badeye,项目名称:impulse,代码行数:59,代码来源:UIParticleSystem.cs

示例7: DriverSetup

 // Use this for initialization
 public override void DriverSetup()
 {
     _mngSystem = gobSystemManager.GetComponent<ParticleManager>();
     sysMySys = gameObject.GetComponent<ParticleSystem>() as ParticleSystem;
     _mngSystem.RegisterSystem(sysMySys, this);
     renSystemRenderer = sysMySys.GetComponent<Renderer>() as Renderer;
     AdditionalSetup();
 }
开发者ID:thomasslee97,项目名称:musicvisualizer,代码行数:9,代码来源:ParticleDriver.cs

示例8: Start

 void Start()
 {
     go_Water = GameObject.Find ("GO_Water");
     MPI_LMScript = GameObject.Find ("MPI_Level_Manager").GetComponent<MPI_Level_Manager>();
     KrakenScript = GameObject.FindGameObjectWithTag ("Kraken").GetComponent<TL_KrakenScript>();
     Water_Particles = GetComponentInChildren<ParticleSystem>();
     Water_Particles.GetComponent<ParticleSystem>().Play();
     fl_AttackCooldown = 2f + Time.realtimeSinceStartup;
 }
开发者ID:uel-1110542,项目名称:Lunar-Odyssey-Sourcecode,代码行数:9,代码来源:TL_TentacleThrust.cs

示例9: Init

    public void Init(Vector3 pos, int maxParticles, Color color)
    {
        transform.localPosition = pos + Vector3.up * 0.25f;

        particles = GetComponent<ParticleSystem>();
        particles.GetComponent<Renderer>().sortingLayerName = "Ui";
        particles.startColor = color;
        particles.Emit(maxParticles);
        Destroy(gameObject, 1f);
    }
开发者ID:snaptothegrid,项目名称:Tiler,代码行数:10,代码来源:Blood.cs

示例10: Init

    public void Init(Vector3 startPos, Vector3 endPos, float duration, int maxParticles, Color color)
    {
        startPos += Vector3.up * 0.25f;

        particles = GetComponent<ParticleSystem>();
        particles.GetComponent<Renderer>().sortingLayerName = "Ui";
        particles.startColor = color;
        particles.Emit(maxParticles);

        StartCoroutine(Move(startPos, endPos, duration));
    }
开发者ID:snaptothegrid,项目名称:Tiler,代码行数:11,代码来源:Bullet.cs

示例11: StartShooting

    public void StartShooting(Transform targetPos = null)
    {
        isShooting = true;

        GameObject muzzleFlashObject = (GameObject.Instantiate(muzzleFlashPrefab, muzzleFlashPlacement.transform.position, muzzleFlashPrefab.transform.rotation) as GameObject);
        muzzleFlashObject.transform.parent = muzzleFlashPlacement.transform;
        muzzleFlash = muzzleFlashObject.GetComponent<ParticleSystem>();

        if (muzzleFlash != null)
            muzzleFlash.GetComponent<ParticleSystem>().Play();
    }
开发者ID:timKofoed,项目名称:MatchShooter,代码行数:11,代码来源:GunLMG.cs

示例12: initializeRest

  override protected void initializeRest() {
    jpm = (JetpackManager) objectsManager;
    canBeMagnetized = false;

    booster = transform.Find("Booster").GetComponent<ParticleSystem>();
    boosterSound = booster.GetComponent<AudioSource>();

    minBoosterSpeed = jpm.minBoosterAmount;
    maxBoosterSpeed = jpm.maxBoosterAmonut;
    decreaseBase = jpm.boosterSpeedDecreaseBase;
    decreasePerTime = jpm.boosterSpeedDecreasePerTime;
    delay = jpm.delayAfterMove;
  }
开发者ID:spilist,项目名称:shoong,代码行数:13,代码来源:JetpackMover.cs

示例13: Start

	// Use this for initialization
	void Start () {
       
        particles = GetComponent<ParticleSystem>();
        mat = particles.GetComponent<Renderer>().material;
        if (combos > 1)
            mat.mainTexture = combo_textures[combos-2];
        else
        {
            int i = (Mathf.FloorToInt(Random.value * 10))%3;
            mat.mainTexture = cheering[i];
        }
        Destroy(gameObject, 1f);
    }
开发者ID:MilindNilekani,项目名称:Athena,代码行数:14,代码来源:feed_back.cs

示例14: Awake

	void Awake ()
	{
		particle = gameObject.GetComponent<ParticleSystem>();
		if(particle != null)
			particle.GetComponent<Renderer>().sharedMaterial.renderQueue = RenderQStartNum;

		if( particle == null )
		{
			ParticleRenderer renderer = gameObject.GetComponent<ParticleRenderer>();
			if( renderer != null )
				renderer.sharedMaterial.renderQueue = RenderQStartNum;
		}
	}
开发者ID:ivanchan2,项目名称:SRW_Project,代码行数:13,代码来源:ParticleQueue.cs

示例15: destroyStuff

    public void destroyStuff()
    {
        myExplosion = (ParticleSystem) GameObject.Instantiate((Object)explosion);
        myExplosion.name = "destroyedPart";
        myExplosion.transform.position   = transform.position;
        myExplosion.GetComponent<HandleExplosion>().startUp();
        startedPlaying= true;

        Destroy (redPartHealthBar);
        Destroy (greenPartHealthBar);
        Destroy (blackPartHealthBar);
        Destroy (triggerArea);
        Destroy (gameObject);
        //Destroy (myExplosion);
    }
开发者ID:saphiresword,项目名称:PlanetaryDefense,代码行数:15,代码来源:HandleRock.cs


注:本文中的ParticleSystem.GetComponent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。