diff options
| author | realtradam <[email protected]> | 2021-05-14 05:48:50 -0400 |
|---|---|---|
| committer | realtradam <[email protected]> | 2021-05-14 05:48:50 -0400 |
| commit | 6a2996ceae968029be26ed7ebae8785dcfe877d2 (patch) | |
| tree | f3d4d405f7e032fcabbb9711f75e266282d98295 /app/ECS/systems | |
| parent | 57bd7ec9da14b3e7e338184568a273ce602e1557 (diff) | |
| download | typemon-code-6a2996ceae968029be26ed7ebae8785dcfe877d2.tar.gz typemon-code-6a2996ceae968029be26ed7ebae8785dcfe877d2.zip | |
added ECS system
Diffstat (limited to 'app/ECS/systems')
| -rw-r--r-- | app/ECS/systems/00_movement.rb | 22 | ||||
| -rw-r--r-- | app/ECS/systems/01_flying.rb | 17 |
2 files changed, 39 insertions, 0 deletions
diff --git a/app/ECS/systems/00_movement.rb b/app/ECS/systems/00_movement.rb new file mode 100644 index 0000000..ced0343 --- /dev/null +++ b/app/ECS/systems/00_movement.rb @@ -0,0 +1,22 @@ +class ECS + class Systems + 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}" + end + end + puts "Movement:" + puts "x: #{data.x += 1}" + puts "y: #{data.y += 1}" + puts "---" + end + end + end + end +end diff --git a/app/ECS/systems/01_flying.rb b/app/ECS/systems/01_flying.rb new file mode 100644 index 0000000..493e999 --- /dev/null +++ b/app/ECS/systems/01_flying.rb @@ -0,0 +1,17 @@ +class ECS + class Systems + class Based + 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 "---" + end + end + end + end + end +end |
