Пример #1
0
    public IEnumerator FadeModel(float destOps, float time)
    {
        Debug.Log("called");
        yield return(new WaitForEndOfFrame());

        for (int i = 0; i < textureFiles.Length; i++)
        {
            Debug.Log("inside loop");
            live2DModel.setPartsOpacity(i, destOps);
        }

        /*
         * List<float> ops = new List<float> ();
         * for (int i = 0; i < textureFiles.Length; i++) {
         *      ops.Add(live2DModel.getPartsOpacity(i));
         * }
         * var startTime = Time.time;
         * while (Time.time - startTime < time) {
         *      var rate = (Time.time - startTime) / time;
         *      var curOps = 0f;
         *      for (int i = 0; i < textureFiles.Length; i++) {
         *              curOps = destOps * rate + live2DModel.getPartsOpacity(i) * (1 - rate);
         *              live2DModel.setPartsOpacity(i, curOps);
         *      }
         *      yield return new WaitForEndOfFrame ();
         * }
         * for (int i = 0; i < textureFiles.Length; i++) {
         *      live2DModel.setPartsOpacity(i, destOps);
         * }
         */
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        Live2D.init();

        motion = Live2DMotion.loadMotion(mtnFiles[0].bytes);

        motion.setLoop(true);

        live2DModel = Live2DModelUnity.loadModel(mocFile.bytes);
        for (int i = 0; i < textures.Length; i++)
        {
            live2DModel.setTexture(i, textures[i]);
        }

        motionManager = new MotionQueueManager();

        motionManager.startMotion(motion, false);

        live2DModel.setPartsOpacity("PARTS_WEAPON01", 0);
        live2DModel.setPartsOpacity("PARTS_WEAPON02", 0);
        live2DModel.setPartsOpacity("PARTS_WEAPON03", 0);
        live2DModel.setPartsOpacity("PARTS_WEAPON04", 0);
        live2DModel.setPartsOpacity("PARTS_WEAPON05", 0);
        live2DModel.setPartsOpacity("PARTS_WEAPON06", 0);
    }
    public void SetParts(Live2DPartConfig[] parts)
    {
        if (live2DModel == null)
        {
            return;
        }

        for (int i = 0; i < parts.Length; i++)
        {
            var p = parts[i];
            live2DModel.setPartsOpacity(i, p.opacity);
        }
    }
Пример #4
0
    void OnRenderObject()
    {
        live2DModel.draw();

        var partList = live2DModel.getModelImpl().getPartsDataList();

        foreach (var item in partList)
        {
            live2DModel.setPartsOpacity(item.getPartsDataID().ToString(), modelOpacity);
            if (item.getPartsDataID().ToString() == "PARTS_WEAPON01")
            {
                return;
            }
            if (item.getPartsDataID().ToString() == "PARTS_WEAPON02")
            {
                return;
            }
            if (item.getPartsDataID().ToString() == "PARTS_WEAPON03")
            {
                return;
            }
            if (item.getPartsDataID().ToString() == "PARTS_WEAPON04")
            {
                return;
            }
            if (item.getPartsDataID().ToString() == "PARTS_WEAPON05")
            {
                return;
            }
            if (item.getPartsDataID().ToString() == "PARTS_WEAPON06")
            {
                return;
            }
        }
    }