KROYSDOCS
HomeWhat's newv0.1.0

Vfx

Plays .kvfx effects. An effect is an emitter hierarchy saved with "Save as VFX Effect"; a VFX Effect component plays it under its entity. Paths are relative to Content, such as "Effects/Explosion.kvfx". Everything here is cosmetic: decide hits and damage in gameplay code.

Kindclass
NamespaceKroys.EngineScripting
Members23
SourceVfx.cs
DECLARATION

Declaration

Namespace Kroys.EngineScripting.

Declaration
public static class Vfx
REFERENCE

Members

Methods
#public static Entity Spawn(string effectPath, Vector3 position)
Plays an effect once at a world position and returns its entity. Finished one-shots are pooled and reused, so spawning in a loop does not grow the scene.
methodstatic
#public static Entity SpawnAttached(string effectPath, Entity parent, Vector3 localOffset)
Plays an effect once attached to an entity, such as a bone or socket, at a local offset.
methodstatic
#public static bool SetEffect(Entity entity, string effectPath)
Switches the entity's effect at runtime, adding a VFX Effect component when it has none. An empty path removes the effect. Returns false when the path is not a known effect.
methodstatic
#public static bool Play(Entity entity)
Starts the effect from the beginning.
methodstatic
#public static bool Stop(Entity entity)
Stops emitting; particles already alive finish their lives.
methodstatic
#public static bool Pause(Entity entity)
Freezes the effect where it is; Resume continues it.
methodstatic
#public static bool Resume(Entity entity)
Resumes a paused effect.
methodstatic
#public static bool Burst(Entity entity, int count)
Adds particles to every emitter of the effect at once.
methodstatic
#public static bool SetIntensity(Entity entity, float intensity)
Scales emission and particle lights; 1 is as authored.
methodstatic
#public static bool SetSize(Entity entity, float size)
Scales particle sizes; 1 is as authored.
methodstatic
#public static bool SetSpeed(Entity entity, float speed)
Scales simulation speed; 1 is as authored.
methodstatic
#public static bool SetTint(Entity entity, float red, float green, float blue, float alpha = 1)
Multiplies particle colours; white is as authored.
methodstatic
#public static VfxState GetState(Entity entity)
The effect's playback state.
methodstatic
#public static bool IsPlaying(Entity entity)
Whether the effect is playing.
methodstatic
#public static bool SetParameter(Entity entity, string name, float value)
Sets one of the effect's own parameters (defined in VFX Studio) on this instance, such as "Intensity" or "Beam Color". Returns false when the effect has no parameter of that name. Floats use the first value; Bool parameters are on when the value is above 0.5.
methodstatic
#public static bool SetParameter(Entity entity, string name, bool value)
Sets a Bool parameter.
methodstatic
#public static bool SetParameter(Entity entity, string name, Vector3 value)
Sets a Vector3 parameter (gravity, wind, a beam end offset).
methodstatic
#public static bool SetParameter(Entity entity, string name, float red, float green, float blue, float alpha = 1f)
Sets a Color parameter (linear RGBA; HDR values above 1 glow).
methodstatic
#public static bool HasParameter(Entity entity, string name)
Whether the effect defines a parameter of that name.
methodstatic
#public static float GetParameter(Entity entity, string name)
The instance's value of a Float parameter, else its default; 0 when unknown.
methodstatic
#public static Vector4 GetParameterVector(Entity entity, string name)
The instance's value of a Vector3 or Color parameter (W is a colour's alpha).
methodstatic
#public static bool ResetParameter(Entity entity, string name)
Returns a parameter to the default the effect defines.
methodstatic
#public static bool PollEvent(Entity entity, out VfxEvent vfxEvent)
Takes the oldest "Notify Script" event the effect raised (a particle spawned, died or hit something). Call it in a loop each update; at most 64 events wait, older ones are dropped.
methodstatic
Signatures
public static Entity Spawn(string effectPath, Vector3 position)
public static Entity SpawnAttached(string effectPath, Entity parent, Vector3 localOffset)
public static bool SetEffect(Entity entity, string effectPath)
public static bool Play(Entity entity)
public static bool Stop(Entity entity)
public static bool Pause(Entity entity)
public static bool Resume(Entity entity)
public static bool Burst(Entity entity, int count)
public static bool SetIntensity(Entity entity, float intensity)
public static bool SetSize(Entity entity, float size)
public static bool SetSpeed(Entity entity, float speed)
public static bool SetTint(Entity entity, float red, float green, float blue, float alpha = 1)
public static VfxState GetState(Entity entity)
public static bool IsPlaying(Entity entity)
public static bool SetParameter(Entity entity, string name, float value)
public static bool SetParameter(Entity entity, string name, bool value)
public static bool SetParameter(Entity entity, string name, Vector3 value)
public static bool SetParameter(Entity entity, string name, float red, float green, float blue, float alpha = 1f)
public static bool HasParameter(Entity entity, string name)
public static float GetParameter(Entity entity, string name)
public static Vector4 GetParameterVector(Entity entity, string name)
public static bool ResetParameter(Entity entity, string name)
public static bool PollEvent(Entity entity, out VfxEvent vfxEvent)

KroysEngine 0.1.0 documentation, built from the engine repository by Tools/BuildDocsSite.py.