public void SetPointLight(bool switchOn)
 {
     if (pointlight != null)
     {
         pointlight.SetDiffuse(switchOn ? onPointLightColor : offPointLightColor);
         pointlight.setEnabled(true);
     }
 }
    public void OnStart()
    {
        offPointLightColor = new Color(0.8f, 0.0f, 0.0f, 1.0f);
        onPointLightColor  = new Color(0.0f, 0.8f, 0.0f, 1.0f);

        // Initialize into the common list
        GameObject camInMap;

        Common.AddCameraObjectToList(gameObject, out camInMap, out camInMapArea);
        CameraInMap inMapScript = GetScript <CameraInMap>(camInMapArea);

        inMapScript.SetTwin(gameObject); // Set in map to be able to direct to me (camInWorld)
        if (gameObject == Common.GetRCCarCam())
        {
            inMapScript.isActive = true; // always default RCCar to active
        }

        prevXCurrRot = xCurrRot = 0.0f;
        prevYCurrRot = yCurrRot = 0.0f;

        UpdateVectors();

        if (xRotationLimit == 0.0f && yRotationLimit == 0.0f)
        {
            shouldPhysicalCameraRotate = false;
        }

        for (uint i = 0; i < gameObject.transform.GetNumberOfChildren(); ++i)
        {
            GameObject childObj = gameObject.transform.GetChild(i).gameObject;
            if (childObj.GetName() == Common.nameForCamLight)
            {
                spotlight = childObj.RequireComponent <CLight>();
                spotlight.SetDiffuse(new Color(0.706f, 0.96f, 0.714f, 1.0f)); // FFB4FCB6
                // spotlight.SetRange(10.0f);
                // spotlight.SetSpot(10.0f);
                // spotlight.SetAtt(1.0f);
                // spotlight.SetLightType(CLight.LIGHTTYPE.SPOTLIGHT);
                spotlight.setEnabled(false);
            }
            else if (childObj.GetName() == Common.nameForCamPointLight)
            {
                pointlight = childObj.RequireComponent <CLight>();
                SetPointLight(false);
                pointlight.setEnabled(true);
            }
        }

        mSound       = gameObject.RequireComponent <CSound>();
        mCamRotateID = mSound.GetUniqueEvent("CAM_ROTATE.vente", 1);
    }
Ejemplo n.º 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);
    }
Ejemplo n.º 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);
    }