public Root(Blackboard blackboard, Node mainNode) : base("Root", mainNode) { this.blackboard = blackboard; this.mainNode = mainNode; this.clock = UnityContext.GetClock(); this.SetRoot(this); }
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]); }
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); }