mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 23:52:35 +00:00
Moved collision/physics information into manifest, made real mouse cursor always invisible and use 'virtual' cursor when needed.
This commit is contained in:
@@ -44,7 +44,7 @@ class IMICFPS
|
||||
|
||||
@map.entities.each do |entity|
|
||||
next unless entity.collidable?
|
||||
next if entity.collision == :static # Only dynamic entities can be resolved
|
||||
next if entity.manifest.collision_resolution == :static # Only dynamic entities can be resolved
|
||||
|
||||
search = @aabb_tree.search(entity.bounding_box)
|
||||
if search.size > 0
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class IMICFPS
|
||||
module EntityManager # Get included into GameState context
|
||||
def add_entity(entity)
|
||||
@collision_manager.add(entity)# Add every entity to collision manager
|
||||
@collision_manager.add(entity) if entity.manifest.collision# Add every entity to collision manager
|
||||
Publisher.instance.publish(:create, nil, entity)
|
||||
@entities << entity
|
||||
end
|
||||
@@ -22,7 +22,7 @@ class IMICFPS
|
||||
def remove_entity(entity)
|
||||
ent = @entities.detect {|entity| entity == entity}
|
||||
if ent
|
||||
@collision_manager.remove(entity)
|
||||
@collision_manager.remove(entity) if entity.manifest.collision
|
||||
@publisher.publish(:destroy, nil, entity)
|
||||
@entities.delete(ent)
|
||||
end
|
||||
|
||||
@@ -31,7 +31,7 @@ class IMICFPS
|
||||
if on_ground
|
||||
entity.velocity.y = 0
|
||||
else
|
||||
entity.velocity.y -= @collision_manager.map.gravity * entity.delta_time if entity.physics
|
||||
entity.velocity.y -= @collision_manager.map.gravity * entity.delta_time if entity.manifest.physics
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user