Ejemplo n.º 1
0
    public void Update(ActionNode node, float deltaTime)
    {
        ConditionConfig   config     = (ConditionConfig)node.config;
        IActionMachine    machine    = node.actionMachine;
        IActionController controller = (IActionController)node.actionMachine.controller;

        if (!config.delayInvoke || !config.EnableBeginEnd())
        {
            if (!Checker(config.checker, machine, controller))
            {
                return;
            }
        }
        else
        {
            int successCnt = (int)node.data;
            if (Checker(config.checker, machine, controller))
            {//为true时计数+1
                node.data = ++successCnt;
            }

            if (successCnt == 0 ||//true的次数为0
                config.allFrameCheck && successCnt != (node.updateCnt + 1) ||//每一帧都必须为true,updateCnt需要+1是因为updateCnt在Update后才会递增
                machine.GetStateFrameIndex() != config.GetEndFrame())//不是最后一帧
            {
                return;
            }
        }

        machine.ChangeState(config.stateName, config.priority);
    }
Ejemplo n.º 2
0
 public override string ToString()
 {
     return($"动作节点:{actionMachine.configName}-{actionMachine.GetStateConfig().stateName}-{config.GetType().Name}-{actionMachine.GetStateFrameIndex()}");
 }