Esempio n. 1
0
    private IEnumerator waitThenRestart(float seconds, string token)
    {
        yield return(new WaitForSeconds(seconds));

        ConversationTrigger.AddToken(token);
        enablePlayerControl();
    }
Esempio n. 2
0
 // activate the fuser and then run the Fuser interface
 // script for before any batteries have been collected
 public void ActivateFuserFirstLook()
 {
     fuserActive = true;
     fuserStatic.SetActive(true);
     ConversationTrigger.AddToken("gear_fuser");
     StartCoroutine(firstLookAtFuser());
 }
Esempio n. 3
0
    IEnumerator enableInterfaceWait()
    {
        yield return(new WaitForSeconds(1f));

        //destroy pyramid and start anew
        eventSystem.GetComponent <CreatePartTutorial1>().clearPartsCreated();
        //enable part buttons
        foreach (Button b in partButtons)
        {
            b.interactable = true;
        }
        //enable clickability of black regions on all parts
        foreach (GameObject a in attachments)
        {
            BoxCollider bcollide = a.GetComponent <BoxCollider>();
            if (bcollide == null)
            {
                a.GetComponent <MeshCollider>().enabled = true;
            }
            else
            {
                bcollide.enabled = true;
            }
        }
        yield return(new WaitForSeconds(1f));

        ConversationTrigger.AddToken("dreshaEnabledInterface");
    }
Esempio n. 4
0
    IEnumerator waitThenAddToken(string token, float seconds)
    {
        yield return(new WaitForSeconds(seconds));

        ConversationTrigger.AddToken(token);
        Debug.Log("Added token " + token + " successfully!");
    }
Esempio n. 5
0
    //disables/enables connect-related conversation tokens
    //to prevent infinite triggers since they aren't oneshots
    //called every time Connect button is invoked once player has control
    public void resetConnectTokens()
    {
        //BRANCH: if attaching works, go to conversation playerAttachToFinish
        //			if attaching is wrong rotation, go to conversation tryRotatingAgain
        //			if attaching is wrong shape, go to conversation tryDifferentShape
        //	These triggers are NOT oneshots
        if (triggersFinished[17])
        {
            string fuseStatus = fuseEvent.getFuseStatus();
            ConversationTrigger.RemoveToken("playerRotationIncorrect");            // to stop infinite triggers
            ConversationTrigger.RemoveToken("wrongRotationDreshaReadyToFlashObj"); // to stop infinite triggers
            ConversationTrigger.RemoveToken("blockTryRotatingAgain2");             // to stop infinite triggers
            ConversationTrigger.RemoveToken("playerAttachedWrongFace");            // to stop infinite triggers
            ConversationTrigger.RemoveToken("wrongFaceDreshaReadyToFlashBox");     // to stop infinite triggers
            ConversationTrigger.RemoveToken("playerAttachedSuccessfully");
            ConversationTrigger.RemoveToken("wrongRotationDreshaFlashedObj");      // to stop infinite triggers

            if (fuseStatus.Equals("wrongFace"))
            {
                // player tried to attach but selected the wrong FuseTo
                // Dresha will now tell player to select a different FuseTo
                ConversationTrigger.AddToken("playerAttachedWrongFace");                 // convo tryDifferentShape
            }
            else if (fuseStatus.Equals("wrongRotation"))
            {
                // player tried to attach but rotation wasn't right
                // Dresha will now tell player to try a different rotation
                ConversationTrigger.AddToken("playerRotationIncorrect");                 // convo tryRotatingAgain
            }
            else if (fuseStatus.Equals("success"))
            {
                ConversationTrigger.AddToken("playerAttachedSuccessfully");                 //this triggers a one-shot
            }
        }
    }
Esempio n. 6
0
    // Called when an item is picked up. Prepares the tokens for saving.
    public static void ConvertInventoryToTokens()
    {
        // Remove all current inventory tokens. (anything containing "item|")
        List <string> toRemove = new List <string>();           // Need a list because you cannot modify a hashset while iterating over it.

        foreach (string ii in ConversationTrigger.tokens)
        {
            if (ii.Contains("item|"))
            {
                toRemove.Add(ii);
            }
        }
        foreach (string ii in toRemove)
        {
            ConversationTrigger.RemoveToken(ii, false);
        }

        // Create and add the tokens to model the inventory.
        // "item|PATH|COUNT"
        List <string> toAdd = new List <string>();              // Need a list because you cannot modify a hashset while iterating over it.

        foreach (KeyValuePair <string, InvItem> ii in items)
        {
            string newToken = "item|";
            newToken += ii.Value.pickup.GetComponent <PickUp>().prefabPath;
            newToken += "|";
            newToken += ii.Value.quantity;
            toAdd.Add(newToken);
        }
        foreach (string ii in toAdd)
        {
            ConversationTrigger.AddToken(ii, false);
        }
        SaveController.Save();
    }
    // Enable the text box, supplying a trigger. This is generally better when possible, since it will set name / escape rule.
    public static void Enable(ConversationTrigger trigger)
    {
        // Make sure we didn't lose our ref somehow...
        if (textBox == null || textBox.isActiveAndEnabled == false)
        {
            textBox         = thisObject.GetComponentInChildren <ScrollingText>();
            textBox.enabled = true;
        }

        // Make sure the dictionary is prepped if a "bad" key is given.
        if (!ConversationsDB.convos.ContainsKey(trigger.conversationName))
        {
            ConversationsDB.LoadConversationsFromFiles();
        }
        textBox.ApplyConversation(ConversationsDB.convos[trigger.conversationName]);
        currentConversationName = trigger.conversationName;
        currentEscRule          = trigger.allowEscape;
        if (trigger.conversationName == "nowhere")
        {
            SoftDisable();
            return;
        }
        SetStarterName(trigger.nameOfStarter);
        FakeActive(thisObject, true);
        currentlyEnabled = true;
        AllowMouse();

        // Oneshot destroys the trigger and marks it with a token so it never comes back again. Ever.
        // You'll have to delete the save file to have it trigger again.
        if (trigger.oneShot)
        {
            Destroy(trigger);
            ConversationTrigger.AddToken("oneShot_" + trigger.conversationName);
        }
    }
Esempio n. 8
0
 // Update is called once per frame
 void Update()
 {
     // show timer and number of rotations remaining at top
     if (!displayedTimerAndRotations && ConversationTrigger.GetToken("finishedConst_21"))
     {
         displayedTimerAndRotations             = true;
         timeRemainingPanel.alpha               = 1;
         rotationsRemainingPanel.alpha          = 1;
         timeRemainingPanel.blocksRaycasts      = true;
         rotationsRemainingPanel.blocksRaycasts = true;
     }
     // draw player's attention to the timer and rotation limit
     else if (!flashedTimerAndRotations && ConversationTrigger.GetToken("finishedConst_22"))
     {
         flashedTimerAndRotations = true;
         StartCoroutine(showImageAndAddToken(arrowToTimePanel, SHOW_IMAGE_DURATION, "finishedFlashingTimerAndRotations"));
         StartCoroutine(showImage(arrowToRotationsPanel, SHOW_IMAGE_DURATION));
         highlighter.HighlightTimed(timeRemainingPanel.gameObject, 2);
         highlighter.HighlightTimed(rotationsRemainingPanel.gameObject, 2);
     }
     // player just clicked Ready! answer, so start countdown
     else if (!startedCountdown && ConversationTrigger.GetToken("finishedConst_23"))
     {
         ConversationTrigger.AddToken("doneWithBeginningConvo");
         startedCountdown = true;
         // do countdown
         // as soon as countdown finishes, enable player controls with one flash
         StartCoroutine(doCountdownAndEnableControls());
     }
     // if player runs out of time or rotations, start level over
     // should put checks for this in timer and rotation panels, replace BatteryIndicator with them
     // in RotationGizmo stuff
 }
Esempio n. 9
0
 private void enablePartButtons()
 {
     ConversationTrigger.AddToken("dreshaFlashedPartButtons");
     foreach (Button b in partButtons)
     {
         b.enabled = true;
     }
 }
Esempio n. 10
0
    IEnumerator rotateTwiceWrongPartScript()
    {
        Highlighter.Unhighlight(zUp);
        rotationScript.runManualRotation(b1p1, 0, 0, -90);
        yield return(new WaitForSeconds(2f));

        ConversationTrigger.AddToken("finishedRotatingTwiceWrongPart");
    }
Esempio n. 11
0
    IEnumerator pointToBlackRegionsWait()
    {
        selectPart.selectObject(GameObject.Find("pyr_box_attach"));
        selectPart.selectFuseTo(GameObject.Find("box_tri_attach"));
        yield return(new WaitForSeconds(1f));

        ConversationTrigger.AddToken("dreshaPointedToBlackRegions");
    }
Esempio n. 12
0
 void Start()
 {
     GetComponentInChildren <Text>().text = choiceText;
     GetComponent <Button>().onClick.AddListener(() =>           // Adds an event to the button
     {
         ConversationController.Enable(choicePointer);
         ConversationTrigger.AddToken(choiceToken);
     });
 }
Esempio n. 13
0
    IEnumerator showImageAndAddToken(Image imgToFlash, float time, string token)
    {
        imgToFlash.enabled = true;
        yield return(new WaitForSeconds(time));

        imgToFlash.enabled = false;

        ConversationTrigger.AddToken(token);
    }
Esempio n. 14
0
    private IEnumerator waitAndThenAddToken(float seconds, string token)
    {
        //this, combined with the doneRestarting token from the opening conversation, will start the
        //level countdown after the opening conversation is complete
        // if there is no opening conversation, simply add the line
        // ConversationTrigger.AddToken("doneRestarting")
        yield return(new WaitForSeconds(seconds));

        ConversationTrigger.AddToken(token);
    }
Esempio n. 15
0
    private IEnumerator resetConstruction()
    {
        tryAgainButton.gameObject.SetActive(false);
        rechargingText.enabled = true;
        // simple ... progress animation for recharging text
        // takes 3 seconds for recharging animation to complete
        StartCoroutine(rechargingAnimation());

        // put starting part back to where it was
        Debug.Log("Setting " + startingPart + " position to " + startingPartOffscreenPos + "!");
        startingPart.transform.SetPositionAndRotation(startingPartOffscreenPos, startingPartRotation);

        // reset victoryPrefab, otherwise it does weird stuff once level is complete
        fuseEvent.resetVictoryPrefab();

        // and reset camera
        cameraControls.gameObject.transform.SetPositionAndRotation(new Vector3(-90, 45, -3.36f), Quaternion.Euler(0, 0, 0));

        // and reset the number of rotations, time remaining, and fuseCount
        rotationsRemainingPanel.GetComponent <RotationCounter>().resetRotations();
        if (timeRemainingPanel != null)
        {
            timeRemainingPanel.GetComponent <Timer>().resetTimer();
        }
        fuseEvent.resetFuseCount();
        yield return(new WaitForSeconds(4f));

        screenFader.fadeIn(0.5f);
        //flicker screen back in
        //       flickeringTime = 0.5f;
        //       while (flickeringTime > 0)
        //       {
        //           flickerLength = Random.Range(0.01f, 0.1f);
        //           fadeOutScreen.enabled = false;
        //           yield return new WaitForSeconds(flickerLength);
        //           fadeOutScreen.enabled = true;
        //           flickeringTime -= flickerLength;
        //      }
        //      fadeOutScreen.enabled = false;

        if (tutorial != null)
        {
            tutorial.enableTooltips();
        }
        yield return(new WaitForSeconds(1f));

        Debug.Log("Starting zoom up animation!");

        StartCoroutine(startingPartZoomUp());

        //Dresha talks and part zooms up
        yield return(new WaitForSeconds(1f));

        ConversationTrigger.AddToken("letsRestart");
    }
Esempio n. 16
0
 private void enableControlsAndAddToken(string token)
 {
     highlightGizmo(4f);
     for (int i = 0; i < partButtons.Length; i++)
     {
         highlighter.HighlightTimed(partButtons[i].gameObject, 4f);
     }
     highlighter.HighlightTimed(fuseButton.gameObject, 4f);
     highlighter.HighlightTimed(controlsButton.gameObject, 4f);
     ConversationTrigger.AddToken(token);
 }
Esempio n. 17
0
    IEnumerator highlightGizmoWait()
    {
        // maybe should highlight only the sliders instead?
        foreach (Transform child in rotationGizmo.transform)
        {
            highlighter.HighlightTimed(child.gameObject, 2);
        }
        yield return(new WaitForSeconds(1f));

        ConversationTrigger.AddToken("dreshaFlashedGizmo");
    }
Esempio n. 18
0
    IEnumerator createPyrWait()
    {
        yield return(new WaitForSeconds(0.5f));

        eventSystem.GetComponent <CreatePartTutorial1>().createPyr();
        rotationScript.Disable();
        GameObject.Find("pyr_box_attach").GetComponent <BoxCollider>().enabled = false;
        yield return(new WaitForSeconds(1f));

        ConversationTrigger.AddToken("dreshaCreatedPyr");
    }
Esempio n. 19
0
    IEnumerator rotatePyrWait()
    {
        yield return(new WaitForSeconds(0.5f));

        pyramid = GameObject.Find("tutorial1_pyrPrefab(Clone)");
        rotationScript.runManualRotation(pyramid, 0f, -90f, 0f);
        rotationScript.runManualRotation(pyramid, 0f, 0f, -90f);
        yield return(new WaitForSeconds(1f));

        ConversationTrigger.AddToken("dreshaRotatedPyr");
    }
Esempio n. 20
0
 //does nothing when Pyr button is clicked subsequent times
 public void playerClicksAPartButton()
 {
     if (!partButtonClicked)
     {
         partButtonClicked = true;
         foreach (Button b in partButtons)
         {
             Highlighter.Unhighlight(b.gameObject);
         }
         ConversationTrigger.AddToken("playerClicksPyrButton");
     }
 }
Esempio n. 21
0
    IEnumerator tryAttachPyrWait()
    {
        yield return(new WaitForSeconds(1f));

        fuseEvent.initiateFuse();
        //deselect the active part
        selectPart.resetSelectedObject();
        //deselect tri FuseTo
        selectPart.resetSelectedFuseTo();
        yield return(new WaitForSeconds(1f));

        ConversationTrigger.AddToken("dreshaTriedToAttach");
    }
Esempio n. 22
0
    // called when player clicks the "Put Away Fuser" button
    public void putAwayFuserAndStartTask()
    {
        putAwayButton.gameObject.SetActive(false);
        lowPowerText.enabled = false;
        Deselect();

        //disable mouse cursor
        ConversationController.LockMouse();
        enablePlayerControl();

        screenFader.fadeIn(0.2f);
        ConversationTrigger.AddToken("findBatteries");
    }
Esempio n. 23
0
    void Update()
    {
        // Ability to cancel a conversation.
        if (Input.GetKeyDown(KeyCode.Escape) && currentEscRule)
        {
            Disable();
        }

        if (Input.GetKeyDown(KeyCode.I) && currentConversationName == "tokenTest")
        {
            ConversationTrigger.AddToken("hardInstantTest");
        }
    }
Esempio n. 24
0
    IEnumerator rotateWrongPartScript()
    {
        b1p1 = GameObject.Find("b1p1Prefab(Clone)");
        Highlighter.Highlight(yUp);
        yield return(new WaitForSeconds(2f));

        Highlighter.Unhighlight(yUp);
        rotationScript.runManualRotation(b1p1, 0, 90, 0);
        yield return(new WaitForSeconds(2f));

        Highlighter.Highlight(zUp);

        ConversationTrigger.AddToken("finishedRotatingOnceWrongPart");
    }
Esempio n. 25
0
    // Update is called once per frame
    void Update()
    {
        if (!triggersFinished[0] && ConversationTrigger.tokens.Contains("dreshaReadyToFlashFinishedImage2"))
        {
            triggersFinished[0] = true;
            // first event: Dresha flashes finished image, which triggers next convo
            highlighter.HighlightTimed(finishedImage, 2);
            ConversationTrigger.AddToken("dreshaFlashedFinishedImage2");
        }
        else if (!triggersFinished[1] && ConversationTrigger.tokens.Contains("dreshaReadyToFlashPartButtons"))
        {
            triggersFinished[1] = true;
            // second event: Dresha flashes part buttons
            highlightPartButtons(1f);
            enablePartButtons();
        }
        else if (ConversationTrigger.GetToken("wrongRotationDreshaReadyToFlashObj"))
        {
            // Dresha flashes selected obj and then lets the player try again
            highlightSelectedObj(1f);
            ConversationTrigger.AddToken("dreshaFlashedSelectedObj2");
        }
        else if (ConversationTrigger.GetToken("playerAttachedWrongFace") && !ConversationTrigger.GetToken("wrongFaceDreshaReadyToFlashBox"))
        {
            // wrong shape - Dresha just finished tryDifferentShape1 and
            // will now flash box and part menu for 2 seconds
            highlightPartButtons(2f);
            highlighter.HighlightTimed(GameObject.Find("longbox"), 2);
        }
        else if (ConversationTrigger.GetToken("showNextLevelButton2"))
        {
            StartCoroutine(waitAndEnableGoToNextLevel());
        }

        if (fuseEvent.done() && !done)
        {
            // player wins!
            // Dresha talks about next level
            // next level should not load until player finishes this convo

            //move conversation box to center
            //conversationSystem.GetComponent<RectTransform>().pivot = new Vector2(0.5f,1);
            //conversationSystem.GetComponent<RectTransform>().anchorMin = new Vector2(0.5f,1);
            //conversationSystem.GetComponent<RectTransform>().anchorMax = new Vector2(0.5f,1);
            //conversationSystem.GetComponent<RectTransform>().localPosition = new Vector3(0, 0, 0);

            // wait till convo is finished to display congrats text
            ConversationTrigger.AddToken("showNextLevelButton2");
        }
    }
Esempio n. 26
0
    IEnumerator rotateWrongRotationScript()
    {
        Highlighter.Highlight(yDown);
        yield return(new WaitForSeconds(2f));

        rotationScript.runManualRotation(b1p2, 0, -90, 0);
        yield return(new WaitForSeconds(2f));

        Highlighter.Unhighlight(yDown);
        rotationScript.runManualRotation(b1p2, 0, -90, 0);
        yield return(new WaitForSeconds(2f));

        ConversationTrigger.AddToken("finishedRotatingWrongRotation");
    }
Esempio n. 27
0
    private IEnumerator readLog()
    {
        // start log display
        ConversationTrigger.AddToken("read_fuser_log");

        // wait till conversation finishes
        while (!ConversationTrigger.GetToken("show_locate_button"))
        {
            yield return(new WaitForFixedUpdate());
        }

        //once convo is finished, Locate Hidden Materials button appears, triggered
        // by token given by read fuser log conversation
        locateButton.gameObject.SetActive(true);
    }
Esempio n. 28
0
    IEnumerator rotateWrongFaceScript()
    {
        b1p2 = GameObject.Find("b1p2Prefab(Clone)");
        Highlighter.Highlight(zDown);
        yield return(new WaitForSeconds(2f));

        rotationScript.runManualRotation(b1p2, 0, 0, 90);
        yield return(new WaitForSeconds(2f));

        Highlighter.Unhighlight(zDown);
        rotationScript.runManualRotation(b1p2, 0, 0, 90);
        yield return(new WaitForSeconds(2f));

        ConversationTrigger.AddToken("finishedRotatingWrongFace");
    }
Esempio n. 29
0
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Player")
     {
         if (tokenRequired == "")
         {
             ConversationTrigger.AddToken("reachedLevel_" + levelName);
             LoadUtils.LoadNewExplorationLevel(levelName, spawnPosition);
         }
         else if (ConversationTrigger.GetToken(tokenRequired))
         {
             ConversationTrigger.AddToken("reachedLevel_" + levelName);
             LoadUtils.LoadNewExplorationLevel(levelName, spawnPosition);
         }
     }
 }
Esempio n. 30
0
    private IEnumerator waitThenContinueFailure(float waitSeconds, float fadeSeconds)
    {
        yield return(new WaitForSeconds(waitSeconds));

        screenFader.fadeOut(fadeSeconds);
        powerFailureText.enabled = false;
        errorPanel.alpha         = 0;
        yield return(new WaitForSeconds(fadeSeconds));

        itemPartCounter.resetCounter();
        taggedFirstPart = false;

        //untagAllPartsInLevel();

        ConversationTrigger.AddToken("outOfPower");
    }