示例#1
0
 public Root(Blackboard blackboard, Node mainNode) : base("Root", mainNode)
 {
     this.blackboard = blackboard;
     this.mainNode   = mainNode;
     this.clock      = UnityContext.GetClock();
     this.SetRoot(this);
 }
示例#2
0
        public static Blackboard GetSharedBlackboard(string key)
        {
            UnityContext context = GetInstance();

            if (!context.blackboards.ContainsKey(key))
            {
                context.blackboards.Add(key, new Blackboard(context.clock));
            }
            return(context.blackboards[key]);
        }
示例#3
0
        private static UnityContext GetInstance()
        {
            if (instance == null)
            {
                GameObject gameObject = new GameObject();
                gameObject.name     = "~Context";
                instance            = (UnityContext)gameObject.AddComponent(typeof(UnityContext));
                gameObject.isStatic = true;
#if !UNITY_EDITOR
                gameObject.hideFlags = HideFlags.HideAndDontSave;
#endif
            }
            return(instance);
        }