public Paragraph grabRandomParagraph()
    {
        if (paragraphsToReadFrom.Count < 1)
        {
            //Charlie: if we're in demo mode we uh, might wanna reset the dialog
            // but we also don't wanna end up in an infinite loooooop
            if (GameController.instance.demoMode)
            {
                SaveController.instance.resetContent();
                RelayCentre.postMessage(Message.ReloadTriggers);

                if (paragraphsToReadFrom.Count < 1)
                {
                    //look, I guess we're not finding one right now
                    return(null);
                }

                return(findTheRandomParagraph());
            }

            return(null);
        }

        return(findTheRandomParagraph());
    }
Ejemplo n.º 2
0
    IEnumerator checkWalking()
    {
        //first we need to wait to move
        while (agent.velocity == Vector3.zero)
        {
            yield return(null);
        }

        startWalkingSounds();

        //now we need to wait till we have stopped
        while (agent.velocity != Vector3.zero)
        {
            RelayCentre.postMessage(Message.TimeOutCancel);
            yield return(null);
        }

        RelayCentre.postMessage(Message.TimeOutCancel);

        stopWalkingSounds();

        if (furnitureId != null)
        {
            //now we can interact
            interactWithFurniture(furnitureId);
            furnitureId = null;
        }
    }
Ejemplo n.º 3
0
    void Update()
    {
        if (loaded)
        {
            cursorInput();
        }

        if (takingInput)
        {
            checkInput();

            checkHighlighting();

            //Charlie: replace this with a specific key check I guess
            if (Input.GetKeyUp(KeyCode.Escape))
            {
                RelayCentre.postMessage(Message.MenuButtonHit);

                RelayCentre.postMessage(Message.TimeOutCancel);
            }
        }

        // if(loaded)
        // {
        //  cursorInput();
        // }

        CursorController.instance.updateCursorPos(cursorPosition);
    }
Ejemplo n.º 4
0
    void checkInput()
    {
        // Charlie: replace this with uh, mouse click I think
        if (Input.GetMouseButtonUp(0))
        {
            RelayCentre.postMessage(Message.TimeOutCancel);

            furnitureId = null;
            StopCoroutine("checkWalking");

            RaycastHit hit;
            Ray        ray = mainCam.ScreenPointToRay(cursorPosition);

            if (Physics.Raycast(ray, out hit))
            {
                if (hit.collider == null)
                {
                    return;
                }
                else if (hit.transform.tag == "Floor" || hit.transform.tag == "Furniture")
                {
                    agent.SetDestination(hit.point);

                    if (hit.transform.tag == "Furniture")
                    {
                        furnitureId = hit.transform.GetComponent <FurnitureID> ();
                    }

                    StartCoroutine("checkWalking");
                }
            }
        }
    }
    void loadNext()
    {
        for (int i = 0; i < loadingObjects.Length; i++)
        {
            if (loadingObjects[i].completed)
            {
                // Debug.Log("already completed " + loadingObjects[i].key);
                continue;
            }

            int index = i;
            loadingObjects[i].loadingObject.load(() => {
                loadingObjects[index].completed = true;
                LoadingBarController.instance.segmentLoaded(grabSegmentFromKey(loadingObjects[index].key));
                // Debug.Log("we've completed " + loadingObjects[index].key);
                loadNext();
            });
            // Debug.Log("And breaking");
            return;             //this should break the function until we have completed everything
        }

        // Debug.Log("we've completed everything");

        gameHasLoaded = true;

        RelayCentre.postMessage(Message.LoadDidCompleteNotification);
        RelayCentre.postMessage(Message.GameLoaded);

        Debug.Log("Booting: We have finished loading");
    }
    public override void load(Action completion)
    {
        fillTriggerSettingsList();

        RelayCentre.postMessage(Message.SettingsControllerLoaded);
        completion();
    }
    IEnumerator addParagraphsAsReadable(List <Paragraph> paragraphs, Action completion = null)
    {
        for (int i = 0; i < paragraphs.Count; i++)
        {
            //we should filter out triggers
            List <Triggers> filterOut = SettingsController.instance.getTriggersToFilter();
            bool            remove    = false;
            for (int t = 0; t < filterOut.Count; t++)
            {
                Debug.Log("Hello a trigger here is " + filterOut[t]);
                if (paragraphs[i].hasTrigger(filterOut[t]))
                {
                    remove = true;

                    break;
                }
                //Charlie: okay like, maybe have these once the game has f*****g loaded aye
                // if(gameLoaded) yield return null;
            }

            if (!remove)
            {
                List <string> keysUsed = SaveController.instance.settings.dialogKeysRead;

                for (int a = 0; a < keysUsed.Count; a++)
                {
                    if (keysUsed[a] == paragraphs[i].key)
                    {
                        remove = true;
                    }

                    // if(gameLoaded) yield return null;
                }

                if (!remove)
                {
                    DialogHolder.instance.addReadableParagraph(paragraphs[i]);
                }
            }

            LoadingBarController.instance.updateLoading(paragraphs.Count, i);

            // yield return null;
        }

        yield return(null);

        loading = false;
        Debug.Log("Data Reading: Finished");

        RelayCentre.postMessage(Message.DialogLoaded);

        if (completion != null)
        {
            completion();
        }
    }
    Paragraph findTheRandomParagraph()
    {
        int index = Random.Range(0, paragraphsToReadFrom.Count);

        SaveController.instance.settings.addDialogKeyRead(paragraphsToReadFrom[index].key);
        RelayCentre.postMessage(Message.SaveGame);

        return(paragraphsToReadFrom[index]);
    }
 void switchMenu()
 {
     if (gamePlaying)
     {
         gamePlaying = false;
         RelayCentre.postMessage(Message.PauseGame);
     }
     //TODO: maybe also add to switch from menu back into game
 }
Ejemplo n.º 10
0
 public void setWithdrawalsTrigger(bool filterOut)
 {
     SettingsController.instance.setTriggerSettings("Withdrawals", filterOut);
     if (GameController.instance.gameHasLoaded)
     {
         SettingsController.instance.setTriggerFilters();
     }
     loadSettings();
     SaveController.instance.saveSettings();
     RelayCentre.postMessage(Message.TriggerFilterUpdated);
 }
Ejemplo n.º 11
0
    public void changeFontToTelegrama(bool selected)
    {
        if (!selected)
        {
            return;
        }

        changeFont("Telegrama");
        SaveController.instance.settings.setBool("Font_Arial", false);
        SaveController.instance.settings.setBool("Font_OpenDyslexic", false);
        SaveController.instance.settings.setBool("Font_Telegrama", true);
        RelayCentre.postMessage(Message.SaveGame);
    }
    public void setTriggerFilters()
    {
        triggersToFilter.Clear();

        for (int i = 0; i < triggerSettings.Count; i++)
        {
            if (triggerSettings[i].filterOut)
            {
                triggersToFilter.Add(triggerSettings[i].trigger);
            }
        }

        SaveController.instance.settings.resetTriggersToFilter(triggersToFilter);
        RelayCentre.postMessage(Message.SaveGame);
    }
    //we'll do more with this later
    public void startDialog(Paragraph paragraph)
    {
        dialogIndex         = 0;
        currentParagraph    = paragraph;
        writingText         = false;
        waitingForNextClick = false;
        dialogOver          = false;
        RelayCentre.postMessage(Message.DialogStarted);

        string dialogBoxToUse = SettingsController.instance.getDialogBoxToUse();

        MenuController.instance.loadDialogScreen(dialogBoxToUse);
        displaySentence();

        RelayCentre.postMessage(Message.TimeOutCancel);
    }
    void click()
    {
        RelayCentre.postMessage(Message.TimeOutCancel);

        if (trailerActive)
        {
            if (dialogOver)
            {
                string dialogBoxToUse = SettingsController.instance.getDialogBoxToUse();
                MenuController.instance.hideDialogScreen(dialogBoxToUse);
                RelayCentre.postMessage(Message.DialogFinished);
                RelayCentre.postMessage(Message.NextTrailerPiece);
                trailerActive = false;
                return;
            }
        }

        if (writingText)
        {
            if (typeTextCached != null)
            {
                StopCoroutine(typeTextCached);
            }
            textObject.text     = currentParagraph.sentences[dialogIndex];
            writingText         = false;
            waitingForNextClick = true;
            return;
        }

        if (dialogOver)
        {
            string dialogBoxToUse = SettingsController.instance.getDialogBoxToUse();
            MenuController.instance.hideDialogScreen(dialogBoxToUse);
            RelayCentre.postMessage(Message.DialogFinished);
            RelayCentre.postMessage(Message.NextTrailerPiece);
            return;
        }

        if (waitingForNextClick)
        {
            dialogIndex++;
            waitingForNextClick = false;
            displaySentence();
            return;
        }
    }
    public void noMoreDialog()
    {
        dialogIndex         = 0;
        writingText         = false;
        waitingForNextClick = false;
        RelayCentre.postMessage(Message.DialogStarted);

        string dialogBoxToUse = SettingsController.instance.getDialogBoxToUse();

        MenuController.instance.loadDialogScreen(dialogBoxToUse);

        dialogOver = true;

        string[] splitText = new string[1];
        splitText[0]   = "Oh, I don't have anything else to say";
        typeTextCached = typeText(splitText);
        StartCoroutine(typeTextCached);
    }
    void displaySentence()
    {
        if (dialogIndex >= currentParagraph.sentences.Count)
        {
            string dialogBoxToUse = SettingsController.instance.getDialogBoxToUse();
            MenuController.instance.hideDialogScreen(dialogBoxToUse);

            RelayCentre.postMessage(Message.DialogFinished);
            RelayCentre.postMessage(Message.NextTrailerPiece);
            return;
        }

        string textToSplit = currentParagraph.sentences[dialogIndex];

        string[] splitText = textToSplit.Split(' ');

        typeTextCached = typeText(splitText);
        StartCoroutine(typeTextCached);
    }
Ejemplo n.º 17
0
 //GAME PLAY STUFF I GUESS
 public void startGame()
 {
     closeMenu();
     StartCoroutine("startTheGame");
     RelayCentre.postMessage(Message.TimeOutCancel);
 }
 public void resetDialogRead()
 {
     dialogKeysRead.Clear();
     RelayCentre.postMessage(Message.ReloadTriggers);
 }
Ejemplo n.º 19
0
    //lil hack to delay us starting to take input
    //pretty sure I fixed this, but hey
    private IEnumerator startTheGame()
    {
        yield return(null);

        RelayCentre.postMessage(Message.GameWillBeginNotification);
    }
Ejemplo n.º 20
0
 public void pauseGame()
 {
     RelayCentre.postMessage(Message.PauseGame);
 }
Ejemplo n.º 21
0
 public void leaveTriggerSettings()
 {
     SettingsController.instance.setTriggerFilters();
     RelayCentre.postMessage(Message.ReloadTriggers);
 }