summaryrefslogtreecommitdiffhomepage
path: root/app/ECS
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2021-05-14 20:05:49 -0400
committerrealtradam <[email protected]>2021-05-14 20:05:49 -0400
commit1bf39aaa0d736b1976a32030fd1c18e0eedf1781 (patch)
tree70bc2e70bda09eba2356ed3a67cdbe9efa2b2dd6 /app/ECS
parent6a2996ceae968029be26ed7ebae8785dcfe877d2 (diff)
downloadtypemon-code-1bf39aaa0d736b1976a32030fd1c18e0eedf1781.tar.gz
typemon-code-1bf39aaa0d736b1976a32030fd1c18e0eedf1781.zip
incorperating ECS into dragonruby
Diffstat (limited to 'app/ECS')
-rw-r--r--app/ECS/component_manager.rb6
-rw-r--r--app/ECS/system_manager.rb3
-rw-r--r--app/ECS/systems/00_movement.rb19
-rw-r--r--app/ECS/systems/01_flying.rb12
4 files changed, 24 insertions, 16 deletions
diff --git a/app/ECS/component_manager.rb b/app/ECS/component_manager.rb
index e64bc21..b07cf79 100644
--- a/app/ECS/component_manager.rb
+++ b/app/ECS/component_manager.rb
@@ -1,5 +1,7 @@
-require_relative './base_component'
-Dir[File.join(__dir__, 'components', '*.rb')].sort.each { |file| require file }
+require 'app/ECS/base_component.rb'
+
+require 'app/ECS/components/00_test_component.rb'
+require 'app/ECS/components/01_based.rb'
class ECS
class Components
diff --git a/app/ECS/system_manager.rb b/app/ECS/system_manager.rb
index 53aa46b..dda8ed7 100644
--- a/app/ECS/system_manager.rb
+++ b/app/ECS/system_manager.rb
@@ -1,4 +1,5 @@
-Dir[File.join(__dir__, 'systems', '*.rb')].sort.each { |file| require file }
+require 'app/ECS/systems/00_movement.rb'
+require 'app/ECS/systems/01_flying.rb'
class ECS
class Systems
diff --git a/app/ECS/systems/00_movement.rb b/app/ECS/systems/00_movement.rb
index ced0343..9d8029a 100644
--- a/app/ECS/systems/00_movement.rb
+++ b/app/ECS/systems/00_movement.rb
@@ -3,18 +3,21 @@ class ECS
class Movement
def self.run
ECS::Components::TestComponent.data.each do |key, data|
- puts "Entity ID: #{key}"
unless (ECS::Components::Based.id - ECS::Entity.signatures[key]).zero?
unless (ECS::Components::Based.id & ECS::Entity.signatures[key]).zero?
- puts "Based Data: "
- puts "eks: #{ECS::Components::Based.data[key].x += 2}"
- puts "why: #{ECS::Components::Based.data[key].y += 2}"
+ #puts "Based Data: "
+ #puts "eks: #{ECS::Components::Based.data[key].x += 2}"
+ #puts "why: #{ECS::Components::Based.data[key].y += 2}"
+ ECS::Components::Based.data[key].x += 2
+ ECS::Components::Based.data[key].y += 2
end
end
- puts "Movement:"
- puts "x: #{data.x += 1}"
- puts "y: #{data.y += 1}"
- puts "---"
+ #puts "Movement:"
+ #puts "x: #{data.x += 1}"
+ #puts "y: #{data.y += 1}"
+ data.x += 1
+ data.y += 1
+ #puts "---"
end
end
end
diff --git a/app/ECS/systems/01_flying.rb b/app/ECS/systems/01_flying.rb
index 493e999..799398b 100644
--- a/app/ECS/systems/01_flying.rb
+++ b/app/ECS/systems/01_flying.rb
@@ -4,11 +4,13 @@ class ECS
def self.run
ECS::Components::Based.data.each do |key, data|
if ECS::Components::Based.id == ECS::Entity.signatures[key]
- puts "Entity ID: #{key}"
- puts "ONLY Based Data: "
- puts "eks: #{ECS::Components::Based.data[key].x += 3}"
- puts "why: #{ECS::Components::Based.data[key].y += 3}"
- puts "---"
+ #puts "Entity ID: #{key}"
+ #puts "ONLY Based Data: "
+ #puts "eks: #{ECS::Components::Based.data[key].x += 3}"
+ #puts "why: #{ECS::Components::Based.data[key].y += 3}"
+ #puts "---"
+ data.x += 3
+ data.y += 3
end
end
end