示例#1
0
    protected virtual GOAPGoal FindNewGoal()
    {
        if (goals.Length == 0)
        {
            return(null);
        }

        //if (_owner.BlackBoard.desiredTarget == null)
        //{
        //  return null;
        //}

        float    maxWeight = 0;
        GOAPGoal maxGoal   = null;

        foreach (var goalType in goals)
        {
            GOAPGoal goal = GOAPGoalFactory.Get(goalType, _owner);
            goal.CalcWeight(_ws, _owner.BlackBoard);
            if (goal.Weight > maxWeight)
            {
                maxWeight = goal.Weight;
                maxGoal   = goal;
            }
        }

        return(maxGoal);

        /*if (Input.GetKeyUp(KeyCode.Alpha1))
         * {
         *  return GOAPGoalFactory.Get(GOAPGoalType.ATTACK_TARGET, _owner);
         * }
         * if (Input.GetKeyUp(KeyCode.Alpha2))
         * {
         *  return GOAPGoalFactory.Get(GOAPGoalType.BLOCK, _owner);
         * }
         * if (Input.GetKeyUp(KeyCode.Alpha3))
         * {
         *  return GOAPGoalFactory.Get(GOAPGoalType.STEP_IN, _owner);
         * }
         * if (Input.GetKeyUp(KeyCode.Alpha4))
         * {
         *  return GOAPGoalFactory.Get(GOAPGoalType.STEP_OUT, _owner);
         * }
         * if (Input.GetKeyUp(KeyCode.Alpha5))
         * {
         *  return GOAPGoalFactory.Get(GOAPGoalType.STEP_AROUND, _owner);
         * }
         *
         * return null;*/
    }