Esempio n. 1
0
 public AnimGroup AddAnimation(TextAnimation ta)
 {
     TimeStart = Mathf.Min(TimeStart, ta.TimeStart);
     TimeEnd   = Mathf.Max(TimeEnd, ta.TimeEnd);
     TextAnims.Add(ta);
     return(this);
 }
    public virtual void objectPlaced(Entity objectRepresentation)
    {
        TextAnimation textAnimator = codeBox.GetComponentInChildren <TextAnimation>();

        if (objectCodePosition != -1)
        {
            if (objectRepresentation.Equals(objectType))
            {
                textAnimator.StartCoroutine(textAnimator.glowText(objectCodePosition));
            }
            else if (object2Type != null && objectRepresentation.Equals(object2Type))
            {
                textAnimator.StartCoroutine(textAnimator.glowText(object2CodePosition));
            }
            else
            {
                textAnimator.StartCoroutine(textAnimator.shakeText(objectCodePosition));
                if (object2Type != null)
                {
                    textAnimator.StartCoroutine(textAnimator.shakeText(object2CodePosition));
                }
            }
        }

        loadYesNoButtons();
        setButtonStatus(activateButtonsCondition(objectRepresentation));
    }
Esempio n. 3
0
        public IEnumerator Do(SharedData share, SharedVariable variable)
        {
            var fileName = share.command.parameters[0];

            var request = Resources.LoadAsync <TextAnimationData>(NovelUtility.ResourcesTextAnimationDataPath + fileName);

            yield return(request);

            var data = request.asset as TextAnimationData;

            if (null == data)
            {
                yield break;
            }

            var animator = share.view.Text.GetComponent <TextAnimator>();

            if (animator == null)
            {
                animator = share.view.Text.gameObject.AddComponent <TextAnimator>();
            }

            backup = animator.animation;
            animator.SetAnimation(data.animation);
            yield break;
        }
Esempio n. 4
0
 // Overloads for adding animations to the queue.
 #region AddAnimation Overloads
 public void AddAnimations(TextAnimation anim)
 {
     textAnimations.Add(anim);
     if (!animating)
     {
         StartCoroutine(AnimateText());
     }
 }
Esempio n. 5
0
 public void Init()
 {
     for (int i = 0; i < prewarm; ++i)
     {
         TextAnimation new_animation = NewAnimation();
         m_FreeList.Push(new_animation);
     }
 }
Esempio n. 6
0
    void Start()
    {
        loader = new JSONLoader <SegmentContainer> ();

        textAnimation = GetComponent <TextAnimation> ();
        textAnimation.animationCompleted += AnimationCompleted;

        LoadNextAnimation();
    }
Esempio n. 7
0
        TextAnimation NewAnimation()
        {
            TextAnimation new_animation = Instantiate(prefab);

            new_animation.gameObject.hideFlags = HideFlags.DontSave;
            new_animation.transform.SetParent(TextManager.Instance.transform, false);
            new_animation.gameObject.SetActive(false);
            return(new_animation);
        }
Esempio n. 8
0
    void Start()
    {
        loader = new JSONLoader <SegmentContainer> ();

        audio         = GetComponent <AudioSource> ();
        textAnimation = GetComponent <TextAnimation> ();
        textAnimation.animationCompleted += AnimationCompleted;

        StartCoroutine(LoadAudioAndAnimate());
    }
Esempio n. 9
0
        void AddList(Transform attach_transform, TextAnimation animation)
        {
            AnimationList list;

            if (m_PlayingList.TryGetValue(attach_transform, out list) == false)
            {
                list = new AnimationList();
                m_PlayingList.Add(attach_transform, list);
            }
            list.Add(animation);
        }
Esempio n. 10
0
    public void PushMessagePosition(Transform attach_transform, ICreature creature, string message, eBuffColorType color_type, eTextPushType push_type, float add_position = 0f)
    {
        if (creature.IsShowText == false)
        {
            return;
        }

        TextAnimation ta = Message.Push(attach_transform, creature.TextOffset, message, push_type, 1f, add_position);

        ta.Text.color = CharacterBuff.GetColor(color_type);
    }
Esempio n. 11
0
    public void PushMessage(ICreature creature, string message, eBuffColorType color_type, eTextPushType push_type, float add_position = 0f)
    {
        if (creature.IsShowText == false)
        {
            return;
        }

        Transform     attach_transform = creature.Character.transform;
        float         scale            = attach_transform.GetComponent <Character>().Creature.Scale;
        TextAnimation ta = Message.Push(attach_transform, creature.TextOffset, message, push_type, scale, add_position);

        ta.Text.color = CharacterBuff.GetColor(color_type);
    }
    public virtual void screenPlaced(Entity screenRepresentation)
    {
        TextAnimation textAnimator = codeBox.GetComponentInChildren <TextAnimation>();

        if (variableCodePosition != -1)
        {
            if (!screenRepresentation.Equals(variableType))
            {
                textAnimator.StartCoroutine(textAnimator.shakeText(variableCodePosition));
            }
            else
            {
                textAnimator.StartCoroutine(textAnimator.glowText(variableCodePosition));
            }
        }
    }
Esempio n. 13
0
        TextAnimation GetFree(Transform attach_transform)
        {
            TextAnimation animation = null;

            if (m_FreeList.Count > 0)
            {
                animation = m_FreeList.Pop();
            }
            else
            {
                animation = NewAnimation();
            }
            animation.gameObject.SetActive(true);

            return(animation);
        }
Esempio n. 14
0
        public TextAnimation Push(Transform attach_transform, float text_offset, string text, eTextPushType push_type, float scale, float add_position)
        {
            switch (push_type)
            {
            case eTextPushType.Critical:
            case eTextPushType.CriticalDot:
                text = "CRITICAL\n" + text;
                break;
            }

            TextAnimation new_obj = GetFree(attach_transform);

            new_obj.Init(attach_transform, text_offset, text, push_type, scale, add_position);
            AddList(attach_transform, new_obj);

            return(new_obj);
        }
Esempio n. 15
0
 void AnimationCompleted(TextAnimation animation)
 {
     LoadNextAnimation();
 }
Esempio n. 16
0
    //public void DeactivateExpiredBuffs()
    //{
    //    // Deactivate expired buffs in UI
    //    // PartyUnit unit = GetComponent<PartyUnit>();
    //    UnitBuffIndicator[] buffsUI = GetUnitBuffsPanel().GetComponentsInChildren<UnitBuffIndicator>();
    //    foreach (UnitBuffIndicator buffUI in buffsUI)
    //    {
    //        // First decrement buff current duration
    //        buffUI.DecrementCurrentDuration();
    //        // Verify if it has timed out;
    //        if (buffUI.GetCurrentDuration() == 0)
    //        {
    //            // buff has timed out
    //            // deactivate it (it will be destroyed at the end of animation)
    //            buffUI.SetActiveAdvance(false);
    //            // deactivate it in unit properties too
    //            LPartyUnit.UnitBuffs[(int)buffUI.GetUnitBuff()] = UnitBuff.None;
    //        }
    //    }
    //}

    public void TriggerAppliedUniquePowerModifiers()
    {
        //Debug.Log("TriggerAppliedDebuffs");
        //UnitDebuffIndicator[] debuffsIndicators = GetUnitDebuffsPanel().GetComponentsInChildren<UnitDebuffIndicator>();
        ////UnitDebuffsUI unitDebuffsUI = unit.GetUnitDebuffsPanel().GetComponent<UnitDebuffsUI>();
        //foreach (UnitDebuffIndicator debuffIndicator in debuffsIndicators)
        //{
        //    Debug.Log(name);
        //    // as long as we cannot initiate all debuffs at the same time
        //    // we add debuffs to the queue and they will be triggered one after another
        //    // CoroutineQueue queue = unitDebuffsUI.GetQueue();
        //    // CoroutineQueue queue = transform.root.GetComponentInChildren<UIManager>().GetComponentInChildren<BattleScreen>(true).Queue;
        //    //if (queue == null)
        //    //{
        //    //    Debug.LogError("No queue");
        //    //}
        //    //if (debuffIndicator == null)
        //    //{
        //    //    Debug.LogError("No debuffIndicator");
        //    //}
        //    IEnumerator coroutine = debuffIndicator.TriggerDebuff(this);
        //    //if (coroutine == null)
        //    //{
        //    //    Debug.LogError("No coroutine");
        //    //}
        //    CoroutineQueueManager.Run(coroutine);
        //    // Trigger debuff against player
        //    // Decrement buff current duration
        //    debuffIndicator.DecrementCurrentDuration();
        //}
        // Loop through all UPMs on this party unit in backwards order (so we can remove items in a loop)
        for (int i = LPartyUnit.AppliedUniquePowerModifiersData.Count - 1; i >= 0; i--)
        {
            // get UPM config
            UniquePowerModifierConfig uniquePowerModifierConfig = LPartyUnit.AppliedUniquePowerModifiersData[i].GetUniquePowerModifierConfig();
            // verify if trigger condition matches
            if (uniquePowerModifierConfig.TriggerCondition == TriggerCondition.AtTurnStart)
            {
                // Gget UPM text animation config upfront, because UPMdata may be removed if unit is dead after Trigger
                TextAnimation upmTextAnimation = uniquePowerModifierConfig.UniquePowerModifierStausIconUIConfig.onTriggerTextAnimation;
                // Trigger UPM
                LPartyUnit.AppliedUniquePowerModifiersData[i].GetUniquePowerModifierConfig().Trigger(LPartyUnit, LPartyUnit.AppliedUniquePowerModifiersData[i]);
                // trigger animation to display damage done
                upmTextAnimation.Run(UnitInfoPanelText);
                // verify if unit is still alive
                if (LPartyUnit.UnitStatus != UnitStatus.Dead)
                {
                    // verify if UPM duration left is 0
                    if (LPartyUnit.AppliedUniquePowerModifiersData[i].DurationLeft == 0)
                    {
                        // UPM has expired
                        // trigger UPM removed event
                        //LPartyUnit.UnitEvents.uniquePowerModifierHasBeenRemovedEvent.Raise(LPartyUnit.UniquePowerModifiersData[i]);
                        LPartyUnit.AppliedUniquePowerModifiersData[i].GetUniquePowerModifierConfig().UniquePowerModifier.Events.DataHasBeenRemovedEvent.Raise(LPartyUnit.AppliedUniquePowerModifiersData[i]);
                        // remove it from the list
                        LPartyUnit.AppliedUniquePowerModifiersData.RemoveAt(i);
                    }
                }
                else
                {
                    // all UPMs data already should be removed in party unit UnitHealthCurr property
                    // exit this loop
                    break;
                }
            }
        }
    }
Esempio n. 17
0
 /// <summary>
 /// アニメーションデータの上書き設定
 /// </summary>
 public void SetAnimation(TextAnimation animation)
 {
     this.animation = animation;
 }
Esempio n. 18
0
 public void OnClickStart()
 {
     TextAnim = TextAnimation.TypeOn(TestText, "This is a test string!", 3.0f);
 }
Esempio n. 19
0
 private void ChooseRandomAnimation()
 {
     switch (Global.Random.Next (2)) {
     case 0:
         currentAnimation = TextAnimation.Appear;
         break;
     case 1:
         currentAnimation = TextAnimation.AppearAurekBesh;
         break;
     }
 }
Esempio n. 20
0
        private bool DoAnimation()
        {
            if (!runningAnimation)
                return true;
            if (pauseAnimation > 0) {
                pauseAnimation--;

                if (delayBlink < 1) {
                    delayBlink = 3;
                    if (cursorIsVisible)
                        theBox.BackgroundColor = Color.Transparent;
                    else
                        theBox.BackgroundColor = theColor;
                    cursorIsVisible = !cursorIsVisible;
                } else
                    delayBlink--;

                return true;
            }
            if (!cursorIsVisible) {
                theBox.BackgroundColor = theColor;
                cursorIsVisible = !cursorIsVisible;
            }
            try {

                switch (currentAnimation) {

                case TextAnimation.Wait:
                    if (delayBeforeNextAnimation < 1) {
                        delayBeforeNextAnimation = Global.Random.Next (3) * 10;
                        ChooseRandomAnimation ();
                    } else {
                        delayBeforeNextAnimation--;
                    }
                    break;

                case TextAnimation.Appear:
                    if (currentPos > theText.Length)
                        return true;
                    currentPos++;
                    if (currentPos > 1)
                        labelText.Text = theText.Substring (0, currentPos - 1);
                    else
                        labelText.Text = " ";
                    if (currentPos <= theText.Length)
                        labelAnim.Text = theText.Substring (currentPos - 1, 1);
                    else {
                        labelAnim.Text = " ";
                        DoPauseAnimation ();
                        currentAnimation = TextAnimation.Disappear;
                    }
                    break;

                case TextAnimation.AppearAurekBesh:
                    if (currentPos > theText.Length)
                        return true;
                    currentPos++;
                    if (currentPos <= theText.Length)
                        labelAnim.Text = theText.Substring (0, currentPos);
                    else {
                        DoPauseAnimation ();
                        currentAnimation = TextAnimation.DisappearAurekBesh;
                    }
                    break;

                case TextAnimation.Disappear:
                    if (currentPos < 1)
                        return true;
                    currentPos--;
                    if (currentPos > 1)
                        labelText.Text = theText.Substring (0, currentPos - 1);
                    else {
                        labelText.Text = " ";
                        currentAnimation = TextAnimation.Wait;
                    }
                    break;

                case TextAnimation.DisappearAurekBesh:
                    if (currentPos < 1)
                        return true;
                    currentPos--;
                    if (currentPos > 1)
                        labelAnim.Text = theText.Substring (0, currentPos - 1);
                    else {
                        labelAnim.Text = " ";
                        currentAnimation = TextAnimation.Wait;
                    }
                    break;

                }

            } catch (Exception) {
            }
            return true;
        }
Esempio n. 21
0
            void Optimize()
            {
                if (m_List.Count <= 1)
                {
                    return;
                }

                float push_time                  = m_List[0].PushTime;
                float push_position_normal       = m_List[0].PushPosition;
                float push_position_critical     = m_List[0].PushPositionCritical;
                float push_position_critical_dot = m_List[0].PushPositionCriticalDot;
                float push_position_dot          = m_List[0].PushPositionDot;

                float         last_time      = -10f;
                float         last_position  = 0f;
                eTextPushType last_push_type = eTextPushType.Normal;

                for (int i = m_List.Count - 1; i >= 0; --i)
                {
                    TextAnimation animation = m_List[i];
                    if (animation.IsPlaying == false)
                    {
                        continue;
                    }

                    bool is_optimize = false;
                    if (push_time > 0f)
                    {
                        float time = animation.PlaybackTime;
                        if (time - last_time < push_time)
                        {
                            animation.PlaybackTime = last_time + push_time;
                            is_optimize            = true;
                        }
                        last_time = animation.PlaybackTime;
                    }

                    float local_push_position = 0f;
                    if (i != m_List.Count - 1)
                    {
                        switch (last_push_type)
                        {
                        case eTextPushType.Dot:         local_push_position += push_position_dot; break;

                        case eTextPushType.Critical:    local_push_position += push_position_critical; break;

                        case eTextPushType.CriticalDot:    local_push_position += push_position_critical_dot; break;

                        default:                        local_push_position += push_position_normal; break;
                        }
                    }
                    switch (animation.PushType)
                    {
                    case eTextPushType.Dot: local_push_position += push_position_dot; break;

                    case eTextPushType.Critical: local_push_position += push_position_critical; break;

                    case eTextPushType.CriticalDot: local_push_position += push_position_critical_dot; break;

                    default: local_push_position += push_position_normal; break;
                    }

                    if (local_push_position > 0f)
                    {
                        float pos = animation.CurrentPosition;
                        if (pos - last_position < local_push_position)
                        {
                            animation.AddPosition += last_position + local_push_position - pos;
                            last_position          = animation.CurrentPosition;
                            is_optimize            = true;
                        }
                        else
                        {
                            last_position = pos;
                        }
                    }
                    last_push_type = animation.PushType;

                    if (is_optimize == true)
                    {
                        animation.Sample();
                    }
                }
            }
Esempio n. 22
0
 void AnimationCompleted(TextAnimation animation)
 {
     LoadAudioAndAnimate();
 }
Esempio n. 23
0
 private void PlayEventActions(Events coroutineEvent, int index)
 {
     StartCoroutine(TextAnimation.TextAnimator(delay, textBox, coroutineEvent.eventText[index]));
     narrator.clip = coroutineEvent.eventAudio[index];
     narrator.Play();
 }
Esempio n. 24
0
 public void Add(TextAnimation animation)
 {
     m_List.Add(animation);
     Optimize();
 }
Esempio n. 25
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.R))
        {
            SceneManager.LoadScene(SceneManager.GetActiveScene().name);
        }


        if (Input.GetKeyDown(KeyCode.Space))
        {
            if (_timeCounter > 0)
            {
                _runCounter = true;
            }
        }

        if (Input.GetKeyDown(KeyCode.O))
        {
            audiosource.PlayOneShot(audiosource.clip);
        }


        // FIKSE KNAPPER
        if (Input.GetKeyDown(KeyCode.Minus))
        {
            _timeCounter -= 10;

            if (GameHasRunOnce == false)
            {
                startTime = _timeCounter;
            }
        }

        if (Input.GetKeyDown(KeyCode.Plus))
        {
            _timeCounter += 10;

            if (GameHasRunOnce == false)
            {
                startTime = _timeCounter;
            }
        }

        int min = Mathf.FloorToInt(_timeCounter / 60);
        int sec = Mathf.FloorToInt(_timeCounter % 60);

        TimerText.text = min.ToString("00") + ":" + sec.ToString("00");

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Application.Quit();
        }


        if (_runCounter)
        {
            GameHasRunOnce = true;
            HeartAnimator.SetBool("runbeat", true);



            _timeCounter -= Time.deltaTime;

            if (_timeCounter <= 0)
            {
                _timeCounter   = 0;
                TimerText.text = "00:00";
                _runCounter    = false;
                audiosource.PlayOneShot(audiosource.clip);
                skiftpladser.SetActive(true);
                HeartAnimator.Stop();

                SliderGO.gameObject.SetActive(false);
                TimerText.gameObject.SetActive(false);
            }

            if (_timeCounter <= 11 && _timeCounter > 0)
            {
                TextAnimation.SetTrigger("panic");
                TimerText.color = Color.red;
            }



            SliderGO.value = (startTime - _timeCounter) / startTime;
        }
    }