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.
		
		
		
		
		
			
		
			
				
	
	
		
			49 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C#
		
	
			
		
		
	
	
			49 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C#
		
	
| using System.Collections.Generic;
 | |
| using Bolt;
 | |
| 
 | |
| namespace Game
 | |
| {
 | |
|     /// <summary>
 | |
|     /// Node基类 项目内所有节点继承自该类
 | |
|     /// 有一个ControlInput的默认节点
 | |
|     /// </summary>
 | |
|     public class NodeBase : Unit
 | |
|     {
 | |
|         public ControlInput input { get; protected set; }
 | |
|         protected BlueprintBasicData data;
 | |
|         protected List<int> tempListInt = new List<int>();
 | |
|         protected override void Definition()
 | |
|         {
 | |
|             input = ControlInput("", Enter);
 | |
|             OnDefinition();
 | |
|         }
 | |
|         private ControlOutput Enter(Flow flow)
 | |
|         {
 | |
|             data = Variables.Object(flow.stack.gameObject).Get<BlueprintBasicData>("data");
 | |
|             return OnEnter(flow);
 | |
|         }
 | |
|         protected virtual void OnDefinition() { }
 | |
|         protected virtual ControlOutput OnEnter(Flow flow) { return null; }
 | |
|     }
 | |
| 
 | |
|     /// <summary>
 | |
|     /// 有一个ControlInput和一个ControlOutput的默认节点
 | |
|     /// </summary>
 | |
|     public class NodeDefault : NodeBase
 | |
|     {
 | |
|         public ControlOutput output { get; protected set; }
 | |
|         protected override void OnDefinition()
 | |
|         {
 | |
|             output = ControlOutput("");
 | |
|             Def();
 | |
|         }
 | |
|         protected override ControlOutput OnEnter(Flow flow)
 | |
|         {
 | |
|             Run(flow);
 | |
|             return output;
 | |
|         }
 | |
|         protected virtual void Def() { }
 | |
|         protected virtual void Run(Flow flow) { }
 | |
| 
 | |
|     }
 | |
| } |