wiki.sine.space | sinespace

Scripting/SParticleSystem

From wiki.sine.space
Revision as of 09:20, 12 June 2021 by Voidtech (Talk | contribs)

Jump to: navigation, search

Members

Clear

void Clear ();

Remove all particles in the Particle System.

This method also removes the particles from any linked sub-emitters. Use the withChildren parameter to remove particles from child Particle Systems that are not sub-emitters of the system.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--remove all particles, parameter you passed to decide whether clear children as well.

particles.Clear(true)


Clear

void Clear (bool withChildren);

Remove all particles in the Particle System.

This method also removes the particles from any linked sub-emitters. Use the withChildren parameter to remove particles from child Particle Systems that are not sub-emitters of the system.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--remove all particles, parameter you passed to decide whether clear children as well.

particles.Clear(true)


Emit

void Emit (int count);

Emit 'count' particles immediately.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--set max particles to 100 and emit 20 particles.
particles.MaxParticles = 100

particles.Emit(20)


IsAlive

bool IsAlive (bool withChildren);

Returns True if the Particle System contains live particles or is still creating new particles. False if the Particle System has stopped emitting particles and all particles are dead. Parameter withChildren: checks all child Particle Systems as well.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--output whether particle system contains live particles or active to procedure particles.

Space.Log(particles.IsAlive(true))



Pause

void Pause ();

Pauses the system so no new particles are emitted and the existing particles are not updated.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--pause particle system, parameter you passed to decide whether pause children as well.

particles.Pause(true)


Pause

void Pause (bool withChildren);

Pauses the system so no new particles are emitted and the existing particles are not updated. Parameter: withChildren: Pauses all child Particle Systems as well.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--pause particle system, parameter you passed to decide whether pause children as well.

particles.Pause(true)


Play

void Play ();

Sets the Particle Systems into play mode and enables emitting (if it has been disabled).

If the Particle System has been paused, then this resumes playing from the previous time. If the Particle System has stopped, then the system starts from time 0, and, if it is relevant, the startDelay is applied.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--start particle system to play, you can give a bool parameter to decide whether play children as well.

particles.Play(true)


Play

void Play (withChildren);

Sets the Particle Systems into play mode and enables emitting (if it has been disabled).

If the Particle System has been paused, then this resumes playing from the previous time. If the Particle System has stopped, then the system starts from time 0, and, if it is relevant, the startDelay is applied. Parameter withChildren: Plays all child Particle Systems as well.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--start particle system to play, you can give a bool parameter to decide whether play children as well.

particles.Play(true)


Simulate

void Simulate (float time);

Fast-forwards the Particle System by simulating particles over 'time' seconds, then pauses it.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--similate to 3 seconds and pause.

particles.Simulate(3)


Stop

void Stop ();

Stops playing the Particle System.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--stop particle system, you can give a bool parameter to decide whether stop children as well.

particles.Stop(true)


Stop

void Stop (bool withChildren);

Stops playing the Particle System. Parameter withChildren: Plays all child Particle Systems as well.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--stop particle system, you can give a bool parameter to decide whether stop children as well.

particles.Stop(true)



GetTriggerParticles

[[Scripting/SParticle[]|SParticle[]]] GetTriggerParticles (SParticleSystemTriggerEventType type)

Get the particles that met the condition in the particle trigger module. his method is typically called from MonoBehaviour.OnParticleTrigger in response to a trigger callback. type - Type of trigger to return particles for.

ParticlesArray = Space.Host.ExecutingObject.ParticleSystem.GetTriggerParticles(0)



SetTriggerParticles

void SetTriggerParticles (SParticleSystemTriggerEventType type, SParticle[] sp)

Write modified particles back to the Particle System, during a call to OnParticleTrigger. type - Type of trigger to return particles for. sp -- Particle array


Space.Host.ExecutingObject.ParticleSystem.SetTriggerParticles(0,ParticlesArray)




Properties

Duration

float Duration { get; }

The duration of the Particle System in seconds.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--subscribe to update, to output duration per frame.
function OutputDuration()
    Space.Log(particles.Duration)
end
spawningparticles.SubscribeToEvents()
spawningparticles.OnUpdate(OutputDuration)

particles.Play()


EmissionRate

float EmissionRate { get;set; }

The rate of particle emission.

 Space.Host.ExecutingObject.ParticleSystem.EmissionRate = 10 



EmissionRateOverDistance

float EmissionRateOverDistance { get;set; }

The rate at which the emitter spawns new particles over distance. The emitter only spawns new particles when it moves.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--set emission rate overtime to 10.

particles.EmissionRateOverDistance = 10


EmissionRateOverTime

float EmissionRateOverTime { get;set; }

The rate at which the emitter spawns new particles over time.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--set emission rate overtime to 10.

particles.EmissionRateOverTime = 10


EnableEmission

bool EnableEmission { get;set; }

When set to false, the Particle System will not emit particles.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--disable emission.

particles.EnableEmission = false


GravityModifier

float GravityModifier { get;set }

A scale that this Particle System applies to gravity.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--set gravity modifier to 1, as normal gravity.

particles.GravityModifier = 1


IsEmitting

bool IsEmitting { get; }

Determines whether the Particle System is emitting particles. A Particle System may stop emitting when its emission module has finished, it has been paused or if the system has been stopped.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--stop particle system and output emitting status.
particles.Pause(true)

Space.Log(particles.IsEmitting)


IsPaused

bool IsPaused { get; }

Determines whether the Particle System is paused.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--pause particles and output particle is paused status.
particles.Pause(true)

Space.Log(particles.IsPaused)


IsPlaying

bool IsPlaying { get; }

Determines whether the Particle System is playing.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--output is playing status.

Space.Log(particles.IsPlaying)


IsStopped

bool IsStopped { get; }

Determines whether the Particle System is stopped.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--stop particles and output particle is stopped status.
particles.Stop(true)

Space.Log(particles.IsStopped)


Loop

bool Loop { get;set; }

Specifies whether the Particle System is looping. If you disable looping on a playing Particle System, it stops at the end of the current loop.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--set particle system looping to false.

particles.Loop = false


MaxParticles

int MaxParticles { get;set; }

The maximum number of particles to emit.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--set max particles to 100.

particles.MaxParticles = 100


ParticleCount

int ParticleCount { get; }

The current number of particles.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--set a coroutine to check out particle count per period.
local function ToCheckParticleCount()
    coroutine.yield(10)
    Space.Log(particles.ParticleCount)
end

Space.Host.StartCoroutine(ToCheckParticleCount)


PlaybackSpeed

float PlaybackSpeed { get;set; }

The playback speed of the Particle System. 1 is normal playback speed.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--set playback speed to 2.

particles.PlaybackSpeed = 2


PlayOnAwake

bool PlayOnAwake { get;set; }

If set to true, the Particle System will automatically start playing on startup. Note that this setting is shared between all Particle Systems in the current particle effect.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--disable play on awake.

particles.PlayOnAwake = false


RandomSeed

uint RandomSeed { get;set; }

Override the random seed used for the Particle System emission.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--set random seed.
particles.UseAutoRandomSeed = false

particles.RandomSeed = 123456


StartColor

Scolor StartColor { get;set; }

The initial color of particles when the Particle System first spawns them.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--set start color as pure red.

particles.StartColor = Color.New(1,0,0,1)


StartDelay

float StartDelay { get;set; }

Start delay in seconds. Use this to delay when playback starts on the system.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--set start delay property to 5.

particles.StartDelay = 5


StartLifetime

float StartLifetime { get;set; }

The total lifetime in seconds that particles will have when emitted. When using curves, this value acts as a scale on the curve. This value is set in the particle when it is created by the Particle System.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--set start lifetime to 20 seconds.

particles.StartLifetime = 20


StartRotation

float StartRotation { get;set; }

The initial rotation of particles when emitted. When using curves, this value acts as a scale on the curve. Note that the value should be given in radians.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--set start rotation to 90 degrees.

particles.StartRotation = 90


StartRotation3D

SVector StartRotation3D { get;set; }

The initial 3D rotation of particles when emitted. When using curves, this value acts as a scale on the curves. Note that the values are Euler angles and should be given in radians.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--set start rotation to 90 degrees of Y axis and 90 degrees of Z axis.

particles.StartRotation3D = Vector.New(0,90,90)


StartSize

float StartSize { get;set; }

The initial size of particles when the Particle System first spawns them.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--set start size to 10.

particles.StartSize = 10


StartSpeed

float StartSpeed { get;set; }

The initial speed of particles when the Particle System first spawns them.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--set start speed to 10.

particles.StartSpeed = 10


Time

float Time { get;set; }

Playback position in seconds. Use this to read current playback time or to seek to a new playback time.

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--particle start to play at seconds 2.

particles.Play(true)
particles.Time= 2


UseAutoRandomSeed

bool UseAutoRandomSeed { get;set; }

Controls whether the Particle System uses an automatically-generated random number to seed the random number generator. If set to true, the Particle System will generate a new random seed each time it is played. If set to false, ParticleSystem.randomSeed will be used instead, allowing for a constant seed (useful if you want your particles to play in exactly the same way each time) or user-defined random value (for example, you may want to cycle through an array of seeds).

spawningparticles = Space.Scene.Find("Particles")

--get particle object and get the particle system component on it.
particles=spawningparticles.ParticleSystem
--disable UseAutoRandomSeed.

particles.UseAutoRandomSeed = false