class Cube

Attributes

color[RW]
mittsu_object[RW]
size_vector[RW]

Public Class Methods

new(color: 0x0000ff, size_vector: Mittsu::Vector3.new(1.0, 1.0, 1.0)) click to toggle source
# File managables/programs/game_aided_manufacturing/shapes/cube.rb, line 6
def initialize(color: 0x0000ff, size_vector:  Mittsu::Vector3.new(1.0, 1.0, 1.0))
  # value assignment (phase 1)

  self.color = color
  self.size_vector = size_vector

  # computing based on values (phase 2)
  self.create_mittsu_object

  # event distribution (phase 3)
  ::Gam::CUBES.push(self)
end

Public Instance Methods

create_mittsu_object() click to toggle source
# File managables/programs/game_aided_manufacturing/shapes/cube.rb, line 19
def create_mittsu_object
  @mittsu_object = Mittsu::Mesh.new(
    Mittsu::BoxGeometry.new(self.size_vector.x, self.size_vector.y, self.size_vector.z),
    Mittsu::MeshBasicMaterial.new(color: self.color)
  )
end
fall_down() click to toggle source
# File managables/programs/game_aided_manufacturing/shapes/cube.rb, line 26
def fall_down
  self.position.y -= 0.01
end
method_missing(method_name, *args, &block) click to toggle source
# File managables/programs/game_aided_manufacturing/shapes/cube.rb, line 30
def method_missing(method_name, *args, &block)
  @mittsu_object.public_send(method_name, *args, &block)
end