-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsystem.lua
More file actions
36 lines (28 loc) · 691 Bytes
/
system.lua
File metadata and controls
36 lines (28 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
local TinyECS = require("lecs.tiny_ecs")
local Filter = require("lecs.filter")
---@class System
---@field protected filter Filter
---@field private _system table
---@field private _world World
local System = class("System")
function System:ctor()
self.filter = Filter
local system = TinyECS.system()
system.filter = self:CreateFilter()
system.update = function(t, dt)
self:Update(t.entities, dt)
end
self._system = system
self._world = nil
end
function System:CreateFilter()
end
---@param entities Entity[]
function System:Update(entities, dt)
end
---@protected
---@return World
function System:GetWorld()
return self._world
end
return System