Example #1
0
File: thePlot.cs Project: BXZR/GAL
//操作剧本树单元的方法,这个程序真正用来玩的方法
//事实上,这个方法只会对单个分支节点生效
    public void playTheItem(thePlotItem theItem = null)
    {
        //简单的防护措施
        if (theItem == null)
        {
            //额外的文件处理
            //既然已经完成了,就保存一下吧
            systemInformations.SaveTheOverPlot();
            CGModeFile.saveCGFile();
            SceneModeFile.saveSceneFile();
            extraHFile.saveHExtra();

            //print ("没有可控制的剧本元素");
            SceneManager.LoadScene("start");
            return;
        }
        //尝试激活Scene
        //规则是当一个剧本帧的下标到达了某一个scene的最后一个下标,那么这个scerne就可以被解锁
        SceneModeFile.activeScene(theItem.ThePlotItemID);
        //每一次新跑一个剧本帧的时候才会真的初始化这个剧本帧的儿子节点
        //性能消耗均摊,这样看上去要比初始化的时候气归初始化要好一点
        theItem.makeStart();
        theItemNow       = theItem;
        watiForSkipTimer = theItemNow.waitTimeForAutoSkip;

        //各种控制单元对这个单元的操作
        theTextController.setTheString(theItem);
        theUIController.makeShow(theItem);
        //print ("theMusicController name is " + theMusicController.gameObject.name);
        theMusicController.playBackMusic(theItem);
        theSoundController.playSound(theItem);
        thePeopleSoundController.playSound(theItem, true);

        //剧本帧完成之后这些计算才能生效
        //剧本完成度控制
        systemInformations.addPlotOverPercent(theItem);
        //好感度控制
        theItem.makeAddLoveValue();
    }