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
    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.º 3
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.º 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();
    }
    // private bool gameLoaded = false;

    public override void load(Action completion)
    {
        SettingsController.instance.setTriggerFilters();
        StartCoroutine(loadReadableDialog(completion));
        RelayCentre.addSubscriber(gameObject, Message.ReloadTriggers, reloadAndFilterTriggers);

        completion();
    }
    public override void load(Action completion)
    {
        loadSettings();

        RelayCentre.addSubscriber(gameObject, Message.SaveGame, saveSettings);
        RelayCentre.addSubscriber(gameObject, Message.LoadGame, loadSettings);

        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
 }
    void OnEnable()
    {
        if (!setup)
        {
            RelayCentre.addSubscriber(gameObject, Message.TriggerFilterUpdated, updateText);
            setup = true;
        }

        updateText();
    }
Ejemplo n.º 13
0
    public override void load(Action completion)
    {
        changeToDefaultCursor();

        RelayCentre.addSubscriber(gameObject, Message.LoadDidCompleteNotification, () =>
        {
            setCursorActiveState(true);
        });
        completion();
    }
Ejemplo n.º 14
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);
 }
    void addObservers()
    {
        RelayCentre.addSubscriber(gameObject, Message.GameWillBeginNotification, () => {
            gamePlaying = true;
        });

        RelayCentre.addSubscriber(gameObject, Message.MenuButtonHit, switchMenu);
        RelayCentre.addSubscriber(gameObject, Message.TimeOutCancel, () =>
        {
            timer = 0;
        });
    }
Ejemplo n.º 16
0
    public override void load(Action completion)
    {
        menu.SetActive(true);
        menuButton.SetActive(false);
        loadMenuScreen("Loading");

        RelayCentre.addSubscriber(gameObject, Message.GameLoaded, loadMainMenu);
        RelayCentre.addSubscriber(gameObject, Message.PauseGame, loadMainMenu);
        RelayCentre.addSubscriber(gameObject, Message.SettingsControllerLoaded, loadSettings);

        completion();
    }
Ejemplo n.º 17
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;
        }
    }
Ejemplo n.º 21
0
    void loadObservers()
    {
        RelayCentre.addSubscriber(gameObject, Message.GameWillBeginNotification, () => {
            setInput(true);
        });

        RelayCentre.addSubscriber(gameObject, Message.DialogStarted, () => {
            setInput(false);
        });

        RelayCentre.addSubscriber(gameObject, Message.DialogFinished, () => {
            setInput(true);
        });

        RelayCentre.addSubscriber(gameObject, Message.PauseGame, () => {
            setInput(false);
        });
    }
    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.º 24
0
 public void pauseGame()
 {
     RelayCentre.postMessage(Message.PauseGame);
 }
Ejemplo n.º 25
0
 void OnDisable()
 {
     RelayCentre.removeSubscriber(gameObject, Message.BackButtonHit);
 }
Ejemplo n.º 26
0
 public void leaveTriggerSettings()
 {
     SettingsController.instance.setTriggerFilters();
     RelayCentre.postMessage(Message.ReloadTriggers);
 }
Ejemplo n.º 27
0
 void OnEnable()
 {
     RelayCentre.addSubscriber(gameObject, Message.BackButtonHit, goBack);
 }
Ejemplo n.º 28
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.º 30
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);
    }