[−][src]Struct sulis_state::script::ScriptParticleGenerator
A flexible animation type, which can be used to create particle effects, simple
frame based animations, or anything in between.
Typically created by ScriptEntity:create_particle_generator
activate()
Activates and applies this animation.
`param(value: Float, dt: Float (Optional), d2t: Float (Optional),
d3t: Float (Optional))Creates a param which can then be passed to one of the various configuration methods accepting a param in this script generator. An initial
valuemust be specified - all other values are optional and default to zero.
dtis the speed coefficient,
d2tis the acceleration coefficient, and
d3t` is
the jerk coefficient.
`dist_param(value: Dist, dt: Dist (Optional), d2t: Dist (Optional),
d3t: Dist (Optional))Creates a
dist_param, which is a
paramwhere each component is a distribution that is randomly selected from. See
param`.
zero_dist() -> Dist
Creates a new Dist with a fixed value of zero.
fixed_dist(value: Float) -> Dist
Creates a dist which always returns the specified fixed value
uniform_dist(min: Float, max: Float) -> Dist
Creates a dist which randomly generates a value between min
and max
in a uniform manner.
`angular_dist(min_angle: Float, max_angle: Float, min_magnitude: Float,
max_magnitude: Float)` Creates a dist which randomly generates a direction and magnitude for a vector. As this is a two component dist, may only be used when configuring the particle position distribution.
set_blocking(blocking: Bool)
Sets whether this animation is blocking
. By default, animations with infinite time (or those
attached to an effect) are not blocking, but effects that have a fixed duration are. This
method allows you to change this as needed.
set_draw_below_entities()
Sets this animation to perform drawing below the entity layer in the main view
set_draw_above_entities()
Sets this animation to perform drawing above the entity layer in the main view.
set_initial_gen(value: Float)
Sets the number of particles that should immediately be generated by this animation, on its first frame. This "jump-starts" the animation.
set_gen_rate(value: Param)
Sets the number of particles generated each second.
set_moves_with_parent()
By default, animations stay in the position where they were created, subjected to their position. With this set, the animation will follow along with the parent's position, with the animation's position on top of this.
set_position(x: Param, y: Param)
Sets the x
and y
coordinates of this animation's overall position. Each time a particle
is generated, the particle's position is added to the generator position.
set_rotation(angle: Param)
Sets an angle
rotation (in radians) for all particles in this animation. The rotation
is currently being done in software for convenience, so this is not suitable for
animations with many particles.
set_rotation_centroid(x: Param, y: Param)
Sets the point that the rotation, if any, is done about. By default, this is the center point of the particle image.
set_color(r: Param, g: Param, b: Param, a: Param (Optional))
Sets the color which all particles in this animation are drawn using. The a
alpha
component is optional and defaults to a fixed value of 1.0. Each component Param
should yield values between 0.0 and 1.0
set_alpha(a: Param)
Sets the alpha color component for all particles in this animation. The value should be between 0.0 and 1.0
set_completion_callback(callback: CallbackData)
Sets the specified callback
to be called when this animation completes.
add_callback(callback: CallbackData, time: Float)
Sets the specified callback
to be called after the specified time
has elapsed,
in seconds.
set_particle_position_dist(x: DistParam, y: DistParam (Optional))
Sets the position distribution of particles generated by this animation. If both
x
and y
are passed, then seperate DistParam
s are used for each component.
If only x
is passed, then the same component is used for both. In the case of
angular_dist
and potentially others in the future, this gives 2D control over
particle position.
set_particle_duration_dist(duration: Dist)
Sets the length of time that particles exist for after being created, in seconds
set_particle_size_dist(width: Dist, height: Dist)
Sets the size (where 1.0 equals 1 tile) of particles created by this animation.
#set_particle_frame_time_offset_dist(value: Dist)
Sets a frame offset time for each particle created by this animation. This is only
useful for particles that are using a TimerImage
. When value
is a random
distribution, all particles generated by this animation will cease to be synced,
and instead all start, loop, and/or stop at random times with respect to one another.
Implementations
impl ScriptParticleGenerator
[src]
pub fn new(
parent: usize,
image: String,
duration_millis: ExtInt
) -> ScriptParticleGenerator
[src]
parent: usize,
image: String,
duration_millis: ExtInt
) -> ScriptParticleGenerator
pub fn new_anim(
parent: usize,
image: String,
duration_millis: ExtInt
) -> ScriptParticleGenerator
[src]
parent: usize,
image: String,
duration_millis: ExtInt
) -> ScriptParticleGenerator
pub fn owned_model(&self) -> GeneratorModel
[src]
Trait Implementations
impl Clone for ScriptParticleGenerator
[src]
fn clone(&self) -> ScriptParticleGenerator
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl UserData for ScriptParticleGenerator
[src]
fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M)
[src]
Auto Trait Implementations
impl RefUnwindSafe for ScriptParticleGenerator
impl Send for ScriptParticleGenerator
impl Sync for ScriptParticleGenerator
impl Unpin for ScriptParticleGenerator
impl UnwindSafe for ScriptParticleGenerator
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<'lua, T> FromLua<'lua> for T where
T: 'static + UserData + Clone,
[src]
T: 'static + UserData + Clone,
impl<'lua, T> FromLuaMulti<'lua> for T where
T: FromLua<'lua>,
[src]
T: FromLua<'lua>,
pub fn from_lua_multi(
values: MultiValue<'lua>,
lua: Context<'lua>
) -> Result<T, Error>
[src]
values: MultiValue<'lua>,
lua: Context<'lua>
) -> Result<T, Error>
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<'lua, T> ToLua<'lua> for T where
T: 'static + UserData + Send,
[src]
T: 'static + UserData + Send,
impl<'lua, T> ToLuaMulti<'lua> for T where
T: ToLua<'lua>,
[src]
T: ToLua<'lua>,
pub fn to_lua_multi(self, lua: Context<'lua>) -> Result<MultiValue<'lua>, Error>
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,