public void ResetUponDeathOfPlayer()
    {
        // Reset all buttons back to pre-activated state
        foreach (GameObject go in allPanels)
        {
            BoobyTrapDeactivator script = GetScript <BoobyTrapDeactivator>(go);
            if (script != null)
            {
                script.Reset();
            }
        }
        playerInput.Clear();
        panels.Clear();

        trapAreaScript.isActive = true;   // Allow trap to set off again
        boobyTrapScript.ResetTrap(false); // Reset all the lights
        doorTerminalScript.UnlockDoor();  // Unlock the door again
    }
Example #2
0
    void State_Moving_Exit()
    {
        gameObject.transform.SetPositionY(endY);
        playerScript.UnlockMovement();

        if (DoorToUnlock < doors.Count)
        {
            DoorMain door = doors[DoorToUnlock];
            door.MoveDoor(true, false);
            door.UnlockDoor();
        }
    }
Example #3
0
    void PassAll()
    {
        for (int i = 0; i < allButtons.Count; ++i)
        {
            allButtons[i].Pass();
        }

        DoorMain doorMainScript = GetScript <DoorMain>(door);

        doorMainScript.UnlockDoor();

        leftLight.SetDiffuse(SharpMocha.GREEN);
        rightLight.SetDiffuse(SharpMocha.GREEN);

        mSound.PlayIndependentEvent("PINPAD_CONFIRM.vente", false, 1);

        ocuConsole.MiniGameFourPlayerEvent("", "", 0, gameObject, 0, true);
        ocuConsole.QueueMessage("Subject [REDACTED] : Deduction test completed", 0.0f, false, true);

        GameObject pz3room = GameObject.GetGameObjectByName("TrapSequenceRoom2");
        PuzzleBEnvironmentController pz3ScaryScript = GetScript <PuzzleBEnvironmentController>(pz3room);

        pz3ScaryScript.finished = true;
    }
    public bool CheckSequence(int seq, GameObject obj)
    {
        if (!sequence.accessGranted)
        {
            panels.Add(obj);
            playerInput.Add(seq);
            int isValidCode = -1;

            for (int i = 0; i < playerInput.Count; ++i)
            {
                if (playerInput[i] != sequence.validSequence[i])
                {
                    isValidCode = 0;
                    break;
                }

                if ((i + 1) == sequence.validSequence.Count)
                {
                    isValidCode = 1;
                }
            }

            if (isValidCode == 0)
            {
                foreach (GameObject go in panels)
                {
                    BoobyTrapDeactivator script = GetScript <BoobyTrapDeactivator>(go);
                    if (script != null)
                    {
                        script.ChangeState(false); // Update buttons to tween feedback
                    }
                }
                // consoleScript.QueueMessage("INVALID CODE", 0.0f, false, true);
                playerInput.Clear();
                panels.Clear();
                Common.GetConsoleScreenScript().BoobyTrapEvent(-1, gameObject, false); // -1 to signal clearing the screen

                sound.PlayIndependentEvent("BUTTON_RED.vente", false, 0);              // Access Granted sound
            }
            else // one more correct number code
            {
                Common.GetConsoleScreenScript().BoobyTrapEvent(seq, gameObject, false);
            }

            if (isValidCode == 1) // successfully finished trap
            {
                foreach (GameObject go in panels)
                {
                    BoobyTrapDeactivator script = GetScript <BoobyTrapDeactivator>(go);
                    if (script != null)
                    {
                        script.ChangeState(true); // Update buttons to tween feedback
                    }
                }
                geneticsAccessRightLight.SetDiffuse(SharpMocha.GREEN);
                doorScript.UnlockDoor();
                doorTerminalScript.UnlockDoor();
                boobyTrapScript.DeactivateTrap();

                Common.GetConsoleScreenScript().BoobyTrapEvent(seq, gameObject, true);

                playerInput.Clear();
                sequence.accessGranted = true;

                sound.PlayIndependentEvent("BUTTON_GREEN.vente", false, 0); // Access Granted sound
            }
            //consoleScript.QueueMessage(seq.ToString(), 0.0f, false, true);
        }

        ////Send message to console on progress HERE
        // consoleScript.QueueMessage("ACCESS ALREADY GRANTED", 0.0f, false, true);
        return(true);
    }
Example #5
0
    public bool AddPlayerInput(int input, GameObject obj)
    {
        if (accessGranted)
        {
            return(true);
        }

        buttons.Add(obj);
        playerSequence.Add(input);

        bool isValidCode = true;

        for (int i = 0; i < playerSequence.Count; ++i)
        {
            if (playerSequence[i] != sequence[i])
            {
                // WRONG INPUT
                playerSequence.Clear();
                isValidCode = false;

                // consoleScript.QueueMessage("INVALID CODE", 0.0f, false, true);
                break;
            }
            if (i == 2)
            {
                //Console.Write("ACCESS GRANTED!");
                accessGranted = true;
                door1Script.UnlockDoor();
                door1Script.isOneWayDoor = false; // Do not lock anymore
                door2Script.UnlockDoor();
                lightAtDoor.setEnabled(true);
                foreach (CLight light in lights)
                {
                    light.setEnabled(true);
                }
                geneticsAccessLeftLight.SetDiffuse(SharpMocha.GREEN);
                consoleScript.QueueMessage("Access sequence accepted.", 0.0f, false, true);
                buttons.Clear();

                sound.PlayIndependentEvent("BUTTON_GREEN.vente", false, 0); // Access Granted sound

                // Activate checkpoint at the door
                checkpointScript.isActive = true;
                cFace.setEnabled(true);
            }
        }
        // If incorrect, reset all buttons
        if (!isValidCode)
        {
            foreach (GameObject go in buttons)
            {
                GenericButton buttonScript = GetScript <GenericButton>(go);
                if (buttonScript != null)
                {
                    buttonScript.ResetButton();
                }
            }
            buttons.Clear();
        }

        return(isValidCode);
    }