Beispiel #1
0
    public void OnStart()
    {
        GameObject panel = GameObject.GetGameObjectByName("PuzzleButton1").transform.GetChild(0).gameObject;

        panel1 = GetScript <BoobyTrapDeactivator>(panel);
        panel  = GameObject.GetGameObjectByName("PuzzleButton2").transform.GetChild(0).gameObject;
        panel2 = GetScript <BoobyTrapDeactivator>(panel);
        panel  = GameObject.GetGameObjectByName("PuzzleButton3").transform.GetChild(0).gameObject;
        panel3 = GetScript <BoobyTrapDeactivator>(panel);
        panel  = GameObject.GetGameObjectByName("PuzzleButton4").transform.GetChild(0).gameObject;
        panel4 = GetScript <BoobyTrapDeactivator>(panel);

        trapLightW        = GameObject.GetGameObjectByName("TrapLightW");
        trapLightR1       = GameObject.GetGameObjectByName("TrapLightR1");
        trapLightR1script = GetScript <PulsingLightScript>(trapLightR1);
        trapLightR2       = GameObject.GetGameObjectByName("TrapLightR2");
        trapLightR2script = GetScript <PulsingLightScript>(trapLightR2);
        trapLightR3       = GameObject.GetGameObjectByName("TrapLightR3");
        trapLightR3script = GetScript <PulsingLightScript>(trapLightR3);
        trapLightR4       = GameObject.GetGameObjectByName("TrapLightR4");
        trapLightR4script = GetScript <PulsingLightScript>(trapLightR4);

        poisonGas = GameObject.GetGameObjectByName("TSR_PoisonGas");
        gas       = poisonGas.GetComponent <CParticleEmitter>();
        gasScript = GetScript <TransformRiserScript>(poisonGas);

        GameObject boobyControllerObj = GameObject.GetGameObjectByName("TSR_TrapController");//trapControllerName);

        controllerScript = GetScript <BoobyTrapDeactivatorController>(boobyControllerObj);

        gasTimerShutdown = gas.mEmitterProperty.mMaxLifetime;

        mSound = gameObject.RequireComponent <CSound>();
    }
    public void OnStart()
    {
        GameObject panel = GameObject.GetGameObjectByName("PuzzleButton1").transform.GetChild(0).gameObject;
        panel1 = GetScript<BoobyTrapDeactivator>(panel);
        panel = GameObject.GetGameObjectByName("PuzzleButton2").transform.GetChild(0).gameObject;
        panel2 = GetScript<BoobyTrapDeactivator>(panel);
        panel = GameObject.GetGameObjectByName("PuzzleButton3").transform.GetChild(0).gameObject;
        panel3 = GetScript<BoobyTrapDeactivator>(panel);
        panel = GameObject.GetGameObjectByName("PuzzleButton4").transform.GetChild(0).gameObject;
        panel4 = GetScript<BoobyTrapDeactivator>(panel);

        trapLightW = GameObject.GetGameObjectByName("TrapLightW");
        trapLightR1 = GameObject.GetGameObjectByName("TrapLightR1");
        trapLightR1script = GetScript<PulsingLightScript>(trapLightR1);
        trapLightR2 = GameObject.GetGameObjectByName("TrapLightR2");
        trapLightR2script = GetScript<PulsingLightScript>(trapLightR2);
        trapLightR3 = GameObject.GetGameObjectByName("TrapLightR3");
        trapLightR3script = GetScript<PulsingLightScript>(trapLightR3);
        trapLightR4 = GameObject.GetGameObjectByName("TrapLightR4");
        trapLightR4script = GetScript<PulsingLightScript>(trapLightR4);

        poisonGas = GameObject.GetGameObjectByName("TSR_PoisonGas");
        gas = poisonGas.GetComponent<CParticleEmitter>();
        gasScript = GetScript<TransformRiserScript>(poisonGas);

        GameObject boobyControllerObj = GameObject.GetGameObjectByName("TSR_TrapController");//trapControllerName);
        controllerScript = GetScript<BoobyTrapDeactivatorController>(boobyControllerObj);

        gasTimerShutdown = gas.mEmitterProperty.mMaxLifetime;

        mSound = gameObject.RequireComponent<CSound>();
    }
    public void TimeIsUp()
    {
        // Set lockdown state for all buttons
        foreach (GameObject go in allPanels)
        {
            BoobyTrapDeactivator script = GetScript <BoobyTrapDeactivator>(go);
            if (script != null)
            {
                script.SetLockdownState();
            }
        }

        // Release the poison gas at full blast

        // After 2-3 sec, kill the player
        Common.GetStealthPlayerCameraScript().Kill();
    }
    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
    }
    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);
    }