// Update is called once per frame
    void Update()
    {
        cpuEnabled = cameraManager.valuesINeedSaved(); //Returns whether the cpu camera is active or not

        int timeThisFrame = timeManager.time;


        //-------------------------------------------------------------------------------------------------------------------------------------------------------------
        if (timeManager.timeUpdated)
        {
            if (timeThisFrame > 0 && !stationInitialized)
            {
                inventoryChanger.Give(InventoryChanger.BETASTORAGE_ONE_INVENTORY, InventoryManager.ERK_ITEM);
                inventoryChanger.Give(InventoryChanger.BETASTORAGE_ONE_INVENTORY, InventoryManager.ERK_ITEM);
                inventoryChanger.Give(InventoryChanger.BETASTORAGE_ONE_INVENTORY, InventoryManager.BATTERY_ITEM);
                inventoryChanger.Give(InventoryChanger.BETASTORAGE_ONE_INVENTORY, InventoryManager.BATTERY_ITEM);
                inventoryChanger.Give(InventoryChanger.BETASTORAGE_ONE_INVENTORY, InventoryManager.BATTERY_ITEM);
                inventoryChanger.Give(InventoryChanger.BETASTORAGE_TWO_INVENTORY, InventoryManager.ERK_ITEM);
                inventoryChanger.Give(InventoryChanger.BETASTORAGE_TWO_INVENTORY, InventoryManager.ERK_ITEM);
                inventoryChanger.Give(InventoryChanger.BETASTORAGE_TWO_INVENTORY, InventoryManager.BATTERY_ITEM);
                inventoryChanger.Give(InventoryChanger.BETASTORAGE_TWO_INVENTORY, InventoryManager.BATTERY_ITEM);
                inventoryChanger.Give(InventoryChanger.BETASTORAGE_TWO_INVENTORY, InventoryManager.BATTERY_ITEM);
                inventoryChanger.GivePlayer(InventoryManager.FOOD_ITEM);
                inventoryChanger.GivePlayer(InventoryManager.FOOD_ITEM);
                inventoryChanger.GivePlayer(InventoryManager.WATER_ITEM);
                stationInitialized = true;
            }
            if (timeThisFrame > 2 && firstDayNotShown) //DAY 1
            {
                firstDayNotShown = false;
                CrossFadeInAnnouncement("Day One");
            }
            if (timeThisFrame > 5 && !firstDayIndicatorHidden) //DAY 1 Hide
            {
                firstDayIndicatorHidden = true;
                CrossFadeOutAnnouncement("Day One");
            }
            if (playerIn(1) && !firstCheckpoint && !helpTextShown)
            {
                StartCoroutine(ShowHelpText());
            }
            if (timeThisFrame > 0 && cpuEnabled && !firstCheckpoint) //Begin Printing Initial Instructions!!!!
            {
                print("First Checkpoint Activated!");
                StartCoroutine(DayOneTextOne());
                firstCheckpoint = true;
                //TODO unlock doors
            }
            if (firstCheckpoint && playerIn(3) && cpuEnabled && !secondCheckpoint) //User is in the Beta Storage now, print second set of instructions.
            {
                print("Second Checkpoint Activiated!");
                StartCoroutine(DayOneTextTwo());
                secondCheckpoint = true;
            }
            if (secondCheckpoint && !thirdCheckpoint && cpuEnabled && inventoryManager.Player.ERKAmount > 0 && inventoryManager.Player.BatteriesAmount > 0) //User has grabbed a battery and ERK, commence more instructions.
            {
                print("Third Checkpoint Activated!");
                StartCoroutine(DayOneTextThree());
                thirdCheckpoint = true;
            }
            if (thirdCheckpoint && !fourthCheckpoint && playerIn(1) && cpuEnabled) //User in room one, just finished first mission.
            {
                print("Fourth Checkpoint Activated!");
                StartCoroutine(DayOneTextFour());
                fourthCheckpoint = true;
            }
            if (fourthCheckpoint && !commandEntered && !fifthCheckpoint)
            {
                //Don't do anything, just reserving a spot
            }
            if (fourthCheckpoint && commandEntered && !fifthCheckpoint && cpuEnabled)
            {
                print("Fifth Checkpoint Activated!");
                StartCoroutine(DayOneTextFive());
                fifthCheckpoint = true;
            }
            if (fifthCheckpoint && playerIn(7) && !sixthCheckpoint && cpuEnabled)
            {
                print("Sixth Checkpoint Activated!");
                StartCoroutine(DayOneTextSix());
                sixthCheckpoint = true;
            }
            if (sixthCheckpoint && pumpGameComplete && playerIn(7) && cpuEnabled && !seventhCheckpoint)
            {
                print("Seventh Checkpoint Activiated");
                StartCoroutine(DayOneTextSeven());
                seventhCheckpoint = true;
            }
            if (seventhCheckpoint && playerIn(1) && cpuEnabled && !eighthCheckpoint)
            {
                print("Eight Checkpoint Activiated");
                StartCoroutine(DayOneTextEight());
                eighthCheckpoint = true;
            }
            if (eighthCheckpoint && playerIn(1) && cpuEnabled && !ninthCheckpoint) //add other stuff here
            {
                print("Ninth Checkpoint Activated!");
                StartCoroutine(DayOneTextNine());
                ninthCheckpoint = true;
            }
            if (ninthCheckpoint && playerIn(1) && cpuEnabled && !tenthCheckpoint) //add other stuff here
            {
                print("Tenth Checkpoint Activated!");
                StartCoroutine(DayOneTextTen());
                tenthCheckpoint = true;
            }
            //LOSING SCRIPTS---------------------------------------------------------------------------
            if (timeThisFrame > 150 && !tenthCheckpoint && !emergencyMode) //First challenge
            {
                emergencyMode         = true;
                lightManager.redalert = true;
                musicController.stopSound(MusicController.MUSIC);
                musicController.startSound(MusicController.ALARM_SOUND);
            }
            if (emergencyMode && cpuEnabled && !emergencyMessageShown)
            {
                emergencyMessageShown = true;
                StartCoroutine(asteroidComing());
            }
            if (timeOfImpact < timeManager.time && !startedLosing)
            {
                startedLosing         = true;
                lightManager.redalert = false;
                lightManager.blackout = true;
                player.GetComponent <PlayerMove>().enabled = false;
                musicController.startSound(MusicController.CRASH_SOUND);
                StartCoroutine(cameraManager.AsteroidImpact());
            }
            //WINNING------------------------------------------------------------------------------------
            if (timeThisFrame > 150 && tenthCheckpoint)
            {
                lightManager.redalert   = false;
                lightManager.greenalert = true;
                StartCoroutine(WinRoutine());
            }
        }
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Pause();
        }
    }