Beispiel #1
0
    // This should kick back to using the comms window for the Stardater screen
    public void EndDatingChat()
    {
        isInDatingChat     = false;
        transmissionSpeech = null;
        transmissionAI     = null;

        textActive = false;
        panels.ShowInfoBgdPanelPromptOnly(1);

        dateScreen.TedExitChat();
    }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        ted     = FindObjectOfType <Teddy>();
        tedHead = FindObjectOfType <TeddyHead>();
        //dave = FindObjectOfType<Dave>();
        camMaster    = FindObjectOfType <CameraMaster>();
        cam          = GameObject.Find("RightEyeCam");
        bCam         = FindObjectOfType <BodyCam>();
        bCamCamera   = FindObjectOfType <BodyCam>().GetComponent <Camera>();
        leftEye      = FindObjectOfType <TeddyLeftEye>();
        scanner      = FindObjectOfType <InfoScan>();
        scanText     = scanner.GetComponent <Text>();
        rigid        = this.GetComponent <Rigidbody>();
        coll         = this.GetComponent <Collider>();
        commsControl = FindObjectOfType <CommsController>();
        toolSelect   = FindObjectOfType <ToolSelector>();

        rightEyeActive = false;                                                                                     // Right eye starts inactive
        rightEyeLock   = false;                                                                                     // Right eye starts locked (really??)
        tedTrack       = false;

        //rigid.velocity = Vector3.zero;
        //rigid.angularVelocity = Vector3.zero;

        sixDOF             = false;                                                                                 // Non-6dof on start
        rightLight.enabled = false;                                                                                 // Eye light off on start

        lockIndicator.enabled   = true;
        sixDOFIndicator.enabled = true;

        scanStart = 0;

        storedSpeed = rightEyeSpeed;

        scanObject         = null;
        previousTargetedID = null;
        hostID             = ted.transform.GetComponent <IDCharacter>();
        targetedGhost      = null;
        targetedSpeech     = null;
        targetedAI         = null;
        targetedAudio      = null;

        targetInfoCleared = false;

        scanFrom = null;
    }
Beispiel #3
0
 public void StartDatingChat(IDCharacter charID)
 {
     if (textActivated && charID.stardaterProfile != null && charID.transform.GetComponent <TextAndSpeech>() != null)
     {
         isInDatingChat = true;
         transmissionAI = charID.transform.GetComponent <NPCIntelligence>();
         if (charID.transform.GetComponent <AudioSource>() != null)
         {
             transmissionAudio = charID.transform.GetComponent <AudioSource>();
         }
         //transmissionAudio = dateScreen.transform.GetComponent<AudioSource>();
         transmissionSpeech   = charID.transform.GetComponent <TextAndSpeech>();
         currentLine          = charID.transform.GetComponent <TextAndSpeech>().openingStardaterLine;
         textActive           = false;
         responseText.enabled = true;
     }
 }
Beispiel #4
0
    public void Start()
    {
        _client = new DiscordClient(x =>
        {
            x.LogLevel   = LogSeverity.Info;
            x.LogHandler = Common.Log;
        });

        _client.UsingCommands(x =>
        {
            x.PrefixChar         = Convert.ToChar(Definitions.ServerDefinitions.PrefixChar.GetStringValue());
            x.AllowMentionPrefix = false;
            x.HelpMode           = HelpMode.Public;
        });

        _client.UsingAudio(x =>
        {
            x.Mode = AudioMode.Both;
        });

        CreateCommand();

        try
        {
            _client.ExecuteAndWait(async() =>
            {
                await _client.Connect(token, TokenType.Bot);

                _client.UserJoined += async(s, e) => {
                    string channelMention = Common.GetTextChannel(Definitions.TextChannels.Rules.GetStringValue()).Mention;
                    await Common.GetTextChannel(Definitions.TextChannels.ChatNChill
                                                .GetStringValue()).SendMessage($"Welcome {e.User.Mention}\nThese are our server {channelMention}\nAbide by them u **cuck**!");
                };

                isConnected = true;
                Thread.Sleep(1000);
                TextAndSpeech.InstantiateVoiceConnection();
            });
        }
        catch (ArgumentException) {
            Console.WriteLine("Press any key to stop bot.");
            Console.ReadKey();
        }
    }
Beispiel #5
0
    private void CreateCommand()
    {
        var commandService = _client.GetService <CommandService>();

        commandService.CreateCommand("whattodo")
        .Description("Gives you an option on what you should do.")
        .Do(async(e) =>
        {
            await e.Channel.SendTTSMessage("Kill yourself you f*****g pleb");
        });

        commandService.CreateCommand("say")
        .Alias(new string[] { "speak", "ghidli" })
        .Description("Searches the audio repo for a file with the specified parameter.")
        .Parameter("Phrase", ParameterType.Required)
        .Do(e =>
        {
            TextAndSpeech.Speak(e.GetArg("Phrase"), e);
        });

        commandService.CreateCommand("emote")
        .Parameter("Emote", ParameterType.Required)
        .Do(async(e) =>
        {
            string result = "";
            switch (e.GetArg("Emote").ToLower())
            {
            case "all":
                result = TextAndSpeech.StringAllEmotes();
                break;

            case "random":
                result = TextAndSpeech.GetRandomEmote();
                break;

            default:
                result = TextAndSpeech.GetEmote(e.GetArg("Emote"));
                break;
            }
            await e.Channel.SendMessage(result);
        });
    }
    // Update is called once per frame
    void Update()
    {
        if (conversationStarted && currentFriend != null && currentFriend.transform.GetComponent <TextAndSpeech>() != null)
        {
            if (!currentFriend.conversationStarted)
            {
                currentFriendSpeechControl = currentFriend.transform.GetComponent <TextAndSpeech>();

                CommsNPCInitiate();
            }
        }
        if (contactedByFriend)
        {
            NPCState = StateOfBeing.Conversing;
        }

        switch (NPCState)
        {
        case StateOfBeing.StandingStill:

            break;

        case StateOfBeing.Conversing:
            if (speakingAndWaitingToCueOtherNPC)
            {
                if (Time.time - currentSpeechLineRefTime > currentLineDuration)
                {
                    Debug.Log("cued, " + this.transform.name);
                    Debug.Log(currentFriend.name);

                    currentFriend.SpeechLineCued(currentSpeechLine.NPCresponseToThisLine);
                    speakingAndWaitingToCueOtherNPC = false;
                }
            }
            break;
        }

        ControlBlinking();
        ControlGaze();
    }
    // Start is called before the first frame update
    void Start()
    {
        // Initialize components
        faceAnim         = face.GetComponent <Animator>();
        speechController = this.transform.GetComponent <TextAndSpeech>();
        tedHead          = FindObjectOfType <TeddyHead>();

        if (this.transform.Find("Inventory") != null)
        {
            inv = this.transform.Find("Inventory").GetComponent <Inventory>();
        }
        actCoord = FindObjectOfType <ActionSceneCoordinator>();

        // Set blinking parameters
        isBlinking        = true;
        blinkRefTime      = 0;
        actualSecPerBlink = Random.Range(secPerBlink - secPerBlinkDelta, secPerBlink + secPerBlinkDelta);

        // Initialize head and eye rotations and directions
        headInitialRotation         = head.transform.rotation;
        headInitialForwardDirection = head.forward;
        headUpDirection             = head.up;
        foreach (Transform eye in eyes)
        {
            eyesInitialRotation.Add(eye.transform.rotation);
        }

        // Setting look parameters
        lookingAtPerson                = false;
        lookingAtPersonDuration        = 0;
        lookingAtPersonDurationRefTime = 0;
        turningAwayFromPerson          = false;

        // Initialize action and interaction states
        speakingAndWaitingToCueOtherNPC = false;
    }
Beispiel #8
0
    // Update is called once per frame
    void FixedUpdate()
    {
        maxIDRange = maxIDRangeFactor * (100 / bCamCamera.fieldOfView);

        if (camMaster.gamePaused)
        {
            rigid.constraints = RigidbodyConstraints.FreezeAll;
        }
        else
        {
            rigid.constraints &= ~RigidbodyConstraints.FreezePosition;
        }

        if (rightEyeLock)
        {
            if (tedTrack)
            {
                this.transform.LookAt(tedHead.transform.position);
                lockIndicator.texture   = tedTrackIcon;
                sixDOFIndicator.texture = levelTiltIcon;
            }
            else
            {
                lockIndicator.texture = eyeLockedIcon;
            }
        }
        else
        {
            lockIndicator.texture = eyeUnlockedIcon;
            if (sixDOF)
            {
                sixDOFIndicator.texture = sixDOFIcon;
            }
            else
            {
                sixDOFIndicator.texture = levelTiltIcon;
            }
        }

        //if (rightEyeLock)   {lockIndicator.enabled = true;}
        //else                {lockIndicator.enabled = false;}

        if (camMaster.reticleEnabled || !camMaster.reticleEnabled)
        {
            //lockIndicator.enabled = true;

            RaycastHit hit;
            //if (camMaster.rightEyeLodged) {
            //    scanFrom = this.transform.TransformPoint(0, 0, 15);
            //}
            //if (bCam.bodyControl && !camMaster.rightEyeLodged) {
            //    scanFrom = leftEye.transform;
            //} else {
            //    scanFrom = bCam.transform;
            //}

            scanFrom = bCam.transform;

            //if (bCam.IsHoldingDocument()) { scanner.HideReticleAndText(true); }

            if (rightEyeAbilitiesAvailable && !bCam.IsHoldingDocument() && !bCam.Using() && Physics.Raycast(scanFrom.position, scanFrom.TransformDirection(Vector3.forward),
                                                                                                            out hit, maxIDRange, Physics.DefaultRaycastLayers, QueryTriggerInteraction.Ignore))
            {
                targetInfoCleared = false;

                // Set important AI components of target, if present
                Transform targetTran;

                if (hit.collider.GetComponent <PointerToID>())
                {
                    scanObject = hit.collider.GetComponent <PointerToID>().desiredID;
                    targetTran = hit.collider.GetComponent <PointerToID>().desiredID.transform;

                    if (scanObject.GetType() == typeof(IDInteractable))
                    {
                        IDInteractable IDThing = (IDInteractable)scanObject;

                        if (hit.collider.GetComponent <PointerToID>().makeDesiredActivateThisCollider)
                        {
                            IDThing.currentSwitchCollider = hit.collider;

                            if (!IDThing.switchColliders.Contains(hit.collider))
                            {
                                IDThing.switchColliders.Add(hit.collider);
                            }

                            foreach (Collider col in hit.collider.GetComponent <PointerToID>().otherCollidersToActivate)
                            {
                                if (!IDThing.switchColliders.Contains(col))
                                {
                                    IDThing.switchColliders.Add(col);
                                }
                            }

                            IDThing.switchColliderWithPointerColliders = true;
                        }
                    }
                }
                else
                {
                    targetTran = hit.collider.transform;
                    if (targetTran.GetComponent <ID>() != null)
                    {
                        scanObject = targetTran.GetComponent <ID>();

                        scanObject.ClearSwitchColliders();
                    }
                    else
                    {
                        scanObject = null;
                    }
                }

                if (targetTran.GetComponent <Ghost>() != null)
                {
                    targetedGhost = targetTran.GetComponent <Ghost>();
                }
                else
                {
                    targetedGhost = null;
                }
                if (targetTran.GetComponent <TextAndSpeech>() != null)
                {
                    targetedSpeech = targetTran.GetComponent <TextAndSpeech>();
                }
                else
                {
                    targetedSpeech = null;
                }
                if (targetTran.GetComponent <NPCIntelligence>() != null)
                {
                    targetedAI = targetTran.GetComponent <NPCIntelligence>();
                }
                else
                {
                    targetedAI = null;
                }
                if (targetTran.GetComponent <AudioSource>() != null)
                {
                    targetedAudio = targetTran.GetComponent <AudioSource>();
                }
                else
                {
                    targetedAudio = null;
                }

                // Activating comms with a Waterman rapidly increases its alert level
                if (hit.collider.transform.GetComponent <CyclopsAI>() != null && commsControl.textActive && hit.collider.transform.GetComponent <CyclopsAI>().alertLevel < 100)
                {
                    hit.collider.transform.GetComponent <CyclopsAI>().alertLevel += Time.deltaTime * hit.collider.transform.GetComponent <CyclopsAI>().alertMultiplier;
                }

                if (scanObject != null)
                {
                    //if (!toolSelect.toolSelectorOpen) {

                    //}
                    if (previousTargetedID == scanObject)
                    {
                        if (scanObject.GetType() == typeof(IDCharacter))
                        {
                            IDCharacter idChar = (IDCharacter)scanObject;
                            foreach (Transform mark in idChar.markers)
                            {
                                if (scanObject.hacked && camMaster.reticleEnabled)
                                {
                                    mark.GetComponent <MeshRenderer>().enabled = true;
                                }
                                else
                                {
                                    mark.GetComponent <MeshRenderer>().enabled = false;
                                }
                            }
                        }
                    }

                    if (scanObject.GetType() == typeof(IDInteractable))
                    {
                        IDInteractable interactableTarget = (IDInteractable)scanObject;

                        bCam.TriggerVehicleInteriorAnimation(interactableTarget.interiorVehicleAnimationTrigger);
                    }
                    else
                    {
                        bCam.TriggerVehicleInteriorAnimation("");
                    }

                    // Display info panel for ID holder (based on ID type)
                    // Vaultable objects need the scanning entity passed into the DisplayID method--the vault command is only displayed when in range to vault
                    if (scanObject.GetType() == typeof(IDVaultObject) && camMaster.rightEyeLodged && bCam.bodyControl)
                    {
                        IDVaultObject vaultID = (IDVaultObject)scanObject;

                        vaultID.DisplayID(hostID);
                    }
                    else
                    {
                        scanObject.DisplayID();
                    }

                    previousObject     = targetTran;
                    previousTargetedID = scanObject;

                    //if (Input.GetButton("Square Button") && !camMaster.gamePaused) {
                    //    if (!scanObject.KnowDescription) {
                    //        if ((((Time.time - scanStart) * 40) > hit.collider.bounds.size.magnitude)) {
                    //            scanObject.KnowDescription = true;
                    //        }
                    //    }
                    //}
                }
                else
                {
                    if (previousTargetedID != null)
                    {
                        previousTargetedID.ClearSwitchColliders();
                    }

                    scanObject = null;

                    //if (!toolSelect.toolSelectorOpen) {
                    //    scanner.DisplayTextUsingModeColor(scanner.displayModeText);
                    //}

                    scanStart = Time.time;
                    scanner.DisableInfoPanel();

                    if (previousTargetedID != null && previousTargetedID.GetType() == typeof(IDCharacter))
                    {
                        IDCharacter idChar = (IDCharacter)previousTargetedID;
                        foreach (Transform mark in idChar.markers)
                        {
                            mark.GetComponent <MeshRenderer>().enabled = false;
                        }
                    }

                    bCam.TriggerVehicleInteriorAnimation("");
                }
            }
            else
            {
                if (previousTargetedID != null && previousTargetedID.GetType() == typeof(IDInteractable))
                {
                    IDInteractable IDThing = (IDInteractable)previousTargetedID;

                    IDThing.switchColliders.Clear();
                    IDThing.switchColliderWithPointerColliders = false;
                }

                scanObject     = null;
                targetedGhost  = null;
                targetedSpeech = null;
                targetedAI     = null;
                targetedAudio  = null;

                // If tool selector isn't up, set the reticle display text to display mode color
                //if (!toolSelect.toolSelectorOpen) {
                //    scanner.DisplayTextUsingModeColor(scanner.displayModeText);
                //}

                // Clear the info box info
                if (!bCam.IsHoldingDocument())
                {
                    scanner.DisableInfoPanel();
                }
                scanStart = Time.time;

                // If the previous target was a character, clear its markers
                if (!targetInfoCleared && previousTargetedID != null && previousTargetedID.GetType() == typeof(IDCharacter))
                {
                    IDCharacter idChar = (IDCharacter)previousTargetedID;
                    foreach (Transform mark in idChar.markers)
                    {
                        mark.GetComponent <MeshRenderer>().enabled = false;
                    }
                    targetInfoCleared = true;
                }

                bCam.TriggerVehicleInteriorAnimation("");
            }
        }
        else
        {
            scanText.enabled = false;
            //scanner.DisplayBlurb("", string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, false, false, false, false, false);                              // keeps Infoscan box from remaining when switching control away from right eye
            scanner.DisableInfoPanel();

            //lockIndicator.enabled = false;
            sixDOFIndicator.enabled = false;

            rightEyeScreen.enabled = false;
            if (!camMaster.rightEyeLodged)
            {
                rightEyeScreenPIP.enabled = true;
            }
            else
            {
                rightEyeScreenPIP.enabled = false;
            }
        }

        if (rightEyeActive)                                                                                         // If the right eye is active...
        {
            rightEyeScreen.enabled    = true;
            rightEyeScreenPIP.enabled = false;

            if (!rightEyeLock && camMaster.commsEnabled == false && !camMaster.gamePaused)                                                                                      //      If view isn't locked...

            {
                float moveX = Input.GetAxis("Left Joystick Horizontal") + Input.GetAxis("Horizontal");                                                          //          Side movement (A-D), loc x
                float moveY = 0;
                float moveZ = 0;

                if (sixDOF)
                {
                    if (Input.GetButton("Left Stick Press"))
                    {
                        moveY = Input.GetAxis("Left Joystick Vertical") + Input.GetAxis("Vertical");
                        moveZ = 0;                                                            //          Forward-back movement (W-S), loc z
                    }
                    else
                    {
                        moveY = 0;
                        moveZ = Input.GetAxis("Left Joystick Vertical") + Input.GetAxis("Vertical");
                    }
                }
                else
                {
                    moveZ = Input.GetAxis("Left Joystick Vertical") + Input.GetAxis("Vertical");
                }
                this.transform.Translate(moveX * rightEyeSpeed * Time.fixedDeltaTime,
                                         moveY * depthSpeed * Time.fixedDeltaTime,
                                         moveZ * rightEyeSpeed * Time.fixedDeltaTime, Space.Self);                       //          Translation, * rightEyeSpeed factor



                float rotX = (Input.GetAxis("Right Joystick Vertical") - Input.GetAxis("Mouse Y")) * bCamCamera.fieldOfView;                    //          Vert rotation, loc x, default inverted
                float rotY = (Input.GetAxis("Right Joystick Horizontal") + Input.GetAxis("Mouse X")) * bCamCamera.fieldOfView;                  //          Horiz rotation, loc y
                float rotZ = -Input.GetAxis("Triggers") + Input.GetAxis("Tilt");                                                                //          Tilt, loc z (inverted), for 6dof mode



                if (sixDOF)                                                                                         //          If in 6dof mode...
                {
                    this.transform.Rotate(rotX * rightEyeLookSens,
                                          rotY * rightEyeLookSens,
                                          rotZ * tiltSpeed);                                                        //              Rotation, * sens and tilt factors
                    //sixDOFIndicator.enabled = true;
                }
                else                                                                                                //          If not in 6dof mode...
                {
                    this.transform.Rotate(rotX * rightEyeLookSens, 0, 0);                                           //              Rotation, vertical, why separate??              !!!
                    this.transform.Rotate(0, rotY * rightEyeLookSens, 0, Space.World);                              //              Rotation, horizontal, why separate??            !!!

                    this.transform.localEulerAngles = new Vector3(this.transform.localEulerAngles.x,
                                                                  this.transform.localEulerAngles.y,
                                                                  0);                                           //          If not in 6dof mode, zero loc z-rot
                    //sixDOFIndicator.enabled = false;
                }
            } //else {
              //if (tedTrack) {
              //    this.transform.LookAt(ted.transform.position + new Vector3(0, 55, 0));                          //          Eye rotation follows Ted (origin + 55 y)
              //}
            //}                                                                                                       //      If view is locked...
        }
    }
Beispiel #9
0
    // Update is called once per frame
    void Update()
    {
        if (textActive)
        {
            scanner.HideReticleAndText(true);

            if ((transmissionSpeech != null && closeEnoughToCommunicate && !currentLine.continues) || (startingPrompt != null && talkingToFakeTed) || (transmissionSpeech != null && isInDatingChat))
            {
                panels.ShowInfoBgdPanel(commsDisplay.cachedTextGenerator.lineCount, responseText.cachedTextGenerator.lineCount);
            }
            //else if (transmissionID.GetType() == typeof(IDDate))    { panels.shoinfo}
            else
            {
                panels.ShowInfoBgdPanelPromptOnly(commsDisplay.cachedTextGenerator.lineCount);
            }
            commsDisplay.text = unravellingPromptText;
            responseText.text = unravellingResponseTransitionText;

            if (textIsUnravelled)
            {
                if (unravellingText)
                {
                    if (!skipUnravelling)
                    {
                        if (!unravellingTextStartTimeSet)
                        {
                            unravellingTextStartTime    = Time.time;
                            unravellingTextStartTimeSet = true;
                        }

                        canSkipUnravelling = true;

                        if (Time.time - unravellingTextTimeRef > unravellingTextTimePerChar)
                        {
                            string charString      = "";
                            int    numOfCharsToAdd = Mathf.Min(unravellingChars.Count - unravellingTextCharIndex, numOfCharsToUnravelPerInterval);
                            for (int i = 0; i < numOfCharsToAdd; i++)
                            {
                                charString = string.Concat(charString, unravellingChars[unravellingTextCharIndex + i].ToString());
                            }
                            unravellingPromptText = string.Concat(unravellingPromptText, charString);
                            if (unravellingTextCharIndex < unravellingChars.Count - 1)
                            {
                                unravellingTextCharIndex = unravellingTextCharIndex + numOfCharsToUnravelPerInterval;
                                unravellingTextTimeRef   = Time.time;
                            }
                            else
                            {
                                StopUnravellingText();
                                unravellingTextTimeRef = Time.time;

                                string hexPromptColor = ColorUtility.ToHtmlStringRGB(promptColor);
                                unravellingPromptText = "<color=#" + hexPromptColor + ">" + unravellingPromptText + "</color>";

                                // Can click through to next line if the current one is a continuation--no loading text or response text needed
                                if (currentLine.continues)
                                {
                                    readyForSelection = true;
                                }
                            }
                        }
                    }
                    else
                    {
                        canSkipUnravelling = false;

                        StopUnravellingText();
                        unravellingTextTimeRef = Time.time;

                        string hexPromptColor = ColorUtility.ToHtmlStringRGB(promptColor);
                        unravellingPromptText = "<color=#" + hexPromptColor + ">" + unravellingPromptText + "</color>";

                        if (currentLine.continues)
                        {
                            readyForSelection = true;
                        }

                        skipUnravelling = false;
                    }

                    //if (unravelingRandomChar) {
                    //    int rand;
                    //    if (unravelingTextCharIndex < unravelingChars.Count - 1) { rand = Random.Range(unravelingTextCharIndex, unravelingChars.Count); } else { rand = unravelingTextCharIndex; }

                    //    if (Time.time - unravelingTextTimeRefForRandChar > unravelingTextTimePerChar) {
                    //        //unravelingPromptText = string.Concat(unravelingPromptText, unravelingChars[rand].ToString());
                    //        unravelingPromptText = string.Concat(unravelingPromptText, "-");
                    //        unravelingRandomChar = false;
                    //        unravelingTextTimeRef = Time.time;
                    //    }
                    //} else {
                    //    if (Time.time - unravelingTextTimeRef > unravelingTextTimePerChar) {
                    //        unravelingPromptText = string.Concat(unravelingPromptText.Substring(0, unravelingPromptText.Length - 1),
                    //                unravelingChars[unravelingTextCharIndex].ToString());
                    //        if (unravelingTextCharIndex < unravelingChars.Count - 1) {
                    //            unravelingTextCharIndex++;
                    //            unravelingRandomChar = true;
                    //            unravelingTextTimeRefForRandChar = Time.time;
                    //        } else {
                    //            StopUnravellingText();
                    //        }
                    //    }
                    //}
                }

                if ((transmissionSpeech != null && closeEnoughToCommunicate) || (startingPrompt != null && talkingToFakeTed) || transmissionSpeech != null && isInDatingChat)
                {
                    // Show loading text for responses--responses load once the current prompt text is shown completely
                    // Loading text (and subsequent response text) does not show if the current prompt continues
                    if (showingLoadingText && !currentLine.continues && (Time.time - unravellingTextStartTime > delayBeforeShowingLoadingString))
                    {
                        if (Time.time - loadingTextTimeRef > loadingTextTimePerChar)
                        {
                            string charLoadingString = "";

                            for (int i = 0; i < loadingStringCharIndex; i++)
                            {
                                charLoadingString = string.Concat(charLoadingString, loadingChars[i]);
                            }

                            if (loadingStringCharIndex < loadingChars.Count - 1)
                            {
                                loadingStringCharIndex++;
                            }
                            else
                            {
                                loadingStringCharIndex = 0;
                            }

                            unravellingResponseTransitionText = charLoadingString;

                            loadingTextTimeRef = Time.time;
                        }

                        if (Time.time - unravellingTextTimeRef > totalLoadingTime)
                        {
                            showingLoadingText     = false;
                            loadingStringCharIndex = 0;
                            panels.ChooseAResponse();
                            currentResponseNumber = 0;
                            panels.MoveSelectionBar(lineCountsOfResponses[currentResponseNumber].pixelCountDistanceFromDefaultBottomPosition, lineCountsOfResponses[currentResponseNumber].lineCount);
                            readyForSelection = true;
                        }
                    }
                    if (!showingLoadingText)
                    {
                        if (responseTextIsUnravelled)
                        {
                            if (unravellingResponseText)
                            {
                                if (Time.time - unravellingResponseTextTimeRef > unravellingResponseTextTimePerChar)
                                {
                                    string charString      = "";
                                    int    numOfCharsToAdd = Mathf.Min(unravellingResponseChars.Count - unravellingResponseTextCharIndex, numOfResponseCharsToUnravelPerInterval);
                                    for (int i = 0; i < numOfCharsToAdd; i++)
                                    {
                                        charString = string.Concat(charString, unravellingResponseChars[unravellingResponseTextCharIndex + i].ToString());
                                    }
                                    unravellingResponseTransitionText = string.Concat(unravellingResponseTransitionText, charString);
                                    if (unravellingResponseTextCharIndex < unravellingResponseChars.Count - 1)
                                    {
                                        unravellingResponseTextCharIndex = unravellingResponseTextCharIndex + numOfResponseCharsToUnravelPerInterval;
                                        unravellingResponseTextTimeRef   = Time.time;
                                    }
                                    else
                                    {
                                        StopUnravellingResponseText();
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (responses.Count > 0)
                            {
                                unravellingResponseTransitionText = listOfResponses;
                            }
                        }
                    }
                }
            }
        }

        // NOTE: textActivated is toggled by player button press -- see Camera Master
        // Only makes one pass before switching to !textActivated & textActive
        if (textActivated && !textActive)
        {
            //scanner.reticle.enabled = false;
            scanner.HideReticleAndText(true);

            ClearConversationLogs();
            panels.NoSelection();

            // Shouldn't need anything here if in dating chat--everything initialized in StartDatingChat(), including rejogging the this loop by setting textActive = false
            if (isUsingStardater)
            {
                if (isInDatingChat)
                {
                }
                else
                {
                    dateScreen.EnableScreen(true);
                    transmissionSpeech = null;
                    currentLine        = stardaterTedPrompt;
                }
            }
            else
            {
                if (rightEye.RightEyeTargetID() != null)
                {
                    transmissionID = rightEye.RightEyeTargetID();

                    //if (transmissionID.transform.parent.GetComponent<Collider>() != null) {
                    //    Collider col = transmissionID.transform.parent.GetComponent<Collider>();
                    //    distance = Vector3.Distance(col.ClosestPoint(bCam.transform.position), bCam.transform.position);
                    //}
                    //else {
                    //    distance = Vector3.Distance(transmissionID.transform.parent.position, bCam.transform.position);
                    //}

                    if (transmissionID.GetDistanceToActiveIDCollider(bCam.transform.position) < transmissionID.maxDistanceToActivate)
                    {
                        closeEnoughToCommunicate = true;

                        if (transmissionID.GetType() == typeof(IDDate))
                        {
                            dateScreen.EnableScreen(true);
                            startingPrompt = stardaterTedPrompt;
                            //camMaster.OverrideReticle(true);
                        }
                        else if (transmissionID.GetType() == typeof(IDCharacter))
                        {
                            IDCharacter idChar = (IDCharacter)transmissionID;
                            if (idChar.portrait != null)
                            {
                                portrait.texture      = idChar.portrait;
                                portraitFrame.enabled = true;
                                portrait.enabled      = true;
                            }
                        }
                    }
                }

                if (rightEye.RightEyeTargetSpeech() != null)
                {
                    transmissionSpeech = rightEye.RightEyeTargetSpeech();

                    if (closeEnoughToCommunicate)
                    {
                        startingPrompt       = transmissionSpeech.openingTextLine;
                        responseText.enabled = true;
                    }
                    else
                    {
                        startingPrompt       = null;
                        responseText.enabled = false;
                    }
                }

                if (rightEye.RightEyeTargetAI() != null)
                {
                    transmissionAI = rightEye.RightEyeTargetAI();
                }

                if (rightEye.RightEyeTargetAudio() != null)
                {
                    transmissionAudio = rightEye.RightEyeTargetAudio();
                }

                if (startingPrompt != null)
                {
                    currentLine = startingPrompt;
                }
                else
                {
                    currentLine = noTargetPrompt;
                }
            }

            AssembleAndDisplayCommsText();

            commsDisplay.enabled = true;

            textActive = true;

            //textInput.ActivateInputField();

            //textInput.GetComponent<Image>().enabled = true;
            //textInput.textComponent.enabled = true;
            //panels.ShowInfoBgdPanel(commsDisplay.cachedTextGenerator.lineCount);
        }
        else if (textActive && !textActivated)
        {
            portrait.enabled      = false;
            portraitFrame.enabled = false;
            dateScreen.EnableScreen(false);
            //camMaster.OverrideReticle(false);
            //scanner.reticle.enabled = true;
            scanner.HideReticleAndText(false);
            isUsingStardater = false;
            isInDatingChat   = false;

            transmissionID     = null;
            transmissionSpeech = null;
            transmissionAI     = null;
            transmissionAudio  = null;

            panels.ShowInfoBgdPanelPromptOnly(1);
            panels.HideInfoBgdPanel();
            panels.NoSelection();
            commsDisplay.enabled = false;
            responseText.enabled = false;

            textActive = false;
            StopUnravellingText();
            StopUnravellingResponseText();

            ClearConversationLogs();
            startingPrompt = null;
            unravellingTextStartTimeSet = false;

            closeEnoughToCommunicate = false;
            talkingToFakeTed         = false;

            //textInput.DeactivateInputField();
            //textInput.GetComponent<Image>().enabled = false;
            //textInput.GetComponent<Image>().enabled = false;
            //textInput.textComponent.enabled = false;
        }
    }