Class: McBlocky::RelativeLocation

Inherits:
Location
  • Object
show all
Defined in:
lib/mcblocky/location.rb

Instance Attribute Summary

Attributes inherited from Location

#x, #y, #z

Instance Method Summary collapse

Instance Method Details

#+(other) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/mcblocky/location.rb', line 25

def +(other)
  if other.is_relative?
    RelativeLocation.new(x + other.x, y + other.y, z + other.z)
  else
    Location.new(x + other.x, y + other.y, z + other.z)
  end
end

#-(other) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/mcblocky/location.rb', line 33

def -(other)
  if other.is_relative?
    RelativeLocation.new(x - other.x, y - other.y, z - other.z)
  else
    Location.new(x - other.x, y - other.y, z - other.z)
  end
end

#is_relative?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/mcblocky/location.rb', line 41

def is_relative?
  true
end