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.
		
		
		
		
		
			
		
			
				
	
	
		
			73 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C#
		
	
			
		
		
	
	
			73 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C#
		
	
| using System;
 | |
| using CleverCrow.Fluid.BTs.Tasks;
 | |
| 
 | |
| namespace Game
 | |
| {
 | |
|     public partial class AIObjectBase<T> where T : new()
 | |
|     {
 | |
|         protected enum ETaskStatus
 | |
|         {
 | |
|             Success,
 | |
|             Failure,
 | |
|             Continue
 | |
|         }
 | |
| 
 | |
|         protected void Selector(Action action)
 | |
|         {
 | |
|             Selector("selector", action);
 | |
|         }
 | |
| 
 | |
|         protected void Selector(string name, Action action)
 | |
|         {
 | |
|             _builder.Selector(name);
 | |
|             action();
 | |
|             _builder.End();
 | |
|         }
 | |
| 
 | |
|         protected void Sequence(Action action)
 | |
|         {
 | |
|             Sequence("sequence", action);
 | |
|         }
 | |
| 
 | |
|         protected void Sequence(string name, Action action)
 | |
|         {
 | |
|             _builder.Sequence(name);
 | |
|             action();
 | |
|             _builder.End();
 | |
|         }
 | |
| 
 | |
|         protected void Do(string name, Func<ETaskStatus> action, Func<string> into = null)
 | |
|         {
 | |
|             _builder.Do(name, () => (TaskStatus)action(), into);
 | |
|         }
 | |
| 
 | |
|         protected void Condition(string name, Func<bool> action)
 | |
|         {
 | |
|             _builder.Condition(name, action);
 | |
|         }
 | |
| 
 | |
|         protected void WaitTimeCheck(string name, float time)
 | |
|         {
 | |
|             _builder.WaitTimeCheck(name, time);
 | |
|         }
 | |
| 
 | |
|         protected void WaitTimeCheckDynamic(string name, Func<float> time)
 | |
|         {
 | |
|             _builder.WaitTimeCheckDynamic(name, time);
 | |
|         }
 | |
| 
 | |
|         protected void ReturnSuccess(Action action)
 | |
|         {
 | |
|             _builder.ReturnSuccess();
 | |
|             action();
 | |
|             _builder.End();
 | |
|         }
 | |
| 
 | |
|         protected void ReturnFailure(Action action)
 | |
|         {
 | |
|             _builder.ReturnFailure();
 | |
|             action();
 | |
|             _builder.End();
 | |
|         }
 | |
|     }
 | |
| } |