/// <summary>
    /// 删除所有指定类型的action(只是置Action为stopped, 实际的析构对象统一在Update进行).
    /// </summary>
    public void RemoveActionByType(ActionTypeDef type)
    {
        Action action = GetActionByType(type);

        if (action != null)
        {
            action.Stop(false);
        }
    }
    public Action Allocate(ActionTypeDef type)
    {
        if (type >= ActionTypeDef.ActionTypeCount)
        {
            ErrorHandler.Parse(ErrorCode.LogicError, "invalid action type");
            return(null);
        }

        return(allocators[(int)type].Allocate());
    }
    /// <summary>
    /// 获取一个类型的活动状态的action.
    /// </summary>
    /// <param name="T"></param>
    /// <returns></returns>
    public Action GetActionByType(ActionTypeDef type)
    {
        Action result = mActionContainer[(int)type];

        if (result != null && !result.IsRunning)
        {
            result = null;
        }
        return(result);
    }
 public void Destroy()
 {
     for (ActionTypeDef type = ActionTypeDef.ActionTypeIdle; type < ActionTypeDef.ActionTypeCount; ++type)
     {
         Action action = GetActionByType(type);
         if (action != null)
         {
             action.Stop(false);
         }
     }
 }
    /// <summary>
    /// Owner的动态标记发生变化, 通知每个Action, 从而得知这些Action哪些需要被终止.
    /// </summary>
    /// <param name="flagName">动态标记标识</param>
    public void OnActiveFlagsStateChanged(ActiveFlagsDef flagName, bool increased)
    {
        for (ActionTypeDef type = ActionTypeDef.ActionTypeIdle; type < ActionTypeDef.ActionTypeCount; ++type)
        {
            Action action = GetActionByType(type);
            if (action == null)
            {
                continue;
            }

            if (!action.OnActiveFlagsStateChanged(flagName, increased))
            {
                action.Stop(false);
            }
        }

        if (flagName == ActiveFlagsDef.IsDead)
        {
            IdleAction.SetActive(Owner.isAlive());
        }
    }
    /// <summary>
    /// 更新每个Action, Action的实际清除操作统一在这里进行.
    /// </summary>
    public void UpdateActions(uint elapsed)
    {
        for (ActionTypeDef type = ActionTypeDef.ActionTypeIdle; type < ActionTypeDef.ActionTypeCount; ++type)
        {
            Action action = mActionContainer[(int)type];
            if (action == null)
            {
                continue;
            }

            if (!action.IsRunning)
            {
                mActionContainer[(int)type] = null;
                continue;
            }

            UpdateRetCode ret = action.Update(elapsed);
            if (ret != UpdateRetCode.Continue)
            {
                action.Stop((ret == UpdateRetCode.Finished));
                mActionContainer[(int)type] = null;
            }
        }
    }