Example #1
0
        // public method

        public override void OnAnimEvent()
        {
            AnimationState animState = CutsceneController.GetAnimState(m_CC);

            //Dbg.Log("JumpTo.OnAnimEvent: current time: {0}, FC: {1}", animState.time, Time.frameCount);
            switch (m_kType)
            {
            case JumpType.Time:
            {
                CutsceneController.JumpToTime(m_CC, m_time);
                //Dbg.Log("Jumpto: {0}", m_time);
            }
            break;

            case JumpType.NormalizedTime:
            {
                //animState.normalizedTime = m_time;
                CutsceneController.JumpToTime(m_CC, m_time * animState.clip.length);
                //Dbg.Log("Jumpto normalized: {0} : {1}", m_time, m_time * animState.clip.length);
            }
            break;

            case JumpType.TimeTag:
            {
                CutsceneController.JumpToTimeTag(m_CC, m_timeTag);
                //Dbg.Log("Jumpto tag: {0}", CutsceneController.GetTimeByTag(m_CC, m_timeTag));
            }
            break;

            default:
                Dbg.LogErr("CC_JumpTo.OnAnimEvent: unexpected JumpType: {0}", m_kType);
                break;
            }
        }
        // public method

        public void SelectOption(int idx)
        {
            AnimationState astate = CutsceneController.GetAnimState(m_Dialog.CC);

            astate.speed = m_prevAnimSpeed;//resume the anim

            OneMsgOption opt  = m_AllOptions.m_Options[idx];
            string       info = opt.m_ExtraInfo;

            m_Dialog.CC.SendMessage(m_AllOptions.m_Function, info);

            enabled = false;
        }
        // unity event handlers

        void StartDialog(CC_GUI ccgui)
        {
            m_Dialog = ccgui;

            enabled = true;

            AnimationState animState = CutsceneController.GetAnimState(m_Dialog.CC);

            m_prevAnimSpeed = animState.speed;
            animState.speed = m_SetAnimSpeed; //stop the anim

            m_TimeSinceDialogStart = 0f;

            m_scrollPos = Vector2.zero;
        }
        public void OnFailed()
        {
            var            cc     = m_Dialog.CC;
            AnimationState astate = CutsceneController.GetAnimState(cc);

            Dbg.Log("OnFailed: {1}: current time: {0}", astate.time, m_Dialog.name);

            if (!string.IsNullOrEmpty(m_QTEDesc.m_FailTimeTag))
            {
                CutsceneController.JumpToTimeTag(cc, m_QTEDesc.m_FailTimeTag);
            }

            Time.timeScale = m_prevTimeScale;

            enabled = false;
            //Dbg.Log("OnFailed: {0}", m_Dialog.name);
        }