コード例 #1
0
ファイル: ActionTest2.cs プロジェクト: wachel/goap_test
        void Start()
        {
            agent.SetValue("has_weapon", false);
            agent.SetValue("bullet_num", 0);
            agent.SetValue("kill_enemy", 0);

            actions.Add(new ActionPickWeapon());
            actions.Add(new ActionBuyWeapon());
            actions.Add(new ActionBuyBullet());
            actions.Add(new ActionFire());

            actionGoal           = new ActionGoal();
            actionGoal.condition = (Agent a) => { return(a.GetIntValue("kill_enemy") == 2); };

            Path2  path       = Planner.GetPlanning(actions, agent, actionGoal, 50);
            string pathString = "";

            foreach (ActionBase action in path.actions)
            {
                pathString += "->" + action.GetType().Name;
            }
            Debug.Log("start" + pathString);
        }
コード例 #2
0
ファイル: ActionTest3.cs プロジェクト: wachel/goap_test
        void Start()
        {
            agent.hasWeapon = false;
            agent.bulletNum = 0;
            agent.killedNum = 0;

            actions.Add(new ActionPickWeapon3());
            actions.Add(new ActionBuyWeapon3());
            actions.Add(new ActionBuyBullet3());
            actions.Add(new ActionFire3());

            actionGoal           = new ActionGoal();
            actionGoal.condition = (Agent a) => { return(a.killedNum == 2); };

            Path2  path       = Planner.GetPlanning(actions, agent, actionGoal, 50);
            string pathString = "";

            foreach (ActionBase action in path.actions)
            {
                pathString += "->" + action.GetType().Name;
            }
            Debug.Log("start" + pathString);
        }