當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。