Module: Yuki::Particles
- Defined in:
- scripts/01450 Systems/00003 Map Engine/00001 Graphics/00400 Particles/00500 Yuki__Particles.rb,
scripts/01450 Systems/00003 Map Engine/00001 Graphics/00400 Particles/00501 Particles_Def.rb
Overview
Module that manage the particle display
Constant Summary collapse
- Data =
The particle data
[]
- EMPTY =
The empty actions
{ max_counter: 1, loop: false, data: [] }
Class Attribute Summary collapse
-
.named ⇒ Hash{ Symbol => Particle_Object }
readonly
Return the list of named particles.
Class Method Summary collapse
-
.add_building(image, x, y, oy = 0, visible_from1 = false, visible_from2 = false) ⇒ Building_Object
Add a building.
-
.add_named_particle(name, character, particle_tag, params = {})
Add a named particle (particle that has a specific flow).
-
.add_parallax(image, x, y, z, zoom_x = 1, zoom_y = 1, opacity = 255, blend_type = 0) ⇒ Parallax_Object
Add a parallax.
-
.add_particle(character, particle_tag, params = {}) ⇒ Particle_Object
Add a particle to the stack.
-
.clean_stack
Request to clean the stack.
-
.dispose
Dispose each particle.
-
.find_particle(terrain_tag, particle_tag)
Function that find the data for a particle according to the terrain_tag & the particle tag.
-
.init(viewport)
Init the particle display on a new viewport.
-
.ready? ⇒ Boolean
Tell if the system is ready to work.
-
.set_on_teleportation(v)
Tell the particle manager the game is warping the player.
-
.update
Update of the particles & stack cleaning if requested.
-
.viewport
Return the viewport of in which the Particles are shown.
Class Attribute Details
.named ⇒ Hash{ Symbol => Particle_Object } (readonly)
Return the list of named particles
125 126 127 |
# File 'scripts/01450 Systems/00003 Map Engine/00001 Graphics/00400 Particles/00500 Yuki__Particles.rb', line 125 def named @named end |
Class Method Details
.add_building(image, x, y, oy = 0, visible_from1 = false, visible_from2 = false) ⇒ Building_Object
Add a building
88 89 90 91 92 |
# File 'scripts/01450 Systems/00003 Map Engine/00001 Graphics/00400 Particles/00500 Yuki__Particles.rb', line 88 def add_building(image, x, y, oy = 0, visible_from1 = false, visible_from2 = false) object = Building_Object.new(image, x, y, oy) @stack << object return object end |
.add_named_particle(name, character, particle_tag, params = {})
Add a named particle (particle that has a specific flow)
58 59 60 61 62 |
# File 'scripts/01450 Systems/00003 Map Engine/00001 Graphics/00400 Particles/00500 Yuki__Particles.rb', line 58 def add_named_particle(name, character, particle_tag, params = {}) return if @named[name] && !@named[name].disposed @named[name] = add_particle(character, particle_tag, params) end |
.add_parallax(image, x, y, z, zoom_x = 1, zoom_y = 1, opacity = 255, blend_type = 0) ⇒ Parallax_Object
Add a parallax
74 75 76 77 78 |
# File 'scripts/01450 Systems/00003 Map Engine/00001 Graphics/00400 Particles/00500 Yuki__Particles.rb', line 74 def add_parallax(image, x, y, z, zoom_x = 1, zoom_y = 1, opacity = 255, blend_type = 0) object = Parallax_Object.new(image, x, y, z, zoom_x, zoom_y, opacity, blend_type) @stack << object return object end |
.add_particle(character, particle_tag, params = {}) ⇒ Particle_Object
Add a particle to the stack
42 43 44 45 46 47 48 49 50 51 |
# File 'scripts/01450 Systems/00003 Map Engine/00001 Graphics/00400 Particles/00500 Yuki__Particles.rb', line 42 def add_particle(character, particle_tag, params = {}) return unless ready? return if character.character_name.empty? particle_data = find_particle(character.terrain_tag, particle_tag) return unless particle_data @stack.push(particle = Particle_Object.new(character, particle_data, @on_teleportation, params)) return particle end |
.clean_stack
Request to clean the stack
33 34 35 |
# File 'scripts/01450 Systems/00003 Map Engine/00001 Graphics/00400 Particles/00500 Yuki__Particles.rb', line 33 def clean_stack @clean_stack = true end |
.dispose
Dispose each particle
112 113 114 115 116 117 118 119 120 |
# File 'scripts/01450 Systems/00003 Map Engine/00001 Graphics/00400 Particles/00500 Yuki__Particles.rb', line 112 def dispose return unless ready? @stack.each do |i| i.dispose if i && !i.disposed end ensure @stack = nil end |
.find_particle(terrain_tag, particle_tag)
This function will try $game_variables & 0 as terrain_tag if the particle_tag wasn't found
Function that find the data for a particle according to the terrain_tag & the particle tag
14 15 16 17 18 |
# File 'scripts/01450 Systems/00003 Map Engine/00001 Graphics/00400 Particles/00501 Particles_Def.rb', line 14 def find_particle(terrain_tag, particle_tag) Data.dig(terrain_tag, particle_tag) || Data.dig($game_variables[Var::PAR_DatID], particle_tag) || Data.dig(0, particle_tag) end |
.init(viewport)
Init the particle display on a new viewport
9 10 11 12 13 14 15 16 |
# File 'scripts/01450 Systems/00003 Map Engine/00001 Graphics/00400 Particles/00500 Yuki__Particles.rb', line 9 def init() dispose if @stack && != @viewport @clean_stack = false @stack ||= [] @named = {} @viewport = @on_teleportation = false end |
.ready? ⇒ Boolean
Tell if the system is ready to work
101 102 103 |
# File 'scripts/01450 Systems/00003 Map Engine/00001 Graphics/00400 Particles/00500 Yuki__Particles.rb', line 101 def ready? return @stack && !.disposed? end |
.set_on_teleportation(v)
Tell the particle manager the game is warping the player. Particle will skip the :enter phase.
107 108 109 |
# File 'scripts/01450 Systems/00003 Map Engine/00001 Graphics/00400 Particles/00500 Yuki__Particles.rb', line 107 def set_on_teleportation(v) @on_teleportation = v end |
.update
Update of the particles & stack cleaning if requested
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'scripts/01450 Systems/00003 Map Engine/00001 Graphics/00400 Particles/00500 Yuki__Particles.rb', line 19 def update return unless ready? @stack.each do |i| i.update if i && !i.disposed end # Clean stack part return unless @clean_stack @clean_stack = false @stack.delete_if(&:disposed) end |
.viewport
Return the viewport of in which the Particles are shown
95 96 97 |
# File 'scripts/01450 Systems/00003 Map Engine/00001 Graphics/00400 Particles/00500 Yuki__Particles.rb', line 95 def @viewport end |