示例#1
0
    public void Draw(LIVE2DVIEWTYPE viewType = LIVE2DVIEWTYPE.STORY)
    {
        if (live2DModel == null)
        {
            return;
        }

        Update(viewType);
        live2DModel.draw();
    }
示例#2
0
    public void Update(LIVE2DVIEWTYPE viewType)
    {
        if (live2DModel == null)
        {
            Debug.Log("Can not update there is no model data");
            return;
        }

        if (mainMotionManager.isFinished())
        {
            if (viewType == LIVE2DVIEWTYPE.MAINPANLE)
            {
                EXPRESSIONTRIGERTYPE eType          = EXPRESSIONTRIGERTYPE.NORMAL;
                ExpressionInfo       expressionInfo = ClientData.GetRandomExpression(_modelId, eType);
                if (expressionInfo == null)
                {
                    return;
                }
                string  name   = ExpressionList[expressionInfo.Id];
                AMotion motion = expressions[name];

                int no = UnityEngine.Random.Range(0, MotionList.Count);
                StartMotion(L2DConst.MOTION_GROUP_IDLE, no, L2DConst.PRIORITY_IDLE, _loop);
                if (Time.realtimeSinceStartup > _setExpressionTime + _interval)
                {
                    SetExpression(name);
                }
            }
            else
            {
                StartMotion(L2DConst.MOTION_GROUP_IDLE, _currentMontionIndex, L2DConst.PRIORITY_IDLE, _loop);
            }
        }

        //-----------------------------------------------------------------
        live2DModel.loadParam();
        mainMotionManager.updateParam(live2DModel);


        //眨眼睛
        eyeBlink?.updateParam(live2DModel);
        live2DModel.saveParam();

        expressionManager.updateParam(live2DModel);

        if (physics != null)
        {
            physics.updateParam(live2DModel);
        }


        // live2DModel.update();
    }