示例#1
0
        public override void Init()
        {
            updateData   = new SortedList <CondtionTag, Func <IContext, bool> >(1 << 4);
            conditionMap = new Dictionary <CondtionTag, bool>(1 << 4);
            enemyContext = this.GetComponent <EnemyContext>();
            goalMgr      = enemyContext.Agent.AgentGoalMgr.GetGoalMgr <EnemyGoalMgr>();
            foreach (var stateBase in goalMgr.GoalsDic.Values)
            {
                foreach (var condtion in stateBase.Condition)
                {
                    //获取配置文件中所有的 Tag 标签
                    if (!conditionMap.ContainsKey(condtion.ElementTag))
                    {
                        conditionMap.Add(condtion.ElementTag, default(bool));
                    }
                }

                foreach (var condtion in stateBase.Target)
                {
                    //获取配置文件中所有的 Tag 标签
                    if (!conditionMap.ContainsKey(condtion.ElementTag))
                    {
                        conditionMap.Add(condtion.ElementTag, default(bool));
                    }
                }
            }
#if UNITY_EDITOR
            panelInfo = new List <CondtionAssembly>(1 << 4);
            foreach (var elementTag in conditionMap)
            {
                panelInfo.Add(new CondtionAssembly(elementTag.Key, default(bool)));
            }
#endif
        }
示例#2
0
 public EnemyAgent(IContext context) : base(context)
 {
     //初始化到指定 --->>> Context 方便全局调用
     AgentStateMgr  = new EnemyStateMgr();
     AgentActionMgr = new EnemyActionMgr(this);
     AgentGoalMgr   = new EnemyGoalMgr(this);
     Performer      = new EnemyPerformer(this);
 }