Пример #1
0
        private bool BuildBehaviorTree(MyBehaviorDefinition behaviorDefinition)
        {
            if (this.m_BTDataByName.ContainsKey(behaviorDefinition.Id.SubtypeId))
            {
                return(false);
            }
            MyBehaviorTree behaviorTree = new MyBehaviorTree(behaviorDefinition);

            behaviorTree.Construct();
            BTData data = new BTData(behaviorTree);

            this.m_BTDataByName.Add(behaviorDefinition.Id.SubtypeId, data);
            return(true);
        }
        private bool BuildBehaviorTree(MyBehaviorDefinition behaviorDefinition)
        {
            Debug.Assert(!m_BTDataByName.ContainsKey(behaviorDefinition.Id.SubtypeId), "Tree with given behavior definition already exists.");
            if (m_BTDataByName.ContainsKey(behaviorDefinition.Id.SubtypeId))
            {
                return(false);
            }

            MyBehaviorTree newInstance = new MyBehaviorTree(behaviorDefinition);

            newInstance.Construct();
            BTData behaviorTreeData = new BTData(newInstance);

            m_BTDataByName.Add(behaviorDefinition.Id.SubtypeId, behaviorTreeData);
            return(true);
        }