예제 #1
0
파일: Normal.cs 프로젝트: sen866/action_lib
        public void Play(ScenarioPlayer player, IScenarioNode parent)
        {
            if (isFirst)
            {
                isFirst = false;
                player.StartNewText(Say.ToTextType(parent.GetAttribute("class").Value), parent.GetAttribute("name").Value);
            }

            while (true)
            {
                if (nextPlayTime > player.Now)
                {
                    return;
                }

                nowLength++;

                if (text.Length < nowLength)
                {
                    isPlayed = true;
                    return;
                }

                player.AddText(text.Substring(nowLength - 1, 1));

                nextPlayTime = player.Now + delay;
            }
        }
예제 #2
0
파일: Fade.cs 프로젝트: sen866/action_lib
        public void Play(ScenarioPlayer player, IScenarioNode parent)
        {
            if (startPlayTime < 0.0f)
            {
                player.StartNewText(Say.ToTextType(parent.GetAttribute("class").Value), parent.GetAttribute("name").Value);

                startPlayTime = player.Now;

                player.AddText(text);
            }

            float deltaTime = player.Now - startPlayTime;

            if (delay <= 0.0f)
            {
                player.SetOpacity(1.0f);
            }
            else
            {
                player.SetOpacity((deltaTime) / delay);
            }

            if (deltaTime >= delay)
            {
                //  再生完了
                isPlayed = true;
                return;
            }
        }