mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-16 08:02:36 +00:00
Implemented event system, Implemented initial bit of scripting system, Stubbed component system. Entities can now use the scripting system to place their 'decorations'
This commit is contained in:
@@ -4,6 +4,7 @@ class IMICFPS
|
||||
# A game object is any renderable thing
|
||||
class Entity
|
||||
include CommonMethods
|
||||
include Scripting
|
||||
|
||||
attr_accessor :scale, :visible, :renderable, :backface_culling
|
||||
attr_accessor :position, :orientation, :velocity
|
||||
@@ -38,6 +39,8 @@ class IMICFPS
|
||||
@delta_time = Gosu.milliseconds
|
||||
@last_position = Vector.new(@position.x, @position.y, @position.z)
|
||||
|
||||
load_scripts
|
||||
|
||||
setup
|
||||
|
||||
if @bound_model
|
||||
@@ -52,6 +55,20 @@ class IMICFPS
|
||||
return self
|
||||
end
|
||||
|
||||
def load_scripts
|
||||
@manifest.scripts.each do |script|
|
||||
instance_eval(script.source)
|
||||
end
|
||||
end
|
||||
|
||||
def method_missing(method, *args, &block)
|
||||
unless component = Component.get(method)
|
||||
raise NoMemoryError, "undefined method '#{method}' for #<#{self.class}:#{self.object_id}>"
|
||||
else
|
||||
return component
|
||||
end
|
||||
end
|
||||
|
||||
def collidable?
|
||||
@collidable.include?(@collision)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user