mirror of
				https://github.com/Reuh/ubiquitousse.git
				synced 2025-10-27 17:19:31 +00:00 
			
		
		
		
	ecs: add callbackFiltered and emitFiltered
This commit is contained in:
		
							parent
							
								
									bd28610ff4
								
							
						
					
					
						commit
						aa332a0adf
					
				
					 20 changed files with 697 additions and 568 deletions
				
			
		
							
								
								
									
										35
									
								
								ecs/commonsystems/timer.can
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								ecs/commonsystems/timer.can
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,35 @@ | |||
| --- Timer system | ||||
| -- Handles ubiquitousse timers. | ||||
| 
 | ||||
| let timer = require((...):match("^(.-)ecs%.timer").."scene") | ||||
| 
 | ||||
| return { | ||||
| 	name = "timer", | ||||
| 	filter = "timer", | ||||
| 	default = { | ||||
| 		-- timer object | ||||
| 	}, | ||||
| 	process = :(e, t, dt) | ||||
| 		t:update(dt) | ||||
| 		if t:dead() then | ||||
| 			@world:remove(t.entity) | ||||
| 		end | ||||
| 	end, | ||||
| 	--- System methods --- | ||||
| 	--- Add a new timer | ||||
| 	run = :(func) | ||||
| 		local t = timer.run(func) | ||||
| 		@world:add { | ||||
| 			timer = t | ||||
| 		} | ||||
| 		return t | ||||
| 	end, | ||||
| 	--- Add a new tween | ||||
| 	tween = :(duration, tbl, to, method) | ||||
| 		local t = timer.tween(duration, tbl, to, method) | ||||
| 		@world:add { | ||||
| 			timer = t | ||||
| 		} | ||||
| 		return t | ||||
| 	end | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue