Ejemplo n.º 1
0
    private void DisplayFirstBeat(BeatData data)
    {
        Vector2   pos;
        SMSBubble newBubble;
        float     bubbleHeight;
        float     bubbleWidth;

        switch (currentSpeaker)
        {
        case Speaker.Client:

            //Create newbubble
            newBubble = DialogueManager.instance.CreateSMSBubble(smsArea);
            newBubble.SetUp(data.DisplayText, clientBubbleColor);

            //get dimension
            bubbleHeight = newBubble.GetComponent <RectTransform>().rect.height;
            bubbleWidth  = newBubble.GetComponent <RectTransform>().rect.width;

            //calculate position at the top of the screen in the client case
            pos = (Vector2)smsClientStartPosition.position + (clientSmsOffset * EssoUtility.GetAspectRatio());

            //update postion and display text
            newBubble.transform.position = pos + new Vector2(bubbleWidth / 2, -(bubbleHeight / 2) * EssoUtility.GetAspectRatio());
            previousBubble = newBubble;

            vibrationController.BeginViewBob();
            AudioManager.instance.PlayAtRandomPitch("PhoneVibrateSFX");
            smsBubbles.Add(previousBubble);
            break;

        //calculate position at the top of the screen in the mc case
        case Speaker.MainCharacter:
            newBubble = DialogueManager.instance.CreateSMSBubble(smsArea);
            newBubble.SetUp(data.DisplayText, mcBubbleColor);

            //get dimension
            bubbleHeight = newBubble.GetComponent <RectTransform>().rect.height;
            bubbleWidth  = newBubble.GetComponent <RectTransform>().rect.width;

            //calculate position at the top of the screen in the client case
            pos = (Vector2)smsMCStartPosition.position + (mcSmsOffset * EssoUtility.GetAspectRatio());

            //update postion and display text
            newBubble.transform.position = pos + new Vector2(-bubbleWidth / 2, -(bubbleHeight / 2) * EssoUtility.GetAspectRatio());
            previousBubble = newBubble;

            smsBubbles.Add(previousBubble);
            break;
        }
    }
Ejemplo n.º 2
0
    private void DisplayFirstCredit(bool isCredit, CreditData newCredit)
    {
        Vector2   pos;
        SMSBubble newBubble;
        float     bubbleHeight;
        float     bubbleWidth;

        if (isCredit)
        {
            //Create newbubble
            newBubble = CreateCreditBubble();
            newBubble.SetUp(newCredit.CreditText, credits.creditColour);

            //get dimension
            bubbleHeight = newBubble.GetComponent <RectTransform>().rect.height;
            bubbleWidth  = newBubble.GetComponent <RectTransform>().rect.width;

            //calculate position at the top of the screen in the client case
            pos = (Vector2)creditsStartPos.position + (creditBubbleOffSet * EssoUtility.GetAspectRatio());

            //update postion and display text
            newBubble.transform.position = pos + new Vector2(bubbleWidth / 2, -(bubbleHeight / 2) * EssoUtility.GetAspectRatio());
            previousBubble = newBubble;


            smsBubbles.Add(previousBubble.transform);
        }
        else
        {
            newBubble = CreateCreditBubble();
            newBubble.SetUp(newCredit.CreditText, credits.authorColour);

            //get dimension
            bubbleHeight = newBubble.GetComponent <RectTransform>().rect.height;
            bubbleWidth  = newBubble.GetComponent <RectTransform>().rect.width;

            //calculate position at the top of the screen in the client case
            pos = (Vector2)authorStartPos.position + (authorBubbleOffset * EssoUtility.GetAspectRatio());

            //update postion and display text
            newBubble.transform.position = pos + new Vector2(-bubbleWidth / 2, -(bubbleHeight / 2) * EssoUtility.GetAspectRatio());
            previousBubble = newBubble;

            smsBubbles.Add(previousBubble.transform);
        }
        vibrationController.BeginViewBob();
        //AudioManager.instance.PlayAtRandomPitch("PhoneVibrateSFX");
    }
Ejemplo n.º 3
0
    public void ClearSmsLog()
    {
        StopAllCoroutines();
        currentDialogueState = DialogueState.Idle;
        if (typingBubble.activeSelf)
        {
            typingBubble.SetActive(false);
        }

        foreach (SMSBubble bubble in smsBubbles)
        {
            Destroy(bubble.gameObject);
        }
        smsBubbles.Clear();

        previousBubble = null;
    }
Ejemplo n.º 4
0
    public SMSBubble CreateSMSBubble(Transform parent)
    {
        SMSBubble bubble = Instantiate(bubblePrefab, parent);

        return(bubble);
    }
Ejemplo n.º 5
0
    private SMSBubble CreateCreditBubble()
    {
        SMSBubble bubble = Instantiate(bubblePrefab, smsArea);

        return(bubble);
    }
Ejemplo n.º 6
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");
    }
Ejemplo n.º 7
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;
        }
    }