<repo_name>yaoxinmeng/PSA-Game-It<file_sep>/Assets/Scripts/CutScene6.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Video;

public class CutScene6 : MonoBehaviour
{
    private GameObject game;
    private VideoPlayer vp;

    // Use this for initialization
    void Start()
    {
        game = GameObject.Find("Game");
        vp = GetComponent<VideoPlayer>();
        if (PlayerPrefs.HasKey("Cutscene6"))
        {
            game.SetActive(true);
            gameObject.SetActive(false);
        }
        else
        {
            game.SetActive(false);
        }
    }

    // Update is called once per frame
    void Update()
    {
        if (!vp.isPlaying)
        {
            PlayerPrefs.SetInt("Cutscene6", 1);
            game.SetActive(true);
            gameObject.SetActive(false);
        }
    }
}
<file_sep>/Assets/Scripts/StageSelection.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

// ========================================
// Unlock Stars Key Reference
// 0 - 0 star 
// 1 - 1 stars
// 2 - 2 stars
// 3 - 3 stars
// 4 - locked
// ========================================

public class StageSelection : MonoBehaviour {

	private UiController uiController;
	private LevelManager levelManager;
	private float timeTaken;
	private int sceneIndex;
	private string starsKey;

	private GameObject oneStar;
	private GameObject twoStar;
	private GameObject threeStar;

	private GameObject stage10;
	private GameObject stage11;
	private GameObject stage12;
	private GameObject stage13;
	private GameObject stage20;
	private GameObject stage21;
	private GameObject stage22;
	private GameObject stage23;
	private GameObject stage24;
	private GameObject stage30;
	private GameObject stage31;
	private GameObject stage32;
	private GameObject stage33;
	private GameObject stage34;
	private GameObject stage40;
	private GameObject stage41;
	private GameObject stage42;
	private GameObject stage43;
	private GameObject stage44;
	private GameObject stage50;
	private GameObject stage51;
	private GameObject stage52;
	private GameObject stage53;
	private GameObject stage54;
	private GameObject stage60;
	private GameObject stage61;
	private GameObject stage62;
	private GameObject stage63;
	private GameObject stage64;
	private GameObject stage70;
	private GameObject stage71;
	private GameObject stage72;
	private GameObject stage73;
	private GameObject stage74;
	private GameObject stageminilocked;
	private GameObject stageminiunlocked;

	void Start(){
		uiController = GetComponent<UiController>();
		levelManager = GetComponent<LevelManager>();
		sceneIndex = SceneManager.GetActiveScene().buildIndex;
		initialiseStars();

		oneStar = GameObject.Find("GUI/Level Completed/Stars/1 Star");
		twoStar = GameObject.Find("GUI/Level Completed/Stars/2 Star");
		threeStar = GameObject.Find("GUI/Level Completed/Stars/3 Star");

		stage10 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 1/Stage 1-0");
		stage11 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 1/Stage 1-1");
		stage12 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 1/Stage 1-2");
		stage13 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 1/Stage 1-3");

		stage20 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 2/Stage 2-0");
		stage21 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 2/Stage 2-1");
		stage22 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 2/Stage 2-2");
		stage23 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 2/Stage 2-3");
		stage24 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 2/Stage 2-4");

		stage30 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 3/Stage 3-0");
		stage31 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 3/Stage 3-1");
		stage32 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 3/Stage 3-2");
		stage33 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 3/Stage 3-3");
		stage34 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 3/Stage 3-4");

		stage40 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 4/Stage 4-0");
		stage41 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 4/Stage 4-1");
		stage42 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 4/Stage 4-2");
		stage43 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 4/Stage 4-3");
		stage44 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 4/Stage 4-4");

		stage50 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 5/Stage 5-0");
		stage51 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 5/Stage 5-1");
		stage52 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 5/Stage 5-2");
		stage53 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 5/Stage 5-3");
		stage54 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 5/Stage 5-4");

		stage60 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 6/Stage 6-0");
		stage61 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 6/Stage 6-1");
		stage62 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 6/Stage 6-2");
		stage63 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 6/Stage 6-3");
		stage64 = GameObject.Find("GUI/Stage Select Menu/Page One/Stage 6/Stage 6-4");

		stage70 = GameObject.Find("GUI/Stage Select Menu/Page Two/Stage 7/Stage 7-0");
		stage71 = GameObject.Find("GUI/Stage Select Menu/Page Two/Stage 7/Stage 7-1");
		stage72 = GameObject.Find("GUI/Stage Select Menu/Page Two/Stage 7/Stage 7-2");
		stage73 = GameObject.Find("GUI/Stage Select Menu/Page Two/Stage 7/Stage 7-3");
		stage74 = GameObject.Find("GUI/Stage Select Menu/Page Two/Stage 7/Stage 7-4");

		stageminilocked = GameObject.Find("GUI/Stage Select Menu/Page Two/Stage Mini/Locked");
		stageminiunlocked = GameObject.Find("GUI/Stage Select Menu/Page Two/Stage Mini/Unlocked");							

	}

	void Update(){
		displayStages();
	}

	void displayStages(){
		switch(PlayerPrefs.GetInt("SceneOneStars")){
			case 0:
				stage10.SetActive(true);
				stage11.SetActive(false);
				stage12.SetActive(false);
				stage13.SetActive(false);
				break;
			case 1:
				stage10.SetActive(false);
				stage11.SetActive(true);
				stage12.SetActive(false);
				stage13.SetActive(false);
				break;
			case 2:
				stage10.SetActive(false);
				stage11.SetActive(false);
				stage12.SetActive(true);
				stage13.SetActive(false);
				break;
			case 3:
				stage10.SetActive(false);
				stage11.SetActive(false);
				stage12.SetActive(false);
				stage13.SetActive(true);
				break;
		}

		switch(PlayerPrefs.GetInt("SceneTwoStars")){
			case 0:
				stage20.SetActive(true);
				stage21.SetActive(false);
				stage22.SetActive(false);
				stage23.SetActive(false);
				stage24.SetActive(false);
				break;
			case 1:
				stage20.SetActive(false);
				stage21.SetActive(true); //
				stage22.SetActive(false);
				stage23.SetActive(false);
				stage24.SetActive(false);
				break;
			case 2:
				stage20.SetActive(false);
				stage21.SetActive(false);
				stage22.SetActive(true); //
				stage23.SetActive(false);
				stage24.SetActive(false);
				break;
			case 3:
				stage20.SetActive(false);
				stage21.SetActive(false);
				stage22.SetActive(false);
				stage23.SetActive(true); //
				stage24.SetActive(false);
				break;
			case 4:
				stage20.SetActive(false);
				stage21.SetActive(false);
				stage22.SetActive(false);
				stage23.SetActive(false);
				stage24.SetActive(true); //
				break;
		}

		switch(PlayerPrefs.GetInt("SceneThreeStars")){
			case 0:
				stage30.SetActive(true);
				stage31.SetActive(false);
				stage32.SetActive(false);
				stage33.SetActive(false);
				stage34.SetActive(false);
				break;
			case 1:
				stage30.SetActive(false);
				stage31.SetActive(true);
				stage32.SetActive(false);
				stage33.SetActive(false);
				stage34.SetActive(false);
				break;
			case 2:
				stage30.SetActive(false);
				stage31.SetActive(false);
				stage32.SetActive(true);
				stage33.SetActive(false);
				stage34.SetActive(false);
				break;
			case 3:
				stage30.SetActive(false);
				stage31.SetActive(false);
				stage32.SetActive(false);
				stage33.SetActive(true);
				stage34.SetActive(false);
				break;
			case 4:
				stage30.SetActive(false);
				stage31.SetActive(false);
				stage32.SetActive(false);
				stage33.SetActive(false);
				stage34.SetActive(true);
				break;
		}

		switch(PlayerPrefs.GetInt("SceneFourStars")){
			case 0:
				stage40.SetActive(true);
				stage41.SetActive(false);
				stage42.SetActive(false);
				stage43.SetActive(false);
				stage44.SetActive(false);
				break;
			case 1:
				stage40.SetActive(false);
				stage41.SetActive(true);
				stage42.SetActive(false);
				stage43.SetActive(false);
				stage44.SetActive(false);
				break;
			case 2:
				stage40.SetActive(false);
				stage41.SetActive(false);
				stage42.SetActive(true);
				stage43.SetActive(false);
				stage44.SetActive(false);
				break;
			case 3:
				stage40.SetActive(false);
				stage41.SetActive(false);
				stage42.SetActive(false);
				stage43.SetActive(true);
				stage44.SetActive(false);
				break;
			case 4:
				stage40.SetActive(false);
				stage41.SetActive(false);
				stage42.SetActive(false);
				stage43.SetActive(false);
				stage44.SetActive(true);
				break;
		}

		switch(PlayerPrefs.GetInt("SceneFiveStars")){
			case 0:
				stage50.SetActive(true);
				stage51.SetActive(false);
				stage52.SetActive(false);
				stage53.SetActive(false);
				stage54.SetActive(false);
				break;
			case 1:
				stage50.SetActive(false);
				stage51.SetActive(true);
				stage52.SetActive(false);
				stage53.SetActive(false);
				stage54.SetActive(false);
				break;
			case 2:
				stage50.SetActive(false);
				stage51.SetActive(false);
				stage52.SetActive(true);
				stage53.SetActive(false);
				stage54.SetActive(false);
				break;
			case 3:
				stage50.SetActive(false);
				stage51.SetActive(false);
				stage52.SetActive(false);
				stage53.SetActive(true);
				stage54.SetActive(false);
				break;
			case 4:
				stage50.SetActive(false);
				stage51.SetActive(false);
				stage52.SetActive(false);
				stage53.SetActive(false);
				stage54.SetActive(true);
				break;
		}

		switch(PlayerPrefs.GetInt("SceneSixStars")){
			case 0:
				stage60.SetActive(true);
				stage61.SetActive(false);
				stage62.SetActive(false);
				stage63.SetActive(false);
				stage64.SetActive(false);
				break;
			case 1:
				stage60.SetActive(false);
				stage61.SetActive(true);
				stage62.SetActive(false);
				stage63.SetActive(false);
				stage64.SetActive(false);
				break;
			case 2:
				stage60.SetActive(false);
				stage61.SetActive(false);
				stage62.SetActive(true);
				stage63.SetActive(false);
				stage64.SetActive(false);
				break;
			case 3:
				stage60.SetActive(false);
				stage61.SetActive(false);
				stage62.SetActive(false);
				stage63.SetActive(true);
				stage64.SetActive(false);
				break;
			case 4:
				stage60.SetActive(false);
				stage61.SetActive(false);
				stage62.SetActive(false);
				stage63.SetActive(false);
				stage64.SetActive(true);
				break;
		}

		switch(PlayerPrefs.GetInt("SceneSevenStars")){
			case 0:
				stage70.SetActive(true);
				stage71.SetActive(false);
				stage72.SetActive(false);
				stage73.SetActive(false);
				stage74.SetActive(false);
				break;
			case 1:
				stage70.SetActive(false);
				stage71.SetActive(true);
				stage72.SetActive(false);
				stage73.SetActive(false);
				stage74.SetActive(false);
				break;
			case 2:
				stage70.SetActive(false);
				stage71.SetActive(false);
				stage72.SetActive(true);
				stage73.SetActive(false);
				stage74.SetActive(false);
				break;
			case 3:
				stage70.SetActive(false);
				stage71.SetActive(false);
				stage72.SetActive(false);
				stage73.SetActive(true);
				stage74.SetActive(false);
				break;
			case 4:
				stage70.SetActive(false);
				stage71.SetActive(false);
				stage72.SetActive(false);
				stage73.SetActive(false);
				stage74.SetActive(true);
				break;
		}

		switch(PlayerPrefs.GetInt("SceneMini")){
			case 1:	//1 means scene mini unlocked!
				stageminiunlocked.SetActive(true);
				stageminilocked.SetActive(false);
				break;

			case 4:	//4 means scene mini locked!
				stageminiunlocked.SetActive(false);
				stageminilocked.SetActive(true);
				break;
		}
	}

	void initialiseStars() {	//if player has not played the game before, initialise the stars for all stages to 0
		if (PlayerPrefs.HasKey("SceneOneStars") == false){
			PlayerPrefs.SetInt("SceneOneStars", 0);
			PlayerPrefs.Save();
		}
		if (PlayerPrefs.HasKey("SceneTwoStars") == false){
			PlayerPrefs.SetInt("SceneTwoStars", 4);
			PlayerPrefs.Save();
		}
		if (PlayerPrefs.HasKey("SceneThreeStars") == false){
			PlayerPrefs.SetInt("SceneThreeStars", 4);
			PlayerPrefs.Save();
		}
		if (PlayerPrefs.HasKey("SceneFourStars") == false){
			PlayerPrefs.SetInt("SceneFourStars", 4);
			PlayerPrefs.Save();
		}
		if (PlayerPrefs.HasKey("SceneFiveStars") == false){
			PlayerPrefs.SetInt("SceneFiveStars", 4);
			PlayerPrefs.Save();
		}
		if (PlayerPrefs.HasKey("SceneSixStars") == false){
			PlayerPrefs.SetInt("SceneSixStars", 4);
			PlayerPrefs.Save();
		}
		if (PlayerPrefs.HasKey("SceneSevenStars") == false){
			PlayerPrefs.SetInt("SceneSevenStars", 4);
			PlayerPrefs.Save();
		}

		if (PlayerPrefs.HasKey("SceneMini") == false){
			PlayerPrefs.SetInt("SceneMini", 4);
			PlayerPrefs.Save();
		}
	}


	public void checkStarsObtained(){
		timeTaken = uiController.currentTime;
		switch(sceneIndex){		
		//according to the scene index, each stage has different timing to get different stars
		//adjust the conditions for acheiving the stars in the respective if statements
			case 2:
				if (timeTaken < 30f){
					PlayerPrefs.SetInt("SceneOneStars", 3);
					if (PlayerPrefs.GetInt("SceneTwoStars") == 4){
						PlayerPrefs.SetInt("SceneTwoStars", 0);
					}
					PlayerPrefs.Save();

					oneStar.SetActive(true);
					twoStar.SetActive(true);
					threeStar.SetActive(true);
				}
					
				else if (timeTaken < 40f){
					PlayerPrefs.SetInt("SceneOneStars", 2);
					if (PlayerPrefs.GetInt("SceneTwoStars") == 4){
						PlayerPrefs.SetInt("SceneTwoStars", 0);
					}
					PlayerPrefs.Save();

					oneStar.SetActive(true);
					twoStar.SetActive(true);
					threeStar.SetActive(false);
				}
				else {
					PlayerPrefs.SetInt("SceneOneStars", 1);
					if (PlayerPrefs.GetInt("SceneTwoStars") == 4){
						PlayerPrefs.SetInt("SceneTwoStars", 0);
					}
					PlayerPrefs.Save();

					oneStar.SetActive(true);
					twoStar.SetActive(false);
					threeStar.SetActive(false);
				}
				break;

			case 3:
				if (timeTaken < 30f){
					PlayerPrefs.SetInt("SceneTwoStars", 3);
					if (PlayerPrefs.GetInt("SceneThreeStars") == 4){
						PlayerPrefs.SetInt("SceneThreeStars", 0);
					}
					PlayerPrefs.Save();

					oneStar.SetActive(true);
					twoStar.SetActive(true);
					threeStar.SetActive(true);
				}
				else if (timeTaken < 40f){
					PlayerPrefs.SetInt("SceneTwoStars", 2);
					if (PlayerPrefs.GetInt("SceneThreeStars") == 4){
						PlayerPrefs.SetInt("SceneThreeStars", 0);
					}
					PlayerPrefs.Save();

					oneStar.SetActive(true);
					twoStar.SetActive(true);
					threeStar.SetActive(false);
				}
				else{
					PlayerPrefs.SetInt("SceneTwoStars", 1);
					if (PlayerPrefs.GetInt("SceneThreeStars") == 4){
						PlayerPrefs.SetInt("SceneThreeStars", 0);
					}
					PlayerPrefs.Save();

					oneStar.SetActive(true);
					twoStar.SetActive(false);
					threeStar.SetActive(false);
				}
				break;

			case 4:
				if (timeTaken < 30f){
					PlayerPrefs.SetInt("SceneThreeStars", 3);
					if (PlayerPrefs.GetInt("SceneFourStars") == 4){
						PlayerPrefs.SetInt("SceneFourStars", 0);
					}
					PlayerPrefs.Save();

					oneStar.SetActive(true);
					twoStar.SetActive(true);
					threeStar.SetActive(true);
				}
				else if (timeTaken < 40f){
					PlayerPrefs.SetInt("SceneThreeStars", 2);
					if (PlayerPrefs.GetInt("SceneFourStars") == 4){
						PlayerPrefs.SetInt("SceneFourStars", 0);
					}
					PlayerPrefs.Save();

					oneStar.SetActive(true);
					twoStar.SetActive(true);
					threeStar.SetActive(false);
				}
				else{
					PlayerPrefs.SetInt("SceneThreeStars", 1);
					if (PlayerPrefs.GetInt("SceneFourStars") == 4){
						PlayerPrefs.SetInt("SceneFourStars", 0);
					}
					PlayerPrefs.Save();

					oneStar.SetActive(true);
					twoStar.SetActive(false);
					threeStar.SetActive(false);
				}
				break;

			case 5:
				if (timeTaken < 55f){
					PlayerPrefs.SetInt("SceneFourStars", 3);
					if (PlayerPrefs.GetInt("SceneFiveStars") == 4){
						PlayerPrefs.SetInt("SceneFiveStars", 0);
					}
					PlayerPrefs.Save();

					oneStar.SetActive(true);
					twoStar.SetActive(true);
					threeStar.SetActive(true);
				}
				else if (timeTaken < 65f){
					PlayerPrefs.SetInt("SceneFourStars", 2);
					if (PlayerPrefs.GetInt("SceneFiveStars") == 4){
						PlayerPrefs.SetInt("SceneFiveStars", 0);
					}
					PlayerPrefs.Save();

					oneStar.SetActive(true);
					twoStar.SetActive(true);
					threeStar.SetActive(false);
				}
				else{
					PlayerPrefs.SetInt("SceneFourStars", 1);
					if (PlayerPrefs.GetInt("SceneFiveStars") == 4){
						PlayerPrefs.SetInt("SceneFiveStars", 0);
					}
					PlayerPrefs.Save();

					oneStar.SetActive(true);
					twoStar.SetActive(false);
					threeStar.SetActive(false);
				}
				break;

			case 6:
				if (timeTaken < 55f){
					PlayerPrefs.SetInt("SceneFiveStars", 3);
					if (PlayerPrefs.GetInt("SceneSixStars") == 4){
						PlayerPrefs.SetInt("SceneSixStars", 0);
					}
					PlayerPrefs.Save();

					oneStar.SetActive(true);
					twoStar.SetActive(true);
					threeStar.SetActive(true);
				}
				else if (timeTaken < 65f){
					PlayerPrefs.SetInt("SceneFiveStars", 2);
					if (PlayerPrefs.GetInt("SceneSixStars") == 4){
						PlayerPrefs.SetInt("SceneSixStars", 0);
					}
					PlayerPrefs.Save();

					oneStar.SetActive(true);
					twoStar.SetActive(true);
					threeStar.SetActive(false);
				}
				else{
					PlayerPrefs.SetInt("SceneFiveStars", 1);
					if (PlayerPrefs.GetInt("SceneSixStars") == 4){
						PlayerPrefs.SetInt("SceneSixStars", 0);
					}
					PlayerPrefs.Save();

					oneStar.SetActive(true);
					twoStar.SetActive(false);
					threeStar.SetActive(false);
				}
				break;

			case 7:
				if (timeTaken < 30f){
					PlayerPrefs.SetInt("SceneSixStars", 3);
					if (PlayerPrefs.GetInt("SceneSevenStars") == 4){
						PlayerPrefs.SetInt("SceneSevenStars", 0);
					}
					PlayerPrefs.Save();

					oneStar.SetActive(true);
					twoStar.SetActive(true);
					threeStar.SetActive(true);
				}
				else if (timeTaken < 40f){
					PlayerPrefs.SetInt("SceneSixStars", 2);
					if (PlayerPrefs.GetInt("SceneSevenStars") == 4){
						PlayerPrefs.SetInt("SceneSevenStars", 0);
					}
					PlayerPrefs.Save();

					oneStar.SetActive(true);
					twoStar.SetActive(true);
					threeStar.SetActive(false);
				}
				else{
					PlayerPrefs.SetInt("SceneSixStars", 1);
					if (PlayerPrefs.GetInt("SceneSevenStars") == 4){
						PlayerPrefs.SetInt("SceneSevenStars", 0);
					}
					PlayerPrefs.Save();

					oneStar.SetActive(true);
					twoStar.SetActive(false);
					threeStar.SetActive(false);
				}
				break;

			case 8:
				if (timeTaken < 30f){
					PlayerPrefs.SetInt("SceneSevenStars", 3);
					if (PlayerPrefs.GetInt("SceneMini") == 4){
						PlayerPrefs.SetInt("SceneMini", 1);
					}
					PlayerPrefs.Save();

					oneStar.SetActive(true);
					twoStar.SetActive(true);
					threeStar.SetActive(true);
				}
				else if (timeTaken < 40f){
					PlayerPrefs.SetInt("SceneSevenStars", 2);
					if (PlayerPrefs.GetInt("SceneMini") == 4){
						PlayerPrefs.SetInt("SceneMini", 1);
					}
					PlayerPrefs.Save();

					oneStar.SetActive(true);
					twoStar.SetActive(true);
					threeStar.SetActive(false);
				}
				else{
					PlayerPrefs.SetInt("SceneSevenStars", 1);
					if (PlayerPrefs.GetInt("SceneMini") == 4){
						PlayerPrefs.SetInt("SceneMini", 1);
					}
					PlayerPrefs.Save();

					oneStar.SetActive(true);
					twoStar.SetActive(false);
					threeStar.SetActive(false);
				}
				break;
		}
	}

	public void loadStage1(){
		levelManager.loadSelectedLevel(2);
	}

	public void loadStage2(){
		if (PlayerPrefs.GetInt("SceneTwoStars") != 4){
			levelManager.loadSelectedLevel(3);
		}
	}

	public void loadStage3(){
		if (PlayerPrefs.GetInt("SceneThreeStars") != 4){
			levelManager.loadSelectedLevel(4);
		}
	}

	public void loadStage4(){
		if (PlayerPrefs.GetInt("SceneFourStars") != 4){
			levelManager.loadSelectedLevel(5);
		}
	}

	public void loadStage5(){
		if (PlayerPrefs.GetInt("SceneFiveStars") != 4){
			levelManager.loadSelectedLevel(6);
		}
	}

	public void loadStage6(){
		if (PlayerPrefs.GetInt("SceneSixStars") != 4){
			levelManager.loadSelectedLevel(7);
		}
	}

	public void loadStage7(){
		if (PlayerPrefs.GetInt("SceneSevenStars") != 4){
			levelManager.loadSelectedLevel(8);
		}
	}

	public void loadFinalStage(){
		if (PlayerPrefs.GetInt("SceneMini") != 4){
			levelManager.loadSelectedLevel(9);
		}
	}
}
<file_sep>/Assets/Scripts/LevelManager.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class LevelManager : MonoBehaviour {

	private int sceneIndex;

	void Start() {
		sceneIndex = SceneManager.GetActiveScene().buildIndex;
	}

	public void nextLevel () {
		SceneManager.LoadScene (sceneIndex + 1);
		UiController.nextLevel = false;
		UiController.gameClear = false;
	}

	public void loadHomeScene(){
		SceneManager.LoadScene (0);		//assuming home scene still has build index of 0
		UiController.nextLevel = false;
	}

	public void loadCurrentLevel(){
		SceneManager.LoadScene(sceneIndex);
	}

	public void loadSelectedLevel(int scene){
		SceneManager.LoadScene(scene);
		UiController.stageSelect = false;
		UiController.options = false;
		UiController.pause = false;
	}

}
<file_sep>/Assets/Scripts/RotatingSecurityCamera.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RotatingSecurityCamera : MonoBehaviour {

	public float rotatingSpeed;
	private bool flip = false;
	public float leftLimitRotation = -45f;
	public float rightLimitRotation = 45f;
    private SpriteRenderer ren;
    private float iniAlpha;

    public bool isOn;

    void Start()
    {
        ren = transform.GetChild(0).GetComponent<SpriteRenderer>();
        iniAlpha = ren.color.a;
    }

    // Update is called once per frame
    void Update ()
	{
        if (isOn)
        {
            float angle = transform.localEulerAngles.z;
            angle = (angle > 180) ? angle - 360 : angle;
            ren.color = new Vector4(ren.color.r, ren.color.g, ren.color.b, iniAlpha);

            if (angle > rightLimitRotation)
            {
                rotatingSpeed = -1f * rotatingSpeed;
            }

            if (angle < leftLimitRotation)
            {
                rotatingSpeed = -1f * rotatingSpeed;
            }

            transform.Rotate(0f, 0f, -rotatingSpeed * Time.deltaTime);
            tag = "Enemy";
            transform.GetChild(0).tag = "Enemy";
        }
        else
        {
            tag = "Security Camera";
            transform.GetChild(0).tag = "Security Camera";
            transform.Rotate(0, 0, 0);
            ren.color = new Vector4(ren.color.r, ren.color.g, ren.color.b, 0f);
        }
	}
}
<file_sep>/Assets/Scripts/Mini Game/LeftScreenMini.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LeftScreenMini : MonoBehaviour {

    public float forceOnPlayer;
	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		
	}

    void OnTriggerExit2D(Collider2D collision)
    {
        GameObject obj = collision.gameObject;
        if (obj.tag == "ContainerMini" || obj.tag == "Background" || obj.tag == "Ground")
            Destroy(obj);
        if (obj.tag == "Security Camera")
            Destroy(obj.transform.parent.gameObject);

    }
}
<file_sep>/Assets/Scripts/ATV.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ATV : MonoBehaviour {

    [Range(0, 20f)]
    public float patrolSpeed;
    public bool isLeft; //check for direction
    public bool isOn;

    private float x; //initial x-coordinate
    private bool changeDirection;
    private Rigidbody2D rb;
    private Animator anim;

    void Start()
    {
        x = transform.position.x;
        rb = GetComponent<Rigidbody2D>();
        // anim = GetComponent<Animator>();
        changeDirection = false;
        anim = GetComponent<Animator>();
        if (isLeft)
            transform.Rotate(0, 180, 0); //if ATV moves left initially
    }

    void Update()
    {
        if (isOn)
        {
            gameObject.tag = "Enemy";
            transform.Find("Top Surface").gameObject.tag = "Enemy";
            if (isLeft)
                rb.velocity = new Vector2(-patrolSpeed, 0);
            else
                rb.velocity = new Vector2(patrolSpeed, 0);

            if (changeDirection)
            {
                if (transform.position.x < x)
                {
                    isLeft = false;
                }
                else if (transform.position.x > x)
                {
                    isLeft = true;
                }
                transform.Rotate(0, 180, 0);
                changeDirection = false;
            }
        }
        else
        {
            rb.velocity = Vector2.zero;
            gameObject.tag = "Container";
            transform.Find("Top Surface").gameObject.tag = "Container";
        }
    }

    void OnTriggerEnter2D(Collider2D col)
    {
        GameObject obj = col.gameObject;

        if (obj.gameObject.tag == "Checkpoint")
        {
            if (obj == transform.parent.GetChild(1).GetChild(0).gameObject || obj == transform.parent.GetChild(1).GetChild(1).gameObject)
            {
                changeDirection = true;
            }
        }
    }

    void OnTriggerExit2D(Collider2D col)
    {
        GameObject obj = col.gameObject;
        if (obj.gameObject.tag == "Checkpoint")
        {
            if (obj == transform.parent.GetChild(1).GetChild(0).gameObject || obj == transform.parent.GetChild(1).GetChild(1).gameObject)
            {
                changeDirection = false;
            }
        }
    }
}
<file_sep>/Assets/Scripts/MainChar2D.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MainChar2D : MonoBehaviour
{
    public AudioClip jumpSFX;
    public AudioClip landSFX;
    public AudioClip dieSFX;
    public AudioClip winSFX;

    private AudioSource jumpSource;
    private AudioSource landSource;
    private AudioSource dieSource;
    private AudioSource winSource;

    public AudioSource[] audioList;

    [Range(1, 10)]
    public float walkingSpeed;
    [Range(1, 10)]
    public float jumpHeight;
    [Range (0, 1)]
    public float invisibilityBufferTime;

    private Animator anim;
    private LevelManager levelManager;
    private Rigidbody2D rb;
    private Spriter2UnityDX.EntityRenderer ren;

    private float iniAlpha;
    private bool faceLeft = false;
    
    private bool isInvisible = false;

    [HideInInspector]
    public bool hitLWall = false;
    [HideInInspector]
    public bool hitRWall = false;
    [HideInInspector]
    public bool onCrane = false;

    void Awake()
    {
        
    }

    // Use this for initialization
    void Start()
    {
        ren = GetComponent<Spriter2UnityDX.EntityRenderer>();
        GetComponent<BoxCollider2D>().isTrigger = false;
        anim = GetComponent<Animator>();
        rb = GetComponent<Rigidbody2D>();
        iniAlpha = ren.Color.a;

        jumpSource = gameObject.AddComponent<AudioSource>();
        jumpSource.clip = jumpSFX;
        landSource = gameObject.AddComponent<AudioSource>();
        landSource.clip = landSFX;
        dieSource = gameObject.AddComponent<AudioSource>();
        dieSource.clip = dieSFX;
        winSource = gameObject.AddComponent<AudioSource>();
        winSource.clip = winSFX;

        audioList = GetComponents<AudioSource>();
        foreach (AudioSource audio in audioList)
        {
            audio.volume = PlayerPrefs.GetFloat("SFXvolume");
            audio.playOnAwake = false;
        }
    }

    // Update is called once per frame
    void Update ()
	{
        if (!anim.GetBool("isDead"))
        {
            if (!UiController.playerDied)
            {
                //for sounds
                foreach (AudioSource audio in audioList)
                {
                    audio.volume = PlayerPrefs.GetFloat("SFXvolume");
                }

                //for animation
                if (GuiController.isTappedRight)
                {
                    anim.SetBool("isRunningRight", true);
                    hitLWall = false;
                    if (!hitRWall)
                        transform.Translate(Vector3.right * walkingSpeed * Time.deltaTime);
                }
                else
                {
                    anim.SetBool("isRunningRight", false);
                }

                if (GuiController.isTappedLeft)
                {
                    anim.SetBool("isRunningLeft", true);
                    hitRWall = false;
                    if (!hitLWall)
                        transform.Translate(Vector3.left * walkingSpeed * Time.deltaTime);
                }
                else
                {
                    anim.SetBool("isRunningLeft", false);
                }

                //for jump and drop
                if (GuiController.isJumping && GuiController.isGrounded)
                {
                    jumpSource.PlayOneShot(jumpSFX, 0.8f);
                    rb.velocity = new Vector2(rb.velocity.x, jumpHeight);
                    anim.SetTrigger("isJumping");
                    GuiController.isJumping = false;
                }
                else
                    anim.SetBool("isJumping", false);

                if (GuiController.isDropping)
                {
                    GetComponent<BoxCollider2D>().isTrigger = true;
                    rb.velocity = new Vector2(rb.velocity.x, -0.5f * jumpHeight);
                }

                //for inivisble container
                if (isInvisible)
                {
                    ren.Color = new Vector4(ren.Color.r, ren.Color.g, ren.Color.b, 0.5f);
                    gameObject.layer = 12;
                }
                else
                {
                    ren.Color = new Vector4(ren.Color.r, ren.Color.g, ren.Color.b, iniAlpha);
                    gameObject.layer = 9;
                }
            }

            else
            {
                dieSource.PlayOneShot(dieSFX, 1);
                anim.SetBool("isDead", true);
            }
        }
        else
        {
            gameObject.layer = 12;
        }

        //establishes isTrigger based on direction of travel
        if (rb.velocity.y > 0)
        {
            if (!onCrane)
                GetComponent<BoxCollider2D>().isTrigger = true;
            GuiController.isGrounded = false;
            GuiController.onGround = false;
        }
        else if (rb.velocity.y < 0)
        {
            if (!GuiController.isDropping)
                GetComponent<BoxCollider2D>().isTrigger = false;
            GuiController.isGrounded = false;
            GuiController.onGround = false;
        }
        else
        {
            GetComponent<BoxCollider2D>().isTrigger = false;
        }
    }

    void OnTriggerEnter2D(Collider2D collider)
    {
        GameObject obj = collider.gameObject;
        // Leave the method if not colliding with defender
        if (obj.tag == "GameController")
        {
            UiController.gameClear = true;
            winSource.PlayOneShot(winSFX, 0.8f);
        }
        if (obj.tag == "Enemy")
        {
            UiController.playerDied = true;
        }
        if (obj.tag == "Invisible Container")
            isInvisible = true;
    }

    void OnCollisionEnter2D(Collision2D col)
    {
        GameObject obj = col.gameObject;
        if (obj.tag == "Wall")
        {
            if (obj.transform.position.x < transform.position.x)
                hitLWall = true;
            else
                hitRWall = true;

            rb.velocity = new Vector3(0, rb.velocity.y);
        }
        if (obj.tag == "Ground" || obj.tag == "Container")
        {
            GuiController.isGrounded = true;
            landSource.PlayOneShot(landSFX, 0.5f);
        }
        if (obj.tag == "CraneContainer" && obj.transform.parent.Find("Crane").Find("Control Base").Find("Cable And Hook").GetComponent<Crane>().hasContainer)
        {
            landSource.PlayOneShot(landSFX, 0.5f);
            GuiController.isGrounded = false;
        }
        if (obj.tag == "Ground")
            GuiController.onGround = true;
        if (obj.tag == "Enemy")
        {
            UiController.playerDied = true;
        }
    }

    void OnTriggerExit2D(Collider2D collision)
    {
        GameObject obj = collision.gameObject;
        if (obj.tag == "Invisible Container")
            Invoke("becomeVisible", invisibilityBufferTime);
        if (obj.tag == "Wall")
        {
            if (obj.transform.position.x < transform.position.x)
                hitLWall = false;
            else
                hitRWall = false;
        }
    }

    void OnTriggerStay2D(Collider2D collision)
    {
        GameObject obj = collision.gameObject;
        if (obj.tag == "Wall")
        {
            if (obj.transform.position.x < transform.position.x)
                hitLWall = true;
            else
                hitRWall = true;

            rb.velocity = new Vector3(0, rb.velocity.y);
        }
    }

    void OnCollisionStay2D(Collision2D col)
    {
        GameObject obj = col.gameObject;
        if (obj.tag == "Ground" || obj.tag == "Container")
        {
            onCrane = false;
            GuiController.isGrounded = true;
        }
        if (obj.tag == "Ground")
            GuiController.onGround = true;
        if (obj.tag == "CraneContainer")
        {
            if (obj.transform.parent.Find("Crane").Find("Control Base").Find("Cable And Hook").GetComponent<Crane>().hasContainer)
            {
                onCrane = true;
                GuiController.isGrounded = false;
                obj.transform.GetChild(0).GetComponent<CraneContainer>().hasPlayer = true;
            }
            else
            {
                GuiController.isGrounded = true;
                onCrane = false;
                obj.transform.GetChild(0).GetComponent<CraneContainer>().hasPlayer = true;
            }
        }
    }

    void OnCollisionExit2D(Collision2D collision)
    {
        GameObject obj = collision.gameObject;
        if (obj.tag == "Wall")
        {
            if (obj.transform.position.x < transform.position.x)
                hitLWall = false;
            else
                hitRWall = false;
        }

        if (obj.tag == "CraneContainer")
        {
            if (rb.velocity.y > 0)
                rb.velocity = new Vector2(rb.velocity.x, 0);
            else
                rb.velocity = new Vector2(rb.velocity.x, -0.5f * jumpHeight);
        }
    }

    void becomeVisible()
    {
        isInvisible = false;
    }
}
<file_sep>/Assets/Scripts/Mini Game/ScoreMini.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ScoreMini : MonoBehaviour {
    public GameObject screen;
    public float screenVelocity;
    public float score = 0;

	// Use this for initialization
	void Start () {
        
	}
	
	// Update is called once per frame
	void Update () {
        screenVelocity = screen.GetComponent<ScreenMini>().initialspeed;
        if (!UiControllerMini.playerDied)
        {
            score += screenVelocity * Time.deltaTime;
            GetComponent<Text>().text = "" + (int)score;
        }
	}
}
<file_sep>/Assets/Scripts/Mini Game/RightScreenMini.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RightScreenMini : MonoBehaviour {

    public GameObject container;
    public GameObject securitycamera;
    public GameObject securitycamera2;
    public GameObject background;
    public GameObject foreground;

    public float yOffsetContainer;
    public float xOffsetContainer;
    public float yOffsetTopCamera;
    public float yOffsetBotCamera;
    public float iniMinCameraGap;
    public float finMinCameraGap;
    public float altCameraProb;
    public float xOffsetBg;
    public float yOffsetBg;
    public float xOffsetFore;
    public float yOffsetFore;

    public int cameraTime;
    
    private float decreaseGap;

    // Use this for initialization
    void Start () {
        if (iniMinCameraGap > finMinCameraGap)
            decreaseGap = (iniMinCameraGap - finMinCameraGap) / cameraTime;
    }
	
	// Update is called once per frame
	void Update () {

	}

    void OnTriggerEnter2D(Collider2D other)
    {
        if(other.gameObject.tag == "ContainerMini")
        {
            Instantiate(container, new Vector2(transform.position.x + xOffsetContainer, transform.position.y + yOffsetContainer), Quaternion.identity);
        }

        if (other.gameObject.tag == "Security Camera")
        {
            float x = Random.Range(iniMinCameraGap, 2 * iniMinCameraGap);

            if (iniMinCameraGap > finMinCameraGap)
                iniMinCameraGap = iniMinCameraGap - decreaseGap;

            if(Random.value > altCameraProb)
            {
                if (Random.value < 0.5)
                {
                    Instantiate(securitycamera, new Vector2(transform.position.x + x, transform.position.y + yOffsetBotCamera), Quaternion.identity);
                }
                else
                {
                    Instantiate(securitycamera, new Vector2(transform.position.x + x, transform.position.y + yOffsetTopCamera), Quaternion.identity);
                }
            }
            else
            {
                Instantiate(securitycamera2, new Vector2(transform.position.x + x, transform.position.y + yOffsetTopCamera), Quaternion.identity);
            }
        }

        if (other.gameObject.tag == "Background")
        {
            Instantiate(background, new Vector2(transform.position.x + xOffsetBg, transform.position.y + yOffsetBg), Quaternion.identity);
        }

        if (other.gameObject.tag == "Ground")
        {
            Instantiate(foreground, new Vector2(transform.position.x + xOffsetFore, transform.position.y + yOffsetFore), Quaternion.identity);
        }
    }
}
<file_sep>/Assets/Scripts/Mini Game/ScreenMini.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ScreenMini : MonoBehaviour {
    private Rigidbody2D rb;

    [Range(0, 2)]
    public float initialspeed;
    [Range(0, 10)]
    public float finalspeed;
    [Range(0, 1)]
    public float acceleration;
    [Range(0, 10)]
    public float timedelay;

    private float accumtime = 0f;

	// Use this for initialization
	void Start ()
    {
        rb = GetComponent<Rigidbody2D>();
        rb.velocity = new Vector2(initialspeed, 0f);
    }
	
	// Update is called once per frame
	void Update ()
    {
        if (UiControllerMini.playerDied || !UiControllerMini.gameStart)
            rb.velocity = Vector2.zero;
        else
        {
            accumtime += Time.deltaTime;
            rb.velocity = new Vector2(initialspeed, 0f);
            if (accumtime > timedelay)
            {
                if (initialspeed < finalspeed)
                {
                    initialspeed += acceleration;
                    rb.velocity = new Vector2(initialspeed, 0f);
                }
                accumtime = 0f;
            }
        }
    }
}
<file_sep>/Assets/Scripts/Scene2Tutorial.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Scene2Tutorial : MonoBehaviour {

    // Use this for initialization
    void Start () {
        //checks if tutorial has been completed previously
        if (PlayerPrefs.GetInt("Tutorial 2") == 1)
            transform.GetChild(0).gameObject.SetActive(false);
        else
        {
            transform.GetChild(0).gameObject.SetActive(true);
            UiController.tutorialOn = true;
        }

        transform.GetChild(1).gameObject.SetActive(false);
    }
	
	// Update is called once per frame
	void Update () {
        if (transform.GetChild(0).gameObject.activeInHierarchy)
        {
            if (!UiController.tutorialOn)
            {
                transform.GetChild(0).gameObject.SetActive(false);
                PlayerPrefs.SetInt("Tutorial 2", 1);
            }
        }

        if (GuiController.canDismiss)
            transform.GetChild(1).gameObject.SetActive(true);
        else
            transform.GetChild(1).gameObject.SetActive(false);
    }
}
<file_sep>/Assets/Scripts/CameraController.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraController : MonoBehaviour {

    private Transform cam_position;
    public GameObject main_char;
	// Use this for initialization
	void Start () {
        cam_position = GetComponent<Transform>();
        cam_position.position = new Vector3(main_char.GetComponent<Transform>().position.x, main_char.GetComponent<Transform>().position.y, -10);
    }
	
	// Update is called once per frame
	void Update () {
        cam_position.position = new Vector3(main_char.GetComponent<Transform>().position.x, main_char.GetComponent<Transform>().position.y, -10);
    }
}
<file_sep>/Assets/Scripts/Crane.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Crane : MonoBehaviour { 
    [Range (0, 10)]
    public float speed;
    
    private GameObject craneContainer;
    
    private Rigidbody2D rbBase;
    private Rigidbody2D rbHook;
    private bool up = false;
    private bool down = false;
    private bool left = false;
    private bool right = false;
    
    [HideInInspector]
    public bool hasContainer = false;
    public bool isOn;

    // Use this for initialization
    void Start () {
        rbBase = transform.parent.gameObject.GetComponent<Rigidbody2D>();
        rbHook = GetComponent<Rigidbody2D>();
        
        craneContainer = transform.parent.parent.parent.Find("CraneContainer").gameObject;

        left = true;
        untrapPlayer();
    }
	
	// Update is called once per frame
	void Update () {
        if (UiController.sceneIndex == 1)
            GetComponent<AudioSource>().volume = 0;
        else
            GetComponent<AudioSource>().volume = PlayerPrefs.GetFloat("SFXvolume") * GetComponent<AudioSource>().volume;

        if (isOn)
        {
            if (up)
            {
                rbHook.velocity = new Vector2(0, speed);
                rbBase.velocity = Vector2.zero;
            }

            else if (down)
            {
                rbBase.velocity = Vector2.zero;
                rbHook.velocity = new Vector2(0, -speed);
            }

            else if (left)
            {
                rbHook.velocity = new Vector2(-speed, 0);
                rbBase.velocity = new Vector2(-speed, 0);
            }

            else if (right)
            {
                rbHook.velocity = new Vector2(speed, 0);
                rbBase.velocity = new Vector2(speed, 0);
            }

            else
            {
                rbBase.velocity = Vector2.zero;
                rbHook.velocity = Vector2.zero;
            }
        }
        else
        {
            rbBase.velocity = Vector2.zero;
            rbHook.velocity = Vector2.zero;
        }

        if (hasContainer)
            craneContainer.GetComponent<Rigidbody2D>().velocity = rbHook.velocity;

        if (craneContainer.GetComponent<BoxCollider2D>().isTrigger)
            untrapPlayer();
    }

    void OnTriggerEnter2D(Collider2D other)
    {
        GameObject obj = other.gameObject;
        if (obj.tag == "Bottom Left Anchor" || obj.tag == "Bottom Right Anchor")
        {
            if(obj == transform.parent.parent.parent.Find("Crane BLeft Anchor").gameObject || obj == transform.parent.parent.parent.Find("Crane BRight Anchor").gameObject)
            {
                up = true;
                down = false;
                rbHook.velocity = new Vector2(0, speed);

                if (hasContainer)
                {
                    craneContainer.GetComponent<Rigidbody2D>().velocity = Vector2.zero;
                    hasContainer = false;
                    untrapPlayer();
                }
                else
                {
                    craneContainer.GetComponent<Rigidbody2D>().velocity = rbHook.velocity;
                    hasContainer = true;
                    trapPlayer();
                }

                GetComponent<Collider2D>().enabled = false;
                Invoke("resetcollider", 0.5f);
            }
        }
        else if (obj.tag == "Top Left Anchor" && obj == transform.parent.parent.parent.Find("Crane TLeft Anchor").gameObject)
        {
            if (up)
            {
                if(hasContainer)
                {
                    right = true;
                    up = false;
                }
                else
                {
                    down = true;
                    up = false;
                }
            }
            if (left)
            {
                down = true;
                left = false;
            }
        }
        else if (obj.tag == "Top Right Anchor" && obj == transform.parent.parent.parent.Find("Crane TRight Anchor").gameObject)
        {
            if (up)
            {
                if (hasContainer)
                {
                    left = true;
                    up = false;
                }
                else
                {
                    down = true;
                    up = false;
                }
            }
            if (right)
            {
                down = true;
                right = false;
            }
        }
    }

    void resetcollider()
    {
        GetComponent<Collider2D>().enabled = true;
    }

    void trapPlayer()
    {
        transform.Find("Left Sub Arm").GetComponent<BoxCollider2D>().enabled = true;
        transform.Find("Right Sub Arm").GetComponent<BoxCollider2D>().enabled = true;
    }

    void untrapPlayer()
    {
        transform.Find("Left Sub Arm").GetComponent<BoxCollider2D>().enabled = false;
        transform.Find("Right Sub Arm").GetComponent<BoxCollider2D>().enabled = false;
    }
}
<file_sep>/Library/Collab/Original/Assets/Scripts/UiController.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class UiController : MonoBehaviour {

    public static bool playerDied = false; //toggles true on death, maybe can show cutscene
    public static bool pause = false; // used to pause game
    public static bool nextLevel = false; //checks if level passed
    public static bool stageSelect = false;
    public static bool options = false;
    public static bool gameClear = false;
    public static bool dying = false;

    //For all tutorials
    public static bool tutorialOn = false;

    //  public static bool surePrompt = false;
    private bool confirm = false;
    private bool deathmenu = false;

    private LevelManager levelManager;
    private StageSelection stageSelection;

    private GameObject startMenu;
    private GameObject pauseMenu;
    private GameObject optionsMenu;
    private GameObject stageSelectMenu;
    private GameObject sureBoPrompt;
    private GameObject pauseButton;
    private GameObject completionScreen;
    private GameObject dieMenu;
    private GameObject zoomButton;

    private GameObject movementControls;

    public GameObject stagePageOne;
    public GameObject stagePageTwo;

    public GameObject timingTopLeft;
    public Text pauseTiming;
    public Text levelCompletionTiming;
    public Text deadTiming;
    
    public static int sceneIndex;

    private float startTime;
    public float currentTime;

    void Start() {
        levelManager = GetComponent<LevelManager>();
        stageSelection = GetComponent<StageSelection>();
        completionScreen = GameObject.Find("GUI/Level Completed");
        startMenu = GameObject.Find("GUI/Start Menu");
        pauseButton = GameObject.Find("GUI/Pause Button");
        pauseMenu = GameObject.Find("GUI/Pause Menu");
        movementControls = GameObject.Find("GUI/Movement Controls");
        stageSelectMenu = GameObject.Find("GUI/Stage Select Menu");
        dieMenu = GameObject.Find("GUI/Die Screen");
        optionsMenu = GameObject.Find("GUI/Options Menu");
        zoomButton = GameObject.Find("GUI/Zoom Button");

        //stagePageOne = GameObject.Find("GUI/Stage Select Menu/Page One");
        //stagePageTwo = GameObject.Find("GUI/Stage Select Menu/Page Two");

        sceneIndex = SceneManager.GetActiveScene().buildIndex;
        pauseTiming = GameObject.Find("Time Taken").GetComponent<Text>();
        startTime = Time.time;

        if (sceneIndex == 1)
        {
            startMenu.SetActive(true);
            pauseButton.SetActive(false);
            timingTopLeft.SetActive(false);
            movementControls.SetActive(false);
            stageSelectMenu.SetActive(false);
            pauseMenu.SetActive(false);
            optionsMenu.SetActive(false);
            completionScreen.SetActive(false);
            dieMenu.SetActive(false);
            zoomButton.SetActive(false);
        }
        else
        {
            pauseButton.SetActive(true);
            timingTopLeft.SetActive(true);
            startMenu.SetActive(false);
            movementControls.SetActive(true);
            stageSelectMenu.SetActive(false);
            pauseMenu.SetActive(false);
            optionsMenu.SetActive(false);
            completionScreen.SetActive(false);
            dieMenu.SetActive(false);
            zoomButton.SetActive(true);
        }
    }

	// Update is called once per frame
	void Update () {
        if (playerDied)
        {
            if (!deathmenu)
            {
                Invoke("deathMenu", 2f);
                deathmenu = true;
            }

            //for BGM
            GetComponent<AudioSource>().volume = 0;
            GetComponent<Image>().color = new Vector4(GetComponent<Image>().color.r, GetComponent<Image>().color.g, GetComponent<Image>().color.b, 0.2f);
        }
        else
        {
            //Track the time taken for each stage. 
            showTimeTaken();
            GetComponent<AudioSource>().volume = PlayerPrefs.GetFloat("BGMvolume");

            if (sceneIndex != 1)
            {
                if (tutorialOn)
                {
                    Time.timeScale = 0f;
                    GetComponent<Image>().color = new Vector4(GetComponent<Image>().color.r, GetComponent<Image>().color.g, GetComponent<Image>().color.b, 0.3f);
                    timingTopLeft.SetActive(false);
                    movementControls.SetActive(false);
                }
                else
                {
                    Time.timeScale = 1f;
                    GetComponent<Image>().color = new Vector4(GetComponent<Image>().color.r, GetComponent<Image>().color.g, GetComponent<Image>().color.b, 0f);
                    timingTopLeft.SetActive(true);
                    movementControls.SetActive(true);
                }
            }
            else
            {
                GetComponent<Image>().color = new Vector4(GetComponent<Image>().color.r, GetComponent<Image>().color.g, GetComponent<Image>().color.b, 0.3f);
            }

            if (pause)
            {
                Time.timeScale = 0f;
                pauseMenu.SetActive(true);
            }
            else
            {
                Time.timeScale = 1.0f;
                pauseMenu.SetActive(false);
            }

            if (gameClear)
            {
                Time.timeScale = 0;
                stageSelection.checkStarsObtained();
                completionScreen.SetActive(true);
            }

            if (nextLevel)
            {
                Time.timeScale = 1;
                completionScreen.SetActive(false);
                print("Load Next level!");
                levelManager.nextLevel();
            }

            if (stageSelect)
            {
                startMenu.SetActive(false);
                pauseButton.SetActive(true);
                movementControls.SetActive(false);
                stageSelectMenu.SetActive(true);
                stagePageOne.SetActive(true);
                pauseMenu.SetActive(false);
                optionsMenu.SetActive(false);
                completionScreen.SetActive(false);
                dieMenu.SetActive(false);
            }

            if (options)
            {
                startMenu.SetActive(false);
                pauseButton.SetActive(true);
                movementControls.SetActive(false);
                stageSelectMenu.SetActive(false);
                stagePageOne.SetActive(true);
                pauseMenu.SetActive(false);
                optionsMenu.SetActive(true);
                completionScreen.SetActive(false);
                dieMenu.SetActive(false);
            }
        }



        // if (surePrompt){
        //     startMenu.SetActive(false);
        //     pauseButton.SetActive(false);
        //     movementControls.SetActive(false);
        //     stageSelectMenu.SetActive(false);
        //     stagePageOne.SetActive(false);
        //     pauseMenu.SetActive(false);
        //     optionsMenu.SetActive(false);
        //     completionScreen.SetActive(false);
        // }
    }

    public void closeScreen()
    {
        if (options)
        {
            options = false;
            optionsMenu.SetActive(false);
        }
        if (stageSelect)
        {
            stageSelect = false;
            stageSelectMenu.SetActive(false);
        }

        if (sceneIndex == 1)
            startMenu.SetActive(true);
        else
            pause = true;
    }

    public void pauseGame() {
        if (pause) {
            pause = false;
            print("Resume Game!");
        } else {
            
            pause = true;
            print("Pause Game!");
        }
    }

    public void startGame() {
        options = false;
        nextLevel = true;
        print("Start Game!");
    }

    public void toggleSelectStage(){
        if(stageSelect){
            stageSelect = false;
        } else {
            dying = false;
            options = false;
            stageSelect = true;
            print("Select Stage");
        }
    }

    public void returnToHome(){
        options = false;
        stageSelect = false;
        pause = false;
        playerDied = false;
        levelManager.loadHomeScene();
        print("Return to Home View!");
    }

    //for controlling the stage select menu
    public void previousPage(){
        stagePageOne.SetActive(!stagePageOne.activeInHierarchy);
        print("show page 1!");
        stagePageTwo.SetActive(false);
    }

    public void nextPage(){
        if (stagePageTwo.activeInHierarchy == false){
            stagePageOne.SetActive(!stagePageOne.activeInHierarchy);
            print("show page 2!");
            stagePageTwo.SetActive(true);
        }
    }

    public void toggleOptions(){
        if (options){
            options = false;
            print("Close Options");
        } else {
            stageSelect = false;
            options = true;
            print("Options");
        }
    }

    public void reloadLevel(){
        if (sceneIndex == 1){
            print("Do not do anything when it's in the main screen. Why would you want to restart when you are in the main screen?!");
        } else {
            pause = false;
            options = false;
            gameClear = false;
            Time.timeScale = 1;
            playerDied = false;
            levelManager.loadCurrentLevel();
            print("Reload level!");
        }
    }

    private void showTimeTaken(){
        currentTime = Time.time - startTime;
        currentTime = Mathf.Round(currentTime * 100f) / 100f;
        pauseTiming.text = currentTime.ToString();
        levelCompletionTiming.text = currentTime.ToString();
        timingTopLeft.GetComponentInChildren<Text>().text = currentTime.ToString();
        deadTiming.text = currentTime.ToString();
    }

    public void playButton(){
        if (sceneIndex == 1){
            startGame();
        } else {
            if (options){
                options = false;
                optionsMenu.SetActive(false);
            }
            pauseGame();
        }
    }

    public void nextStage(){
        nextLevel = true;
    }

    public void deathMenu()
    {
        dieMenu.SetActive(true);
    }


// For Debugging purposes //
    public void eraseAllData(){
        PlayerPrefs.DeleteAll();
        returnToHome();
        print("Cleared all data! Stages back to square 1");
    }

    public void unlock2(){
        PlayerPrefs.SetInt("SceneTwoStars", 1);
        returnToHome();
    }

    public void unlock6(){
        PlayerPrefs.SetInt("SceneSixStars", 1);
        returnToHome();
    }

    public void loadFinalCut(){
        levelManager.loadSelectedLevel(10);
    }
}
<file_sep>/Assets/Scripts/CraneTutorial.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class CraneTutorial : MonoBehaviour {
    List<GameObject> list = new List<GameObject>();
    private GameObject[] tutorialList;

    private float accumtime = 0;
    public static int n;

    public float displayTime;

    // Use this for initialization
    void Start () {
        foreach(Transform child in transform)
        {
            if (child != transform)
                list.Add(child.gameObject);
        }
        tutorialList = list.ToArray();
        for (int x = 0; x < transform.childCount; x++)
        {
            if (x == 0)
                tutorialList[x].SetActive(true);
            else
                tutorialList[x].SetActive(false);
        }
        n = 0;
    }

    // Update is called once per frame
    void Update () {
        if (n == 0)
            tutorialList[n].SetActive(true);
        if (n < transform.childCount)
        {
            accumtime += Time.deltaTime;
            if (accumtime > displayTime)
            {
                tutorialList[n].SetActive(false);
                accumtime = 0;
                n++;
                if (n < transform.childCount)
                    tutorialList[n].SetActive(true);
            }
        }
	}
}
<file_sep>/Assets/Scripts/FinalScene.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FinalScene : MonoBehaviour {

	private LevelManager levelManager;
	private UnityEngine.Video.VideoPlayer vp;
	// Use this for initialization
	void Awake () {
		levelManager = GetComponent<LevelManager>();
		vp = GetComponent<UnityEngine.Video.VideoPlayer>();
	}
	
	// Update is called once per frame
	void Update () {
		Invoke("checkIfFinished", 1f);
	}

	void checkIfFinished(){
		if (vp.isPlaying == false){
			levelManager.loadSelectedLevel(0);
		}
	}
}
<file_sep>/Assets/Scripts/Scene1Tutorial.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Scene1Tutorial : MonoBehaviour {

    public GameObject tutorialWall;
    public GameObject arrow1;
    public GameObject arrow2;
    public GameObject arrow3;


    private float accumtime;
    private int n = 0;

    //Tutorial 1
    private bool tutorial1 = true;

    //Tutorial 2
    private bool tutorial2 = false;

    //Tutorial 3
    private bool tutorial3 = false;

    //Tutorial 4
    private bool zoomedIn = false;
    private bool zoomedOut = false;
    private bool tutorial4 = false;

    //Tutorial 5
    private bool tutorial5 = false;

    //Tutorial 6
    private bool tutorial6 = false;

    // Use this for initialization
    void Start () {
        //checks if tutorial has been completed previously
        if (PlayerPrefs.GetInt("Tutorial 1") == 1)
        {
            tutorialWall.SetActive(false);
            gameObject.SetActive(false);
        }
        else
        {
            transform.GetChild(0).gameObject.SetActive(true);
            for (int x = 1; x < transform.childCount; x++)
            {
                transform.GetChild(x).gameObject.SetActive(false);
            }
            arrow1.SetActive(true);
            arrow2.SetActive(false);
            arrow3.SetActive(false);
            UiController.tutorialOn = true;
        }
    }
	
	// Update is called once per frame
	void Update () {
        if (!UiController.tutorialOn)
        {
            for (int x = 0; x < transform.childCount; x++)
            {
                transform.GetChild(x).gameObject.SetActive(false);
            }
        }

        // For Tutorial 1
        if (!arrow1.activeInHierarchy && tutorial1 && !tutorial2)
        {
            UiController.tutorialOn = true;
            transform.GetChild(1).gameObject.SetActive(true);
            arrow2.SetActive(true);
            tutorial2 = true;
        }

        // For Tutorial 2
        if (!arrow2.activeInHierarchy && tutorial2 && !tutorial3)
        {
            UiController.tutorialOn = true;
            transform.GetChild(2).gameObject.SetActive(true);
            arrow3.SetActive(true);
            tutorial3 = true;
        }

        // For Tutorial 3
        if (!arrow3.activeInHierarchy && tutorial3 && !tutorial4)
        {
            UiController.tutorialOn = true;
            transform.GetChild(3).gameObject.SetActive(true);
            tutorial4 = true;
        }

        // For Tutorial 4
        if (GuiController.zoomed)
            zoomedIn = true;
        if (zoomedIn && !GuiController.zoomed)
            zoomedOut = true;
        if (zoomedOut && zoomedIn && tutorial4 && !tutorial5)
        {
            UiController.tutorialOn = true;
            GuiController.zoomed = false;
            transform.GetChild(4).gameObject.SetActive(true);
            tutorialWall.SetActive(false);
            tutorial5 = true;
        }

        //For Tutorial 5
        if (!UiController.tutorialOn && tutorial5 && !tutorial6)
        {
            UiController.tutorialOn = true;
            transform.GetChild(5).gameObject.SetActive(true);
            tutorial6 = true;
        }
        
        //For Tutorial 6
        if (tutorial6 && !UiController.tutorialOn)
        {
            transform.GetChild(5).gameObject.SetActive(false);
        }
        
        if (GuiController.canDismiss)
            transform.GetChild(6).gameObject.SetActive(true);
        else
            transform.GetChild(6).gameObject.SetActive(false);
    }
}
<file_sep>/Assets/Scripts/CharDialogs.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CharDialogs : MonoBehaviour {

	private float startTime;
    private float currentTime;
    [Tooltip("Select a prime number for better effect e.g 7, 11, 13, 17...")]
    public float intervalToShowDialog = 11f;
    public float durationToShowDialog = 3f;
    private int choiceOfDialog;
    private GameObject currentDialog;
    private bool showDialog = true;

	// Use this for initialization
	void Start () {
		for (int n = 0; n < transform.childCount; n++)
        {
            transform.GetChild(n).gameObject.SetActive(false);
        }
		startTime = Time.time;
	}
	
	// Update is called once per frame
	void Update () {
		decideShowDialog();
	}

	void decideShowDialog(){
		currentTime = Time.time - startTime;
		if (Mathf.Round(currentTime) % Mathf.Round(intervalToShowDialog) == 0 && showDialog){
			showDialog = false;
			choiceOfDialog = Random.Range(0, transform.childCount);
			currentDialog = transform.GetChild(choiceOfDialog).gameObject;
			currentDialog.SetActive(true);
			StartCoroutine(closeDialog());
		}
	}

	IEnumerator closeDialog()
     {
         yield return new WaitForSeconds(durationToShowDialog);
         currentDialog.SetActive(false);
         showDialog = true;
     }
}
<file_sep>/Assets/Scripts/SecurityCamera.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SecurityCamera : MonoBehaviour {

    public bool isOn;
    private SpriteRenderer ren;
    private float iniAlpha;

	// Use this for initialization
	void Start () {
        ren = GetComponent<SpriteRenderer>();
        iniAlpha = ren.color.a;
	}

	// Update is called once per frame
	void Update () {
        if (isOn)
        {
            tag = "Enemy";
            ren.color = new Vector4(ren.color.r, ren.color.g, ren.color.b, iniAlpha);
        }
        else
        {
            ren.color = new Vector4(ren.color.r, ren.color.g, ren.color.b, 0f);
            tag = "Security Camera";
        }
	}
}
<file_sep>/Assets/Scripts/CutScene.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CutScene : MonoBehaviour {

	private LevelManager levelManager;
	private UnityEngine.Video.VideoPlayer vp;
	// Use this for initialization
	void Awake () {
		levelManager = GetComponent<LevelManager>();
		vp = GetComponent<UnityEngine.Video.VideoPlayer>();
		if (PlayerPrefs.HasKey("watchedIntro") == false){
			PlayerPrefs.SetInt("watchedIntro", 1);
		} else {
			levelManager.loadSelectedLevel(2);
		}
	}
	
	// Update is called once per frame
	void Update () {
		Invoke("checkIfFinished", 1f);
	}

	void checkIfFinished(){
		if (vp.isPlaying == false){
			levelManager.loadSelectedLevel(2);
		}
	}
}
<file_sep>/Assets/Scripts/GuiController.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;

public class GuiController : MonoBehaviour
{
    public static bool canDismiss = false;
    public static bool isTappedLeft = false;
    public static bool isTappedRight = false;

    public Camera playercamera;
    [Range(0, 1)]
    public float orthoZoomSpeed;
    [Range(5, 15)]
    public float maxCameraSize;
    [Range(0, 5)]
    public float tutorialTime;

    private float initialCameraSize;
    private float accumtime = 0;

    public static bool isJumping = false;
	public static bool isGrounded = true;
    public static bool isDropping = false;
    public static bool onGround = false;
    public static bool downIsPressed = false;
    
    public static bool zoomed = false;

    private bool debugTap = false; //for debugging

    void Start () {
        initialCameraSize = playercamera.orthographicSize; 
    }

    void Awake () {
        isTappedLeft = false;
        isTappedRight = false;
    }

    void Update()
    {
        if (UiController.tutorialOn)
        {
            stopLeft(); stopRight();
            accumtime += Time.deltaTime;

            if (accumtime > tutorialTime)
            {
                canDismiss = true;
                if (Input.touchCount > 0)
                {
                    UiController.tutorialOn = false;
                    canDismiss = false;
                    accumtime = 0;
                }
                
                if (debugTap) //for debug
                {
                    UiController.tutorialOn = false;
                    canDismiss = false;
                    accumtime = 0;
                    debugTap = false;
                }
            }
        }
        
        if (zoomed)
            playercamera.orthographicSize = maxCameraSize;
        else
            playercamera.orthographicSize = initialCameraSize;
    }

    public void detectJump ()
	{
		if (isGrounded) 
			isJumping = true;	
		else
			isJumping = false;
     }

    public void detectDrop()
    {
        if (isGrounded && !onGround && !downIsPressed)
        {
            isDropping = true;
            downIsPressed = true;
            Invoke("stopDrop", 0.4f);
            Invoke("stopPress", 0.7f);
        }
    }
    
    void stopPress()
    {
        downIsPressed = false;
    }

    void stopDrop ()
    {
        isDropping = false;
    }

    public void detectLeft()
    {
        isTappedLeft = true;
    }

    public void stopLeft()
    {
        isTappedLeft = false;
    }

    public void detectRight()
    {
        isTappedRight = true;
    }

    public void stopRight()
    {
        isTappedRight = false;
    }

    public void zoomOut()
    {
        zoomed = true;
    }

    public void zoomIn()
    {
        zoomed = false;
    }

    public void tap() //for debug
    {
        debugTap = true;
    }
}
<file_sep>/Assets/Scripts/Checkpoint.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Checkpoint : MonoBehaviour {
    private float accumTime = 0;

    public float displacement;
    public float period;

	// Use this for initialization
	void Start () {

	}
	
	// Update is called once per frame
	void Update () {
        accumTime += Time.deltaTime;
        if (accumTime < period)
            transform.Translate(Time.deltaTime * displacement, 0, 0);     
        else
        {
            accumTime = 0;
            displacement = -displacement;
        }
	}

    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.tag == "Player")
        {
            gameObject.SetActive(false);
        }
    }
}
<file_sep>/Assets/Scripts/Scene3Tutorial.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Scene3Tutorial : MonoBehaviour {
    
    //Crane tutorial
    public GameObject mainChar;

    // Use this for initialization
    void Start()
    {
        //checks if tutorial has been completed previously
        if (PlayerPrefs.GetInt("Tutorial 3") == 1)
        {
            transform.GetChild(0).gameObject.SetActive(false);
            transform.GetChild(1).gameObject.SetActive(false);
        }
        else
        {
            transform.GetChild(0).gameObject.SetActive(true);
            transform.GetChild(1).gameObject.SetActive(false);
            UiController.tutorialOn = true;
        }
        transform.GetChild(2).gameObject.SetActive(false);
        
        //Crane trivia
        if (transform.Find("Crane Tutorial") != null)
            transform.Find("Crane Tutorial").gameObject.SetActive(false);
    }

    // Update is called once per frame
    void Update()
    {
        //For Tutorial 1
        if (transform.GetChild(0).gameObject.activeInHierarchy)
        {
            if (!UiController.tutorialOn)
            {
                transform.GetChild(0).gameObject.SetActive(false);
                transform.GetChild(1).gameObject.SetActive(true);
                UiController.tutorialOn = true;
            }
        }

        //For Tutorial 2
        if (transform.GetChild(1).gameObject.activeInHierarchy)
        {
            if (!UiController.tutorialOn)
            {
                transform.GetChild(1).gameObject.SetActive(false);
                PlayerPrefs.SetInt("Tutorial 3", 1);
            }
        }
        
        if (GuiController.canDismiss)
            transform.GetChild(2).gameObject.SetActive(true);
        else
            transform.GetChild(2).gameObject.SetActive(false);
        
        //For crane trivia
        if (mainChar.GetComponent<MainChar2D>().onCrane)
            transform.Find("Crane Tutorial").gameObject.SetActive(true);
        else
        {
            transform.Find("Crane Tutorial").gameObject.SetActive(false);
            CraneTutorial.n = 0;
        }
    }
}
<file_sep>/Assets/Scripts/Mini Game/MainCharMini.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MainCharMini : MonoBehaviour
{
    public AudioClip jumpSFX;
    public AudioClip landSFX;
    public AudioClip dieSFX;

    private AudioSource jumpSource;
    private AudioSource landSource;
    private AudioSource dieSource;

    [Range(1, 10)]
    public float walkingSpeed;
    [Range(1, 10)]
    public float jumpHeight;

    private Animator anim;
    private LevelManager levelManager;
    private Rigidbody2D rb;
    private Spriter2UnityDX.EntityRenderer ren;

    private float iniAlpha;
    private bool faceLeft = false;
    
    //[HideInInspector]
    public bool hitLWall = false;
    //[HideInInspector]
    public bool hitRWall = false;

    void Awake()
    {
        jumpSource = gameObject.AddComponent<AudioSource>();
        jumpSource.clip = jumpSFX;
        landSource = gameObject.AddComponent<AudioSource>();
        landSource.clip = landSFX;
        dieSource = gameObject.AddComponent<AudioSource>();
        dieSource.clip = dieSFX;
    }

    // Use this for initialization
    void Start()
    {
        ren = GetComponent<Spriter2UnityDX.EntityRenderer>();
        GetComponent<BoxCollider2D>().isTrigger = false;
        anim = GetComponent<Animator>();
        rb = GetComponent<Rigidbody2D>();
        iniAlpha = ren.Color.a;
    }

    // Update is called once per frame
    void Update()
    {
        if (!anim.GetBool("isDead"))
        {
            if (!UiControllerMini.playerDied)
            {
                //for animation
                if (GuiController.isTappedRight && !hitRWall)
                {
                    anim.SetBool("isRunningRight", true);
                    transform.Translate(Vector3.right * walkingSpeed * Time.deltaTime);
                    hitLWall = false;
                }
                else
                    anim.SetBool("isRunningRight", false);

                if (GuiController.isTappedLeft)
                {
                    anim.SetBool("isRunningLeft", true);
                    if (!hitLWall)
                    {
                        transform.Translate(Vector3.left * walkingSpeed * Time.deltaTime);
                    }
                    hitRWall = false;
                }
                else
                {
                    anim.SetBool("isRunningLeft", false);
                    hitRWall = false;
                }

                //for jump and drop
                if (GuiController.isJumping && GuiController.isGrounded)
                {
                    jumpSource.PlayOneShot(jumpSFX, 0.8f);
                    anim.SetTrigger("isJumping");
                    rb.velocity = new Vector3(0, jumpHeight, 0);
                    GuiController.isJumping = false;
                }
                else
                    anim.SetBool("isJumping", false);

                if (GuiController.isDropping)
                {
                    gameObject.GetComponent<BoxCollider2D>().isTrigger = true;
                    rb.velocity = new Vector2(rb.velocity.x, -0.5f * jumpHeight);
                }
            }
            else
            {
                dieSource.PlayOneShot(dieSFX, 1);
                anim.SetBool("isDead", true);
            }
        }

        //establishes isTrigger based on direction of travel
        if (rb.velocity.y > 0)
        {
            gameObject.GetComponent<BoxCollider2D>().isTrigger = true;
            GuiController.isGrounded = false;
            GuiController.onGround = false;
        }
        else if (rb.velocity.y < 0)
        {
            if (!GuiController.isDropping)
                gameObject.GetComponent<BoxCollider2D>().isTrigger = false;

            GuiController.isGrounded = false;
            GuiController.onGround = false;
        }
        else
            gameObject.GetComponent<BoxCollider2D>().isTrigger = false;
    }

    void OnTriggerEnter2D(Collider2D collider)
    {
        GameObject obj = collider.gameObject;
        if (obj.tag == "Enemy")
            UiControllerMini.playerDied = true;

        if (obj.tag == "Wall")
        {
            if (obj.transform.position.x < transform.position.x)
            {
                transform.Translate(Vector3.right * obj.transform.parent.gameObject.GetComponent<Rigidbody2D>().velocity.x * Time.deltaTime);
                hitLWall = true;
            }
            else
            {
                rb.velocity = new Vector2(0, rb.velocity.y);
                hitRWall = true;
            }
        }
    }

    void OnCollisionEnter2D(Collision2D col)
    {
        GameObject obj = col.gameObject;
        
        if (obj.tag == "Ground" || obj.tag == "Container")
        {
            GuiController.isGrounded = true;
            landSource.PlayOneShot(landSFX, 0.5f);
        }
        if (obj.tag == "Ground")
            GuiController.onGround = true;
        if (obj.tag == "Enemy")
            UiControllerMini.playerDied = true;
    }

    void OnTriggerStay2D(Collider2D collision)
    {
        GameObject obj = collision.gameObject;
        if (obj.tag == "Wall")
        {
            if (obj.transform.position.x < transform.position.x)
            {
                transform.Translate(Vector3.right * obj.transform.parent.gameObject.GetComponent<Rigidbody2D>().velocity.x * Time.deltaTime); 
                hitLWall = true;
            }
            else
            {
                rb.velocity = new Vector2(0, rb.velocity.y);
                hitRWall = true;
            }
        }
    }

    void OnTriggerExit(Collider other)
    {
        if(other.gameObject.tag == "Wall")
        {
            hitRWall = false;
            hitLWall = false;
        }
    } 

    void OnCollisionStay2D(Collision2D col)
    {
        GameObject obj = col.gameObject;
        if (obj.tag == "Ground" || obj.tag == "Container")
            GuiController.isGrounded = true;
        if (obj.tag == "Ground")
            GuiController.onGround = true;
    }
}
<file_sep>/Assets/Scripts/Mini Game/UiControllerMini.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class UiControllerMini : MonoBehaviour
{
    public static bool gameStart = false;
    public static bool playerDied = false; //toggles true on death, maybe can show cutscene
    public static bool pause = false; // used to pause game
    public static bool nextLevel = false; //checks if level passed
    public static bool options = false;
    //  public static bool surePrompt = false;
    private bool confirm = false;
    private float accumtime = 0f;

    private LevelManager levelManager;
    
    private GameObject optionsMenu;
    private GameObject sureBoPrompt;
    private GameObject pauseButton;
    private GameObject levelComplete;
    private GameObject score;
    private GameObject tutorial;

    private GameObject movementControls;

    private int sceneIndex;

    void Start()
    {
        levelManager = GetComponent<LevelManager>();
        pauseButton = GameObject.Find("GUI/Pause Button");
        movementControls = GameObject.Find("GUI/Movement Controls");
        levelComplete = GameObject.Find("GUI/Level Complete");
        score = GameObject.Find("GUI/Score");
        optionsMenu = GameObject.Find("GUI/Options Menu");
        tutorial = GameObject.Find("GUI/Tutorial");

        //stagePageOne = GameObject.Find("GUI/Stage Select Menu/Page One");
        //stagePageTwo = GameObject.Find("GUI/Stage Select Menu/Page Two");

        sceneIndex = SceneManager.GetActiveScene().buildIndex;

        levelComplete.SetActive(false);
        optionsMenu.SetActive(false);
        movementControls.SetActive(false);
        score.SetActive(false);
        pauseButton.SetActive(false);

        gameStart = false;
        playerDied = false;
        pause = false;
        nextLevel = false;
        options = false;
    }

    // Update is called once per frame
    void Update()
    {

        //pre-game instructions
        if (!gameStart)
        {
            //for BGM
            GetComponent<AudioSource>().volume = 0.2f * PlayerPrefs.GetFloat("BGMvolume");

            accumtime += Time.deltaTime;
            if (tutorial.transform.GetChild(0).gameObject.activeInHierarchy && accumtime > 2f)
            {
                tutorial.transform.GetChild(0).gameObject.SetActive(false);
                tutorial.transform.GetChild(1).gameObject.SetActive(true);
                accumtime = 0f;
            }
            else if (tutorial.transform.GetChild(1).gameObject.activeInHierarchy && accumtime > 1f)
            {
                tutorial.transform.GetChild(1).gameObject.SetActive(false);
                tutorial.transform.GetChild(2).gameObject.SetActive(true);
                accumtime = 0f;
            }
            else if (tutorial.transform.GetChild(2).gameObject.activeInHierarchy && accumtime > 1f)
            {
                tutorial.transform.GetChild(2).gameObject.SetActive(false);
                tutorial.transform.GetChild(3).gameObject.SetActive(true);
                accumtime = 0f;
            }
            else if (tutorial.transform.GetChild(3).gameObject.activeInHierarchy && accumtime > 1f)
            {
                tutorial.transform.GetChild(3).gameObject.SetActive(false);
                gameStart = true;
            }
        }
        else if (!playerDied)
        {
            //for BGM
            GetComponent<AudioSource>().volume = PlayerPrefs.GetFloat("BGMvolume");

            pauseButton.SetActive(true);
            movementControls.SetActive(true);
            score.SetActive(true);
            optionsMenu.SetActive(false);
            GetComponent<Image>().color = new Vector4(GetComponent<Image>().color.r, GetComponent<Image>().color.g, GetComponent<Image>().color.b, 0f);
        }
        else    
        {
            //for BGM
            GetComponent<AudioSource>().volume = 0;

            levelComplete.SetActive(true);
            pauseButton.SetActive(false);
            GetComponent<Image>().color = new Vector4(GetComponent<Image>().color.r, GetComponent<Image>().color.g, GetComponent<Image>().color.b, 0.2f);
            score.SetActive(false);
            movementControls.SetActive(false);
            Invoke("nextStage", 3.5f);
        }

        if (pause)
        {
            Time.timeScale = 0f;
            optionsMenu.SetActive(true);
        }
        else
        {
            Time.timeScale = 1.0f;
            optionsMenu.SetActive(false);
        }
        
        if (nextLevel)
        {
            Time.timeScale = 1;
            print("Load Next level!");
            levelManager.nextLevel();
        }

        if (options)
        {
            pauseButton.SetActive(false);
            movementControls.SetActive(false);
            optionsMenu.SetActive(true);
        }

        // if (surePrompt){
        //     pauseButton.SetActive(false);
        //     movementControls.SetActive(false);
        //     stageSelectMenu.SetActive(false);
        //     stagePageOne.SetActive(false);
        //     optionsMenu.SetActive(false);
        // }
    }

    // void initialiseVolume(){
    //     if (PlayerPrefs.HasKey("MusicVol") == false){
    //         PlayerPrefs.SetFloat("MusicVol", 0.9f);
    //     }
    //     if (PlayerPrefs.HasKey("SFXVol") == false){
    //         PlayerPrefs.SetFloat("SFXVol", 0.9f);
    //     }
    // }

    public void pauseGame()
    {
        if (pause)
        {
            pause = false;
            print("Resume Game!");
        }
        else
        {

            pause = true;
            print("Pause Game!");
        }
    }

    public void startGame()
    {
        options = false;
        nextLevel = true;
        print("Start Game!");
    }

    public void returnToHome()
    {
        options = false;
        pause = false;
        levelManager.loadHomeScene();
        print("Return to Home View!");
    }
    

    public void toggleOptions()
    {
        if (options)
        {
            options = false;
            print("Close Options");
        }
        else
        {
            options = true;
            print("Options");
        }
    }

    public void reloadLevel()
    {
        if (sceneIndex == 0)
        {
            print("Do not do anything when it's in the main screen. Why would you want to restart when you are in the main screen?!");
        }
        else
        {
            pause = false;
            options = false;
            gameStart = false;
            Time.timeScale = 1;
            levelManager.loadCurrentLevel();
            print("Reload level!");
        }
    }
    
    public void playButton()
    {
        if (sceneIndex == 0)
        {
            if (PlayerPrefs.GetInt("SceneOneStars") != 4)
                levelManager.loadSelectedLevel(1); //goes to video cutscene
            if (PlayerPrefs.GetInt("SceneTwoStars") != 4)
                levelManager.loadSelectedLevel(3);
            if (PlayerPrefs.GetInt("SceneThreeStars") != 4)
                levelManager.loadSelectedLevel(4);
            if (PlayerPrefs.GetInt("SceneFourStars") != 4)
                levelManager.loadSelectedLevel(5);
            if (PlayerPrefs.GetInt("SceneFiveStars") != 4)
                levelManager.loadSelectedLevel(6);
            if (PlayerPrefs.GetInt("SceneSixStars") != 4)
                levelManager.loadSelectedLevel(7);
            if (PlayerPrefs.GetInt("SceneSevenStars") != 4)
                levelManager.loadSelectedLevel(8);
            if (PlayerPrefs.GetInt("SceneMini") != 4)
                levelManager.loadSelectedLevel(9);
        }
        else
        {
            if (options)
            {
                options = false;
                optionsMenu.SetActive(false);
            }
            pauseGame();
        }
    }

    public void nextStage()
    {
        playerDied = false;
        nextLevel = true;
    }


    // For Debugging purposes //
    public void eraseAllData()
    {
        PlayerPrefs.DeleteAll();
        returnToHome();
        print("Cleared all data! Stages back to square 1");
    }

    public void unlock2()
    {
        PlayerPrefs.SetInt("SceneTwoStars", 1);
        returnToHome();
    }

    public void unlock6()
    {
        PlayerPrefs.SetInt("SceneSixStars", 1);
        returnToHome();
    }

    public void loadFinalCut()
    {
        levelManager.loadSelectedLevel(9);
    }
}
<file_sep>/Assets/Scripts/Mini Game/SecurityCameraMini.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SecurityCameraMini : MonoBehaviour {

    private bool isOn = false;
    private SpriteRenderer ren;
    private float iniAlpha;
    private float accumtime = 0;

    public float onTime;
    public float offTime;

    // Use this for initialization
    void Start () {
        ren = GetComponent<SpriteRenderer>();
        iniAlpha = ren.color.a;
    }
	
	// Update is called once per frame
	void Update () {
        accumtime += Time.deltaTime;
        if(accumtime > offTime && !isOn)
        {
            isOn = true;
            accumtime = 0;
        }
        if (accumtime > onTime && isOn)
        {
            isOn = false;
            accumtime = 0;
        }
        if (isOn)
        {
            tag = "Enemy";
            ren.color = new Vector4(ren.color.r, ren.color.g, ren.color.b, iniAlpha);
        }
        else
        {
            ren.color = new Vector4(ren.color.r, ren.color.g, ren.color.b, 0.1f);
            tag = "Untagged";
        }
    }
}
<file_sep>/Assets/Scripts/CraneContainer.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CraneContainer : MonoBehaviour {

    private Rigidbody2D rb;
    
    public bool hasPlayer = false;

    // Use this for initialization
    void Start () {
        rb = GetComponentInParent<Rigidbody2D>();
    }
	
	// Update is called once per frame
	void Update () {
        if (rb.velocity == Vector2.zero || hasPlayer)
            transform.parent.GetComponent<BoxCollider2D>().isTrigger = false;
        else
            transform.parent.GetComponent<BoxCollider2D>().isTrigger = true;
    }

    void OnTriggerEnter2D(Collider2D other)
    {
        if(rb.velocity.y < 0 && other.gameObject.tag == "Player")
        {
            UiController.playerDied = true;
            print("Player died");
        }
    }
}
<file_sep>/Assets/Scripts/Mini Game/LevelCompletion.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class LevelCompletion : MonoBehaviour {
    public GameObject score;

    private float accumtime = 0;
    private float a = 0.01f;
    private bool wasOff = true;

	// Use this for initialization
	void Start () {
        
    }

	
	// Update is called once per frame
	void Update () {
        if(isActiveAndEnabled && wasOff)
        {
            GetComponent<Text>().text = GetComponent<Text>().text + " Score: " + score.GetComponent<Text>().text;
            wasOff = false;
        }

        accumtime += Time.deltaTime;
        if (accumtime > 0.1 && GetComponent<Text>().fontSize < 90)
        {
            GetComponent<Text>().fontSize += 6;
            a += a;
            accumtime = a;
        }
	}
}
<file_sep>/Assets/Scripts/Switch.cs
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Switch : MonoBehaviour {

    List<GameObject> objList = new List<GameObject>();
    private bool triggerswitch = false;

    [Range (0f, 90f)]
    public float switchAngle;

	// Use this for initialization
	void Start () {
        //gets all children that are to be switched on/off
        foreach (Transform child in transform.parent)
        {
            if (child != transform && child != transform.Find("Switch Sprite"))
                objList.Add(child.gameObject);
        }
	}


	// Update is called once per frame
	void Update () {
		if (triggerswitch)
        {
            foreach (GameObject obj in objList)
            {
                switch (obj.tag)
                {
                    case "Crane":
                        obj.transform.Find("Crane").Find("Control Base").Find("Cable And Hook").GetComponent<Crane>().isOn = !obj.transform.Find("Crane").Find("Control Base").Find("Cable And Hook").GetComponent<Crane>().isOn;
                        break;
                    case "Security Camera":
                        obj.GetComponentInChildren<SecurityCamera>().isOn = !obj.GetComponentInChildren<SecurityCamera>().isOn;
                        break;
                    case "Rotating Camera":
                        obj.transform.Find("Pivot").GetChild(0).GetComponent<RotatingSecurityCamera>().isOn = !obj.transform.Find("Pivot").GetChild(0).GetComponent<RotatingSecurityCamera>().isOn;
                        break;
                    case "ATV":
                        obj.transform.Find("ATV").GetComponent<ATV>().isOn = !obj.transform.Find("ATV").GetComponent<ATV>().isOn;
                        break;
                    default:
                        break;
                }
            }
            triggerswitch = false;
        }
	}

    void OnTriggerEnter2D(Collider2D collision)
    {
        GameObject obj = collision.gameObject;
        Rigidbody2D rb = obj.GetComponent<Rigidbody2D>();

        if (obj.tag == "Player")
        {
            if (obj.transform.position.x < transform.position.x && transform.rotation.z >= 0)
            {
                transform.Rotate(0, 0, -switchAngle);
                triggerswitch = true;
                switchAngle = -switchAngle;
            }
            if (obj.transform.position.x > transform.position.x && transform.rotation.z < 0)
            {
                transform.Rotate(0, 0, -switchAngle);
                triggerswitch = true;
                switchAngle = -switchAngle;
            }
        }
    }
}
