mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2025-12-18 14:02:33 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f489ad162f | |||
| df2dc25e34 |
@@ -48,6 +48,12 @@ module CyberarmEngine
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def opacity(color, ratio = 1.0)
|
||||||
|
alpha = 255 * ratio
|
||||||
|
|
||||||
|
return Gosu::Color.rgba(color.red, color.green, color.blue, alpha)
|
||||||
|
end
|
||||||
|
|
||||||
def get_asset(path, hash, klass)
|
def get_asset(path, hash, klass)
|
||||||
asset = nil
|
asset = nil
|
||||||
hash.detect do |_asset, instance|
|
hash.detect do |_asset, instance|
|
||||||
|
|||||||
@@ -2,9 +2,23 @@ module CyberarmEngine
|
|||||||
class BoundingBox
|
class BoundingBox
|
||||||
attr_accessor :min, :max
|
attr_accessor :min, :max
|
||||||
|
|
||||||
def initialize(minx = 0, miny = 0, minz = 0, maxx = 0, maxy = 0, maxz = 0)
|
def initialize(*args)
|
||||||
@min = Vector.new(minx, miny, minz)
|
case args.size
|
||||||
@max = Vector.new(maxx, maxy, maxz)
|
when 0
|
||||||
|
@min = Vector.new(0, 0, 0)
|
||||||
|
@max = Vector.new(0, 0, 0)
|
||||||
|
when 2
|
||||||
|
@min = args.first.clone
|
||||||
|
@max = args.last.clone
|
||||||
|
when 4
|
||||||
|
@min = Vector.new(args[0], args[1], 0)
|
||||||
|
@max = Vector.new(args[2], args[3], 0)
|
||||||
|
when 6
|
||||||
|
@min = Vector.new(args[0], args[1], args[2])
|
||||||
|
@max = Vector.new(args[3], args[4], args[5])
|
||||||
|
else
|
||||||
|
raise "Invalid number of arguments! Got: #{args.size}, expected: 0, 2, 4, or 6."
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def ==(other)
|
def ==(other)
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ module CyberarmEngine
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Performs math operation, excluding @weight
|
# Performs math operation, excluding @weight
|
||||||
def operator(function, other)
|
private def operator(function, other)
|
||||||
if other.is_a?(Numeric)
|
if other.is_a?(Numeric)
|
||||||
Vector.new(
|
Vector.new(
|
||||||
@x.send(:"#{function}", other),
|
@x.send(:"#{function}", other),
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module CyberarmEngine
|
module CyberarmEngine
|
||||||
NAME = "InDev"
|
NAME = "InDev"
|
||||||
VERSION = "0.3.0"
|
VERSION = "0.4.0"
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user