Class: Pixiurge::Display::ParticleSource

Inherits:
Pixiurge::Displayable show all
Defined in:
lib/pixiurge/displayable/particle_source.rb

Overview

The server does none of the heavy lifting for configuring a Pixiurge particle source, but can still pass through enough parameters to make one happen. Early on we just pass the parameters through to the Javascript, but over time we can do more interesting verification on the server to make sure the particle source is basically reasonable and correct.

Since:

  • 0.1.0

Instance Attribute Summary

Attributes inherited from Pixiurge::Displayable

#block_height, #block_width, #displayable_type, #location_displayable, #location_name, #name, #position, #x, #y

Instance Method Summary collapse

Methods inherited from Pixiurge::Displayable

#destroy_for_player, #move_for_player, #show_to_player

Constructor Details

#initialize(particle_parameters, name:, engine_connector:) ⇒ ParticleSource

Constructor - create the particle source

Parameters:

  • particle_parameters (Hash)

    A JSON-serializable hash of particle source options to pass to the front end

  • name (String)

    The Demiurge item name for this Displayable

  • engine_connector (Pixiurge::EngineConnector)

    The Pixiurge EngineConnector this Displayable belongs to

Since:

  • 0.1.0



16
17
18
19
20
# File 'lib/pixiurge/displayable/particle_source.rb', line 16

def initialize particle_parameters, name:, engine_connector:
  @particle_parameters = particle_parameters
  @displayable_type = "particle_source"
  super(name: name, engine_connector: engine_connector)
end

Instance Method Details

#messages_to_show_player(player) ⇒ Array

Show this Displayable to a player.

Parameters:

Returns:

  • (Array)

    Message(s) to show this object to the player

Since:

  • 0.1.0



27
28
29
30
31
# File 'lib/pixiurge/displayable/particle_source.rb', line 27

def messages_to_show_player(player)
  messages = super
  messages[0].merge!({ "params" => @particle_parameters })
  messages
end