示例#1
0
    public bool UpdatePlan(WorldState curWS)
    {
        if (_actions.Count == 0)
        {
            return(false);
        }

        GOAPAction curGOAPAction = _actions.Peek();

        if (!curGOAPAction.IsValid())
        {
            Clear();
            return(false);
        }

        if (curGOAPAction.IsFinished)
        {
            //curGOAPAction.ApplyEffect(curWS); // 实施效果(其实没必要调用了,因为这时候没有必要设置ws效果了,因为ws的效果没有意义,接着执行下面的action就行)
            _actions.Dequeue().Release();
            if (_actions.Count > 0)
            {
                curGOAPAction = _actions.Peek();
                curGOAPAction.Activate();
            }
        }
        else
        {
            curGOAPAction.UpdateGOAPAction();
        }

        return(true);
    }