Explorar el Código

编辑器模式增加循环

tanghai hace 9 años
padre
commit
46a4bac172

+ 1 - 0
Unity/Assets/Editor/BehaviorTreeEditor/GraphDesigner.cs

@@ -129,6 +129,7 @@ namespace MyEditor
 						mSelectedNode = null;
 						//重新选中
 						CheckMouseInNode();
+
 						//右键菜单
 						PopMenu();
 					}

+ 23 - 1
Unity/Assets/Editor/EditorInit.cs

@@ -1,5 +1,8 @@
-using Model;
+using System;
+using Base;
+using Model;
 using UnityEditor;
+using UnityEngine;
 
 namespace MyEditor
 {
@@ -10,6 +13,25 @@ namespace MyEditor
 		{
 			Game.EntityEventManager.Register("Model", typeof (Game).Assembly);
 			Game.EntityEventManager.Register("Editor", typeof (EditorInit).Assembly);
+
+			EditorApplication.update += Update;
+		}
+
+		private static void Update()
+		{
+			if (Application.isPlaying)
+			{
+				return;
+			}
+
+			try
+			{
+				Game.EntityEventManager.Update();
+			}
+			catch (Exception e)
+			{
+				Log.Error(e.ToString());
+			}
 		}
 	}
 }

+ 1 - 0
Unity/Assets/Scripts/Entity/Game.cs

@@ -20,6 +20,7 @@ namespace Model
 				{
 					scene = new Scene();
 					scene.AddComponent<EventComponent>();
+					scene.AddComponent<TimerComponent>();
 				}
 				return scene;
 			}