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


C# ParticleSystem.Emit方法代码示例

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


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

示例1: Start

    void Start()
    {
        particleSystem = gameObject.GetComponent<ParticleSystem>();

        const int maxParticle = 1000;
        particleSystem.maxParticles = maxParticle;
        particles = new ParticleSystem.Particle[maxParticle];
        particleData = new ParticleData[maxParticle];
        particleSystem.Emit(maxParticle);
        particleSystem.GetParticles(particles);

        for (int i = 0; i < maxParticle; i++)
        {
            particles[i].position = Vector3.zero;
            particles[i].velocity = Vector3.zero;
            particles[i].size = 0.1f;

            float rotateX = Random.value * 360;
            float rotateY = Random.value * 180;
            float rotateZ = Random.value * 360;

            Quaternion q = new Quaternion();
            q.eulerAngles = new Vector3(rotateX, rotateY, rotateZ);
            particleData[i].direction = q * Vector3.forward;
            particleData[i].speed = 1;
            particleData[i].cos = i / ((float)maxParticle / 10);
        }

        particleSystem.SetParticles(particles, maxParticle);
    }
开发者ID:Kuvo,项目名称:Primary,代码行数:30,代码来源:Particle.cs

示例2: Start

	// Use this for initialization
	void Start () {
		rend = GetComponent<SpriteRenderer>();
		jumpParticle = GetComponent<ParticleSystem>();
		startCol = rend.material.color;
		fadeCol = new Color(startCol.r, startCol.g, startCol.b, 0);
		jumpParticle.Emit(6);
	}
开发者ID:technicalvgda,项目名称:Adagio,代码行数:8,代码来源:FadeAway.cs

示例3: shoot

        public void shoot(bool _fire, ParticleSystem _projectile)
        {
            rotate(gattlingGunData.warmupDelay);

            if (_fire)
            {
                if (gattlingGunData.warmupDelay < gattlingGunData.warmState)
                {
                    gattlingGunData.warmupDelay++;
                    return;
                }
                gattlingGunData.currentShotDelay--;
                if (gattlingGunData.currentShotDelay <= 0)
                {
                    _projectile.Emit(1);
                    gattlingGunData.currentShotDelay = gattlingGunData.shotDelayMax;
                }
            }
            else
            {
                if (gattlingGunData.warmupDelay > gattlingGunData.coldState)
                {
                    gattlingGunData.warmupDelay--;
                }
            }
        }
开发者ID:georgevasilchenko,项目名称:RaceGame,代码行数:26,代码来源:GattlingGun.cs

示例4: SpawnConnection

    private void SpawnConnection(JumpConnection connection, ParticleSystem PS)
    {
        Vector3 startPos = galaxy.Systems[connection.StartID].Position;
        Vector3 endPos = galaxy.Systems[connection.EndID].Position;

        for (int i = 0; i < lineParticleCount; i++)
            PS.Emit(Vector3.Lerp(startPos * scale + transform.position, endPos * scale + transform.position, (float)((float)(i + 1f) / (float)(lineParticleCount + 1f))), Vector3.zero, particleSize * 0.33f, float.MaxValue, Color.white);
    }
开发者ID:TheAsuro,项目名称:NEVR,代码行数:8,代码来源:GalaxyRenderer.cs

示例5: play

	void play(ParticleSystem ps, ParticleInfos pi){
		//ps.duration = pi.duration / music.tempo * 60;
		ps.Stop ();
		ps.startSize = pi.size;
		ps.startSpeed = pi.speed;
		if(pi.quantity > 0)
			ps.Emit (pi.quantity);
		ps.emissionRate = pi.timeQuantity;
		ps.Play ();
	}
开发者ID:Stending,项目名称:SOS,代码行数:10,代码来源:ParticlesManager.cs

示例6: Awake

 // Use this for initialization
 void Awake()
 {
     TimeStart = Time.time;
     MyParticles = gameObject.GetComponent<ParticleSystem> ();
     MyParticles.startLifetime = Random.Range (3f,10f);
     MyParticles.loop = false;
     MyParticles.Emit(InitialEmmision/5);
     MyParticles.enableEmission = true;
     Destroy (gameObject, TimeTotal);
 }
开发者ID:abittman,项目名称:15T3GamesStudio2,代码行数:11,代码来源:ParticlesEmmisionOverLifetime.cs

示例7: Awake

    // Use this for initialization
    void Awake()
    {
        particles = GetComponentInChildren<ParticleSystem>();

        for (int i=0; i<nrOfDustParticles; i++){
            particles.startSize = Random.Range (1, maxSize)/(maxSize*2.5f);
            particles.startSpeed = Random.Range (1,maxSpeed);
            particles.Emit(1);
        }
    }
开发者ID:GuBaDa,项目名称:SuperGreatGame,代码行数:11,代码来源:DustScript.cs

示例8: 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

示例9: 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

示例10: Emit

 private void Emit(ParticleSystem p, ref Vector3 pos)
 {
     int count = UnityEngine.Random.Range(2, 5);
     while (count != 0)
     {
         float yVelocity = UnityEngine.Random.Range(1.0f, 3.0f);
         float zVelocity = UnityEngine.Random.Range(-2.0f, 2.0f);
         float xVelocity = UnityEngine.Random.Range(-2.0f, 2.0f);
         const float lifetime = 0.75f;// UnityEngine.Random.Range(0.25f, 0.75f);
         float size = UnityEngine.Random.Range(0.05f, 0.1f);
         p.Emit(pos, new Vector3(xVelocity, yVelocity, zVelocity), size, lifetime, color);
         count--;
     }
 }
开发者ID:katewatkinz,项目名称:mhs-mountain-rise,代码行数:14,代码来源:RainCollision.cs

示例11: Start

    void Start()
    {
        mf = GetComponent<SkinnedMeshRenderer>();
        ps = GetComponent<ParticleSystem> ();
        origVerts = mf.sharedMesh.vertices;

        int i = 0;
        while (i < origVerts.Length) {
            ps.Emit(origVerts[i], Vector3.zero, size, float.PositiveInfinity, Color.white);
            i++;
        }

        particles = new ParticleSystem.Particle[ps.particleCount];
        ps.GetParticles (particles);
    }
开发者ID:Rokerekor,项目名称:Koi,代码行数:15,代码来源:drawSkinnedVerts.cs

示例12: Start

    void Start()
    {
        mf = GetComponent<MeshFilter>();
        ps = GetComponent<ParticleSystem> ();
        scale = this.transform.localScale;
        origVerts = mf.sharedMesh.vertices;
        newVerts = new Vector3[origVerts.Length];

        int i = 0;
        while (i < origVerts.Length) {
            ps.Emit(origVerts[i], Vector3.zero, 1f, float.PositiveInfinity, Color.white);
            i++;
        }

        particles = new ParticleSystem.Particle[ps.particleCount];
        ps.GetParticles (particles);
    }
开发者ID:Rokerekor,项目名称:Koi,代码行数:17,代码来源:drawVerts.cs

示例13: Update

	// Update is called once per frame
	void Update ()
	{
	
		if (Input.GetKey (KeyCode.Joystick1Button2) && DoublePush == false) {
			emitter = GetComponent<ParticleSystem> ();
			
			// Emit one particle at the origin, shooting straight up.
			// The size of the particle is 0.2 and it will live 2 seconds long.
			emitter.Emit (new Vector3 (0, 0, 0), new Vector3 (0, 0, 0), 1, 0.3f, new Color (0.647f, 0.870f, 0.894f));
		}
		if (Input.GetKey (KeyCode.Joystick1Button0) && DoublePush == false) {
			emitter = GetComponent<ParticleSystem> ();
			
			// Emit one particle at the origin, shooting straight up.
			// The size of the particle is 0.2 and it will live 2 seconds long.
			emitter.Emit (new Vector3 (0, 0, 0), new Vector3 (0, 0, 0), 1, 0.3f, new Color (0.709f, 0.792f, 0.627f));
		}
		if (Input.GetKey (KeyCode.Joystick1Button2) && Input.GetKey (KeyCode.Joystick1Button0)) {
			DoublePush = true;
			emitter = GetComponent<ParticleSystem> ();
			
			// Emit one particle at the origin, shooting straight up.
			// The size of the particle is 0.2 and it will live 2 seconds long.
			emitter.Emit (new Vector3 (0, 0, 0), new Vector3 (0, 0, 0), 1, 0.3f, new Color (0.400f, 0.729f, 0.717f));
		}
		if (Input.GetKeyUp (KeyCode.Joystick1Button0) || Input.GetKeyUp (KeyCode.Joystick1Button2)) {
			DoublePush = false;
		}
		if (Input.GetAxis ("360_Triggers") < -0.9) {
			emitter = GetComponent<ParticleSystem> ();
			
			// Emit one particle at the origin, shooting straight up.
			// The size of the particle is 0.2 and it will live 2 seconds long.
			emitter.Emit (new Vector3 (0, 0, 0), new Vector3 (0, 0, 0), 1, 0.3f, new Color (0.980f, 0.839f, 0.537f));
		}
		if (Input.GetAxis ("360_Triggers") > 0.9 && PlayerInputPower.Trigger == false) {
			emitter = GetComponent<ParticleSystem> ();
			
			// Emit one particle at the origin, shooting straight up.
			// The size of the particle is 0.2 and it will live 2 seconds long.
			emitter.Emit (new Vector3 (0, 0, 0), new Vector3 (0, 0, 0), 1, 0.3f, new Color (0.956f, 0.654f, 0.725f));
		}

	}
开发者ID:esther5576,项目名称:SW-game-project,代码行数:45,代码来源:SoundOutputVisual.cs

示例14: Emit

 private void Emit(ParticleSystem p, ref Vector3 pos)
 {
     int count = UnityEngine.Random.Range(2, 5);
     while (count != 0)
     {
         float yVelocity = UnityEngine.Random.Range(1.0f, 3.0f);
         float zVelocity = UnityEngine.Random.Range(-2.0f, 2.0f);
         float xVelocity = UnityEngine.Random.Range(-2.0f, 2.0f);
         const float lifetime = 0.75f;// UnityEngine.Random.Range(0.25f, 0.75f);
         float size = UnityEngine.Random.Range(0.05f, 0.1f);
         ParticleSystem.EmitParams param = new ParticleSystem.EmitParams();
         param.position = pos;
         param.velocity = new Vector3(xVelocity, yVelocity, zVelocity);
         param.startLifetime = lifetime;
         param.startSize = size;
         param.startColor = color;
         p.Emit(param, 1);
         count--;
     }
 }
开发者ID:BoolClub,项目名称:ProjectCrusade,代码行数:20,代码来源:RainCollision.cs

示例15: Start

    void Start()
    {
        if(targetPrefab)
        {
            target = Instantiate(targetPrefab);
            target.transform.parent = gameObject.transform;
            target.transform.localPosition = new Vector3(0,0,0);
            rends = target.GetComponentsInChildren<FadeAway>();
            targetScale = target.transform.localScale;
        }
        if(autoColors)
        {
            colors = GlobalData.godColors;
        }
        particles = new ParticleSystem.Particle[10 * countInOrbit];
        system = GetComponent<ParticleSystem>();
        system.Emit(10 * countInOrbit);
        time = 0;
        beat = GlobalData.beat * 2.0f;
        seed = 0.123f;//Random.Range(0.0f,1.0f);
        scale *= 0.4444f;

        float size = Camera.main.orthographicSize;
        float height = size;
        float width = size * Camera.main.aspect;
        if (rightBottom)
        {
            position = new Vector2(width - screenPosition.x, -height + screenPosition.y);
        }
        else
        {
            position = new Vector2(-width + screenPosition.x, height - screenPosition.y);
        }
        if(worldPos)
        {
            position = screenPosition;
        }
    }
开发者ID:jivanecky,项目名称:PartyGodsApple,代码行数:38,代码来源:CustomMenuPaticles.cs


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