| 
									
										
										
										
											2024-05-19 15:59:41 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | using System.Diagnostics; | 
					
						
							|  |  |  | using System.Collections; | 
					
						
							|  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  | using System; | 
					
						
							|  |  |  | using Godot; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Rokojori | 
					
						
							|  |  |  | {   | 
					
						
							| 
									
										
										
										
											2025-01-08 18:46:17 +00:00
										 |  |  |   public enum TimeLineSpanUpdateType | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     Start, | 
					
						
							|  |  |  |     InSpan, | 
					
						
							|  |  |  |     End, | 
					
						
							|  |  |  |     CompletelyInside | 
					
						
							|  |  |  |   }  | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-05-19 15:59:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-08 18:46:17 +00:00
										 |  |  |   public class TimeLineSpan | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     public int id; | 
					
						
							| 
									
										
										
										
											2024-05-19 15:59:41 +00:00
										 |  |  |     public bool persistent; | 
					
						
							| 
									
										
										
										
											2025-01-08 18:46:17 +00:00
										 |  |  |     public float start; | 
					
						
							|  |  |  |     public float end; | 
					
						
							| 
									
										
										
										
											2025-01-03 12:09:23 +00:00
										 |  |  |     public bool wasInside = false; | 
					
						
							| 
									
										
										
										
											2025-01-19 20:35:51 +00:00
										 |  |  |     public TimeLine timeLine; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public Action<TimeLineSpan, TimeLineSpanUpdateType> callback; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public float duration => end - start; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public float phase  | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       get | 
					
						
							|  |  |  |       { | 
					
						
							|  |  |  |         var position = timeLine.position; | 
					
						
							|  |  |  |         return Mathf.Clamp( ( position - start ) / duration, 0, 1 ); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-05-19 15:59:41 +00:00
										 |  |  |   } | 
					
						
							|  |  |  | } |