Пример #1
0
        //创建决策
        private void CreateDec(DecTrees DecTrees)
        {
            //实体
            foreach (string key in DecTrees.EntityTrees.Keys)
            {
                EntityDecGroup group = (EntityDecGroup)Enum.Parse(typeof(EntityDecGroup), key);

                //创建树
                NodeDataJson nodeJson = DecTrees.EntityTrees[key];
                Node         rootNode = Node.CreateNodeInstance(nodeJson);
                Node.CreateNodeRelation(rootNode, nodeJson.ChildNodes);

                BaseEntityDecision decision = new BaseEntityDecision(rootNode);;
                EntityDesDict.Add((int)group, decision);
            }

            //世界
            foreach (string key in DecTrees.WorldTrees.Keys)
            {
                WorldDecGroup group = (WorldDecGroup)Enum.Parse(typeof(WorldDecGroup), key);

                //创建树
                NodeDataJson nodeJson = DecTrees.WorldTrees[key];
                Node         rootNode = Node.CreateNodeInstance(nodeJson);
                Node.CreateNodeRelation(rootNode, nodeJson.ChildNodes);

                BaseWorldDecision decision = new BaseWorldDecision(rootNode);
                WorldDesDict.Add((int)group, decision);
            }
        }
Пример #2
0
 /// <summary>
 /// 添加世界决策器
 /// </summary>
 public void RegWorldDecision(int decId, BaseWorldDecision decision)
 {
     if (WorldDesDict.ContainsKey(decId))
     {
         return;
     }
     WorldDesDict.Add(decId, decision);
 }
Пример #3
0
        /// <summary>
        /// 获得决策世界
        /// </summary>
        public WorldWorkData GetWorldWorkData(int decId, int worldId)
        {
            if (!WorldDesDict.ContainsKey(decId))
            {
                return(null);
            }
            BaseWorldDecision decision = WorldDesDict[decId];

            return(decision.GetWorld(worldId));
        }
Пример #4
0
        /// <summary>
        /// 删除决策世界
        /// </summary>
        public void RemoveDecisionWorld(int decId, int worldId)
        {
            if (!WorldDesDict.ContainsKey(decId))
            {
                return;
            }
            BaseWorldDecision decision = WorldDesDict[decId];

            decision.RemoveWorld(worldId);
        }
Пример #5
0
        /// <summary>
        /// 添加决策世界
        /// </summary>
        public void AddDecisionWorld(int decId, WorldWorkData workData)
        {
            if (!WorldDesDict.ContainsKey(decId))
            {
                return;
            }
            BaseWorldDecision decision = WorldDesDict[decId];

            decision.AddWorld(workData);
        }