Module: Bayonetta::VectorAccessor

Included in:
FloatNormal, HalfNormal, Normal, Position, Tangents
Defined in:
lib/bayonetta/wmb.rb

Instance Method Summary collapse

Instance Method Details

#[](i) ⇒ Object



99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/bayonetta/wmb.rb', line 99

def [](i)
  case i
  when 0
    self.x
  when 1
    self.y
  when 2
    self.z
  else
    "Invalid index #{i} for a vector access!"
  end
end

#[]=(i, v) ⇒ Object



112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/bayonetta/wmb.rb', line 112

def []=(i,v)
  case i
  when 0
    self.x = v
  when 1
    self.y = v
  when 2
    self.z = v
  else
    "Invalid index #{i} for a vector access!"
  end
end