Ejemplo n.º 1
0
        protected override void TriggerParticals(Vector2 pos, int amount)
        {
            for (int i = 0; i < amount; i++)
            {
                Partical p = GenerateParticalProperties(
                    Vector2.Transform(new Vector2(_random.Next(0, (int)Radius), 0),
                                      Matrix.CreateRotationZ((float)_random.NextDouble() * MathHelper.TwoPi)));
                switch (Function)
                {
                case EmmiterFunction.Explosive:
                    p.Velocity = p.Position;
                    p.Velocity.Normalize();
                    p.Velocity *= ParticalSpeed.GetValue();
                    break;

                case EmmiterFunction.Implosive:
                    p.Velocity = -p.Position;
                    p.Velocity.Normalize();
                    p.Velocity *= ParticalSpeed.GetValue();
                    break;
                }
                p.Position = p.Position + pos;
                Particals.Add(p);
            }
        }
Ejemplo n.º 2
0
    IEnumerator DoShowMessages()
    {
        var messageFeed = SocialMediaScenarioPicker.Instance.CurrentScenario.GetSMSMessageFeed(smsFeed);

        yield return(new WaitForSeconds(initialDelay));

        foreach (var message in messageFeed.messages)
        {
            yield return(new WaitForSeconds(timeBetweenMessages.GetValue()));

            var iconIndex   = 0;
            var messageText = message.message;

            if (messageText.StartsWith("["))
            {
                int.TryParse(message.message.Substring(1, 1), out iconIndex);

                messageText = messageText.Substring(3);
            }

            iconIndex = Mathf.Clamp(iconIndex, 0, appIcons.Length);

            notificationSender.ShowNotification(appNames[iconIndex].CurrentValue, message.profile.username, messageText, timeOnScreen, appIcons[iconIndex]);

            yield return(new WaitWhile(() => notificationSender.IsNotificationShowing));
        }

        onComplete?.Invoke();
    }
    IEnumerator PlaySounds()
    {
        while (true)
        {
            yield return(new WaitForSeconds(timeBetweenSounds.GetValue()));

            AudioSource.PlayClipAtPoint(sounds.RandomItem(), transform.position, volume);
        }
    }
Ejemplo n.º 4
0
    void OnEventTriggered()
    {
        var clip = clips[Random.Range(0, clips.Length)];

        if (changePitch)
        {
            source.pitch = pitch.GetValue();
        }

        source.PlayOneShot(clip);
    }
Ejemplo n.º 5
0
    IEnumerator TypeText()
    {
        for (int i = 0; i < textToShow.Length; i++)
        {
            textObject.text = textToShow.Substring(0, i + 1);
            EventManager.TriggerEvent(Events.KeyboardTextTyped);
            EventManager.TriggerEvent(Events.KeyboardTextTyped, new TextTypedEventArgs(textObject.text[textObject.text.Length - 1].ToString()));

            yield return(new WaitForSeconds(timeBetweenCharacters.GetValue()));
        }

        typingCompleted?.Invoke();
    }
    IEnumerator DisplayMessages()
    {
        int lastMessageShown = 0;

        while (loop || lastMessageShown < messageFeed.messages.Count)
        {
            DisplayMessage(messageFeed.messages[lastMessageShown]);
            lastMessageShown = (lastMessageShown + 1) % messageFeed.messages.Count;

            if (!forceComplete)
            {
                yield return(new WaitForSeconds(timeBetweenMessages.GetValue()));
            }
        }
    }
Ejemplo n.º 7
0
    protected virtual IEnumerator TypeText()
    {
        if (textToEnter == null)
        {
            textToEnter = SocialMediaScenarioPicker.Instance.CurrentScenario.GetText(textToEnterType);
        }

        for (int i = 0; i < textToEnter.Length; i++)
        {
            TypeCharacter(i + 1);

            yield return(new WaitForSeconds(timeBetweenCharacters.GetValue()));
        }

        OnTypingFinished();
    }
Ejemplo n.º 8
0
    IEnumerator DisplayMessages()
    {
        while (!messageFeed)
        {
            yield return(null);
        }

        if (randomiseOrder)
        {
            messageOrder = new int[messageFeed.messages.Count];
            for (int i = 0; i < messageOrder.Length; i++)
            {
                messageOrder[i] = i;
            }
            RandomiseItems();
        }

        int lastMessageShown = startingMessage;

        bool stopScrolling = false;

        int subMessageStart = -1;


        while (lastMessageShown < messageFeed.messages.Count || loop)
        {
            int index = lastMessageShown;

            if (randomiseOrder)
            {
                index = messageOrder[index];
            }

            Message subMessage = null;
            if (subMessageStart >= 0)
            {
                subMessage = LinkedViewForSubMessages.messageFeed.messages[subMessageStart++];
                if (subMessage.highlight)
                {
                    subMessage      = null;
                    subMessageStart = -1;
                }
            }

            if (!messageFeed.messages[index].skip)
            {
                yield return(DisplayMessage(messageFeed.messages[index], true, subMessage));
            }
            lastMessageShown++;

            if (stopScrolling)
            {
                scrollToBottom = false;
                stopScrolling  = false;
                ScrollToHighlightedMessage();
            }

            if (stopScrollingAfterHighlighed && messageFeed.messages[index].highlight)
            {
                stopScrolling = true;
            }

            if (messageFeed.messages[index].pauseHere)
            {
                paused = true;
                //forceComplete = false;
                onPaused?.Invoke();
                timeScale = timeScaleAfterPause;

                if (LinkedViewForSubMessages)
                {
                    subMessageStart = 0;
                    foreach (var message in LinkedViewForSubMessages.messageFeed.messages)
                    {
                        subMessageStart++;
                        if (message.pauseHere || message.startOfSubMessages)
                        {
                            break;
                        }
                    }
                }

                yield return(new WaitUntil(() => !paused));

                yield return(new WaitForSeconds(afterPauseDelay));
            }

            if (highlightLastItem && lastMessageShown == messageFeed.messages.Count)
            {
                HighlightLastMessage();
            }

            float timeToWait = timeBetweenMessages.GetValue() * timeScale / 10;

            // Split it up into groups of 10, in case force complete is set so it doesn't have to wait the whole time
            for (int i = 0; i < 10; i++)
            {
                if (!forceComplete)
                {
                    yield return(new WaitForSeconds(timeToWait));
                }
            }

            if (loop && messageFeed.messages.Count <= lastMessageShown)
            {
                lastMessageShown = 0;

                if (randomiseOrder)
                {
                    RandomiseItems();
                }
            }
        }

        IsDone = true;
        OnComplete?.Invoke();
    }
Ejemplo n.º 9
0
    IEnumerator DisplayMessages()
    {
        if (initialDleay > 0)
        {
            yield return(new WaitForSeconds(initialDleay));
        }

        int lastMessageShown = 0;

        while (lastMessageShown < images.Length)
        {
            if (timeBetweenMessages.max > 0 && !forceUpToPause)
            {
                yield return(new WaitForSeconds(timeBetweenMessages.GetValue()));
            }

            int index = lastMessageShown;

            var item = Instantiate(prefab, stackChildren.transform);
            item.gameObject.SetActive(true);
            item.transform.GetChild(0).GetComponent <Image>().sprite = images[index];

            item.rectTransform.sizeDelta = new Vector2(item.rectTransform.sizeDelta.x, images[index].textureRect.height);

            if (placeOnTop)
            {
                item.transform.SetSiblingIndex(1);
            }

            if (stackChildren)
            {
                stackChildren.Resize();
            }

            if (scrollToBottom && rect)// && (Time.time - lastScrollTime > timeBetweenMessages.min * 0.75f))
            {
                rect.verticalNormalizedPosition = placeOnTop ? 1 : 0;

                if (rectDetector)
                {
                    rectDetector.Restart();
                }
            }

            if (pauseAfter == lastMessageShown)
            {
                isPaused       = true;
                forceUpToPause = false;
                onPause?.Invoke();

                yield return(new WaitWhile(() => isPaused));
            }

            lastMessageShown++;

            if (lastMessageShown >= images.Length)
            {
                item.GetComponent <HighlightImage>().enabled = false;
                item.GetComponent <Image>().color            = colour;
            }
        }

        IsDone = true;
        onComplete?.Invoke();
    }