本文整理汇总了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);
}
示例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);
}
示例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--;
}
}
}
示例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);
}
示例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 ();
}
示例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);
}
示例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);
}
}
示例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);
}
示例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));
}
示例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--;
}
}
示例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);
}
示例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);
}
示例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));
}
}
示例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--;
}
}
示例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;
}
}