You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
703 B
Lua
38 lines
703 B
Lua
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[]
|
|
---@param dt number
|
|
function System:Update(_, _)
|
|
end
|
|
|
|
---@protected
|
|
---@return World
|
|
function System:GetWorld()
|
|
return self._world
|
|
end
|
|
|
|
return System
|