Exemple #1
0
    public void DisplayCredit(bool isCredit, CreditData newCredit)
    {
        Vector2   pos;
        SMSBubble newBubble;
        float     bubbleHeight = previousBubble.GetComponent <RectTransform>().rect.height;;
        float     newBubbleHeight;
        float     newBubbleWidth;

        if (isCredit)
        {
            //set up sms bubbles
            newBubble = CreateCreditBubble();
            newBubble.SetUp(newCredit.CreditText, credits.creditColour);

            //get bubble dimensions
            newBubbleHeight = newBubble.GetComponent <RectTransform>().rect.height;
            newBubbleWidth  = newBubble.GetComponent <RectTransform>().rect.width;

            //Spawn new bubble with an offset of its previous position + the offset of it's height from its centre
            pos = new Vector2(creditsStartPos.position.x + newBubbleWidth / 2, previousBubble.transform.position.y - bubbleHeight / 2 - newBubbleHeight / 2)
                  + (creditBubbleOffSet + bubbleOffset) * EssoUtility.GetAspectRatio();

            //Update position
            newBubble.transform.position = pos;
            previousBubble = newBubble;

            smsBubbles.Add(previousBubble.transform);

            if (pos.y < screenEndPoint.position.y)
            {
                float vertDistance = screenEndPoint.position.y - pos.y;
                ScrollUnitsUp(vertDistance + newBubbleHeight / 2);
            }
        }
        else
        {
            //set up sms bubbles
            newBubble = CreateCreditBubble();
            newBubble.SetUp(newCredit.CreditText, credits.authorColour);

            //get bubble dimensions
            newBubbleHeight = newBubble.GetComponent <RectTransform>().rect.height;
            newBubbleWidth  = newBubble.GetComponent <RectTransform>().rect.width;

            //Spawn new bubble with an offset of its previous position + the offset of it's height from its centre
            pos = new Vector2(authorStartPos.position.x - newBubbleWidth / 2, previousBubble.transform.position.y - bubbleHeight / 2 - newBubbleHeight / 2)
                  + (authorBubbleOffset + bubbleOffset) * EssoUtility.GetAspectRatio();

            //Update position
            newBubble.transform.position = pos;
            previousBubble = newBubble;

            smsBubbles.Add(previousBubble.transform);
            if (pos.y < screenEndPoint.position.y)
            {
                float vertDistance = screenEndPoint.position.y - pos.y;
                ScrollUnitsUp(vertDistance + newBubbleHeight / 2);
            }
        }
        vibrationController.BeginViewBob();
        AudioManager.instance.PlayAtRandomPitch("PhoneVibrateSFX");
    }
Exemple #2
0
    private void DisplaySmsBubble(BeatData data)
    {
        Vector2   pos;
        SMSBubble newBubble;
        float     bubbleHeight = previousBubble.GetComponent <RectTransform>().rect.height;;
        float     newBubbleHeight;
        float     newBubbleWidth;

        switch (currentSpeaker)
        {
        case Speaker.Client:
            //set up sms bubbles
            newBubble = DialogueManager.instance.CreateSMSBubble(smsArea);
            newBubble.SetUp(data.DisplayText, clientBubbleColor);

            //get bubble dimensions
            newBubbleHeight = newBubble.GetComponent <RectTransform>().rect.height;
            newBubbleWidth  = newBubble.GetComponent <RectTransform>().rect.width;

            //Spawn new bubble with an offset of its previous position + the offset of it's height from its centre
            pos = new Vector2(smsClientStartPosition.position.x + newBubbleWidth / 2, previousBubble.transform.position.y - bubbleHeight / 2 - newBubbleHeight / 2)
                  + (clientSmsOffset + bubbleOffset) * EssoUtility.GetAspectRatio();

            //Update position
            newBubble.transform.position = pos;
            previousBubble = newBubble;

            smsBubbles.Add(previousBubble);

            if (pos.y < smsScreenEndPoint.position.y)
            {
                float vertDistance = smsScreenEndPoint.position.y - pos.y;
                ScrollUnitsUp(vertDistance + newBubbleHeight / 2);
            }
            vibrationController.BeginViewBob();
            AudioManager.instance.PlayAtRandomPitch("PhoneVibrateSFX");

            break;

        case Speaker.MainCharacter:
            //set up sms bubbles
            newBubble = DialogueManager.instance.CreateSMSBubble(smsArea);
            newBubble.SetUp(data.DisplayText, mcBubbleColor);

            //get bubble dimensions
            newBubbleHeight = newBubble.GetComponent <RectTransform>().rect.height;
            newBubbleWidth  = newBubble.GetComponent <RectTransform>().rect.width;

            //Spawn new bubble with an offset of its previous position + the offset of it's height from its centre
            pos = new Vector2(smsMCStartPosition.position.x - newBubbleWidth / 2, previousBubble.transform.position.y - bubbleHeight / 2 - newBubbleHeight / 2)
                  + (mcSmsOffset + bubbleOffset) * EssoUtility.GetAspectRatio();

            //Update position
            newBubble.transform.position = pos;
            previousBubble = newBubble;

            smsBubbles.Add(previousBubble);
            if (pos.y < smsScreenEndPoint.position.y)
            {
                float vertDistance = smsScreenEndPoint.position.y - pos.y;
                ScrollUnitsUp(vertDistance + newBubbleHeight / 2);
            }

            break;
        }
    }