Exemplo n.º 1
0
    void PlayCommand(int commandId)
    {
        //if(this.workFlowchart.csvCmdList[commandId] == null)
        if (AdvUtility.FindCommandByCSVLine(workFlowchart, commandId) == null)
        {
            AdvUtility.LogWarning("找不到該行數 Command !");
            return;
        }
        Command targetCmd   = AdvUtility.FindCommandByCSVLine(workFlowchart, commandId);
        var     targetBlock = targetCmd.ParentBlock;

        //ControlBackground bg = targetCmd.CSVBackgroundInfo;
        if (targetBlock.IsExecuting())
        {
            // The Block is already executing.
            // Tell the Block to stop, wait a little while so the executing command has a
            // chance to stop, and then start execution again from the new command.
            targetBlock.Stop();

            workFlowchart.StartCoroutine(RunBlock(workFlowchart, targetBlock, targetCmd.CommandIndex, 0.2f));
        }
        else
        {
            // Block isn't executing yet so can start it now.
            workFlowchart.ExecuteBlock(targetBlock, targetCmd.CommandIndex);

            AdvManager.Instance.StartAdvScene();
        }
    }