public void State_lightson_Start()
    {
        MonsterEncounter1 me = GetScript <MonsterEncounter1>(GameObject.GetGameObjectByName("Monster1"));

        if (current_light == 0)
        {
            lightson.MaxTimeInState = (float)rand.NextDouble() + 0.4f;
        }

        if (current_light < lights.Count)
        {
            CLight light = lights[current_light];
            light.setEnabled(true);
            CSound sound = light.gameObject.RequireComponent <CSound>();
            sound.PlayIndependentEvent("LightTurnOn.vente", false, 1);
        }
        else
        {
            if (!me.gameObject.RequireComponent <CMeshRenderer>().isEnabled())
            {
                lightson.MaxTimeInState = (float)rand.NextDouble() * 15.0f + 5.0f;
            }
            lightson.NextState = lightsoff;
            return;
        }

        current_light++;
    }
 public void SetPointLight(bool switchOn)
 {
     if (pointlight != null)
     {
         pointlight.SetDiffuse(switchOn ? onPointLightColor : offPointLightColor);
         pointlight.setEnabled(true);
     }
 }
Beispiel #3
0
    public void TurnLightOn()
    {
        lightState = true;
        light.setEnabled(true);
        gameObject.GetComponent <CForwardRenderer>().mEmissiveColor = new Color(1.0f, 1.0f, 1.0f, 0.3f);
        sound.PlayIndependentEvent("GLASS_CRACK.vente", false, 2);

        if (trigger != null)
        {
            trigger.M4LightTurnedOn();
        }
    }
    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);
    }
    public void OnUpdate()
    {
        if (!activated || finished)
        {
            return;
        }
        //
        if (timer > 0.0f)
        {
            timer -= FrameController.DT();
            //break;
        }
        else
        {
            lightScript.activated = false;
            light.setEnabled(true);
            light.SetAtt(0.03f);
            scaryRender.setEnabled(false);
            finished = false;
        }

        //light.setEnabled(false);
    }
    public override void OnStart()
    {
        light = gameObject.GetComponentInChildren<CLight>();
        light.setEnabled(false);
        lightState = InitialLightState;
        gameObject.GetComponent<CForwardRenderer>().mEmissiveColor = new Color(0.1f,0.1f,0.1f,1.0f);
        sound = gameObject.RequireComponent<CSound>();

        GameObject tr = GameObject.GetGameObjectByName("Monster4TriggerArea");
        if (tr != null) {
            trigger = GetScript<Monster4TriggerArea>(tr);
            trigger.M4LightsToTurnOff++;
            Logger.Log("M4Light to turn on, found for M4: #" + trigger.M4LightsToTurnOff.ToString());
        }

        base.OnStart();
    }
Beispiel #7
0
    public void State_lightson_Start()
    {
        if (current_light < lights.Count)
        {
            CLight light = lights[current_light];
            light.setEnabled(true);
            CSound sound = light.gameObject.RequireComponent <CSound>();
            sound.PlayIndependentEvent("LightTurnOn.vente", false, 1);
        }
        else
        {
            if (stage == 1)
            {
                foreach (GameObject g in GameObject.GetGameObjectsWithTag("FlickerLight"))
                {
                    GetScriptClass <LightFlicker>(g).activated = true;
                }
            }

            //active monster
            lightson.MaxTimeInState = _lightson[stage];
            if (stage != 0)
            {
                MonsterEncounter1 me = GetScript <MonsterEncounter1>(GameObject.GetGameObjectByName("Level4Monster1"));
                me.Advance();
                if (me.gameObject.transform.position.z < 20)
                {
                    lightsoff.NextState      = finale;
                    lightsoff.MaxTimeInState = 5.0f;
                }
                smc.SetState(lightsoff);
            }
            else
            {
                MonsterEncounter1 me = GetScript <MonsterEncounter1>(GameObject.GetGameObjectByName("Level4Monster1"));
                me.Advance();
                smc.SetState(lightsonwait);
            }
            return;
        }

        current_light++;
    }
Beispiel #8
0
    public override void OnStart()
    {
        light = gameObject.GetComponentInChildren <CLight>();
        light.setEnabled(false);
        lightState = InitialLightState;
        gameObject.GetComponent <CForwardRenderer>().mEmissiveColor = new Color(0.1f, 0.1f, 0.1f, 1.0f);
        sound = gameObject.RequireComponent <CSound>();

        GameObject tr = GameObject.GetGameObjectByName("Monster4TriggerArea");

        if (tr != null)
        {
            trigger = GetScript <Monster4TriggerArea>(tr);
            trigger.M4LightsToTurnOff++;
            Logger.Log("M4Light to turn on, found for M4: #" + trigger.M4LightsToTurnOff.ToString());
        }

        base.OnStart();
    }
Beispiel #9
0
    public void OnStart()
    {
        sound = gameObject.RequireComponent <CSound>();

        redButton     = GameObject.GetGameObjectByName("redButton");
        greenButton   = GameObject.GetGameObjectByName("greenButton");
        blueButton    = GameObject.GetGameObjectByName("blueButton");
        consoleScreen = Common.GetSurveillancePlayerConsoleScreen();
        consoleScript = GetScript <OcuConsoleScreen>(consoleScreen);
        //lights = GameObject.GetGameObjectsWithTag("phase1light");
        GameObject doorObj = GameObject.GetGameObjectByName("Terminal1Door");

        door1Script = GetScript <DoorMain>(doorObj);
        doorObj     = GameObject.GetGameObjectByName("Terminal2Door");
        door2Script = GetScript <DoorMain>(doorObj);

        GameObject checkpoint = GameObject.GetGameObjectByName("Checkpoint1a");

        checkpointScript = GetScript <DeathCheckpointTriggerArea>(checkpoint);
        chilloutFace     = GameObject.GetGameObjectByName("chilloutface 1");
        cFace            = (chilloutFace.RequireComponent <CMeshRenderer>());

        GameObject lightObj = GameObject.GetGameObjectByName("Light1a");

        lightAtDoor = lightObj.RequireComponent <CLight>();
        lightAtDoor.setEnabled(false);

        foreach (GameObject obj in GameObject.GetGameObjectsWithTag("phase1light"))
        {
            lights.Add(obj.RequireComponent <CLight>());
        }
        sequence.Add(1); sequence.Add(3); sequence.Add(2);
        if (lights.Count == 0)
        {
        }

        geneticsAccessLeftLightObj = GameObject.GetGameObjectByName("GLD_LeftLight");
        geneticsAccessLeftLight    = geneticsAccessLeftLightObj.RequireComponent <CLight>();
    }
    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);
    }
Beispiel #11
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);
    }
    public void OnStart()
    {
        sound = gameObject.RequireComponent<CSound>();

        redButton = GameObject.GetGameObjectByName("redButton");
        greenButton = GameObject.GetGameObjectByName("greenButton");
        blueButton = GameObject.GetGameObjectByName("blueButton");
        consoleScreen = Common.GetSurveillancePlayerConsoleScreen();
        consoleScript = GetScript<OcuConsoleScreen>(consoleScreen);
        //lights = GameObject.GetGameObjectsWithTag("phase1light");
        GameObject doorObj = GameObject.GetGameObjectByName("Terminal1Door");
        door1Script = GetScript<DoorMain>(doorObj);
        doorObj = GameObject.GetGameObjectByName("Terminal2Door");
        door2Script = GetScript<DoorMain>(doorObj);

        GameObject checkpoint = GameObject.GetGameObjectByName("Checkpoint1a");
        checkpointScript = GetScript<DeathCheckpointTriggerArea>(checkpoint);
        chilloutFace = GameObject.GetGameObjectByName("chilloutface 1");
        cFace = (chilloutFace.RequireComponent<CMeshRenderer>());

        GameObject lightObj = GameObject.GetGameObjectByName("Light1a");
        lightAtDoor = lightObj.RequireComponent<CLight>();
        lightAtDoor.setEnabled(false);

        foreach (GameObject obj in GameObject.GetGameObjectsWithTag("phase1light"))
        {
            lights.Add(obj.RequireComponent<CLight>());
        }
        sequence.Add(1); sequence.Add(3); sequence.Add(2);
        if(lights.Count == 0)
        {
        }

        geneticsAccessLeftLightObj = GameObject.GetGameObjectByName("GLD_LeftLight");
        geneticsAccessLeftLight = geneticsAccessLeftLightObj.RequireComponent<CLight>();
    }