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.
		
		
		
		
		
			
	
	
		
			
				
					
						
							|  |  |  | using System; | 
					
						
							|  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  | using CleverCrow.Fluid.BTs.Trees; | 
					
						
							|  |  |  | using UnityEngine; | 
					
						
							|  |  |  | using UnityEngine.Timeline; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Game | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     public delegate IAIObject EventCallbackCreate(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public interface IAIObject | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         BehaviorTree Tree(); | 
					
						
							|  |  |  |         void Create(); | 
					
						
							|  |  |  |         void Tick(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public partial class AIObjectBase<T> : IAIObject where T : new() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         private BehaviorTreeBuilder _builder; | 
					
						
							|  |  |  |         protected BehaviorTree _tree; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         public static EventCallbackCreate GetCreator() | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             return () => (IAIObject)new T(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         public void Create() | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             _builder = new BehaviorTreeBuilder(); | 
					
						
							|  |  |  |             OnCreate(); | 
					
						
							|  |  |  |             _tree = _builder.Build(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         protected virtual void OnCreate() | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         public void Tick() | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             _tree.Tick(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         public BehaviorTree Tree() | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             return _tree; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |