// Use this for initialization
    void Start()
    {
        GameObject mainObject = GameObject.FindGameObjectsWithTag("MainObject")[0];

        if (GameObject.FindGameObjectsWithTag("MainObject").Length > 1)
        {
            GameObject[] mainObjectList = GameObject.FindGameObjectsWithTag("MainObject");
            for (int i = 0; i < mainObjectList.Length; ++i)
            {
                if (mainObjectList[i].GetComponent<GameStateManager>().objectSaved)
                    mainObject = mainObjectList[i];
            }
        }

        // Ensures all necessary scripts are added for the MainObject
        gameStateManagerRef = mainObject.GetComponent<GameStateManager>();
        gameStateManagerRef.EnsureGameScriptsAdded();
        worldCollisionRef = gameStateManagerRef.GetWorldCollision();
    }
    // Use this for initialization
    void Start()
    {
        GameObject mainObject = GameObject.FindGameObjectsWithTag("MainObject")[0];

        if (GameObject.FindGameObjectsWithTag("MainObject").Length > 1)
        {
            GameObject[] mainObjectList = GameObject.FindGameObjectsWithTag("MainObject");
            for (int i = 0; i < mainObjectList.Length; ++i)
            {
                if (mainObjectList[i].GetComponent<GameStateManager>().objectSaved)
                    mainObject = mainObjectList[i];
            }
        }

        // Ensures all necessary scripts are added for the MainObject
        gameStateManagerRef = mainObject.GetComponent<GameStateManager>();
        gameStateManagerRef.EnsureGameScriptsAdded();
        worldCollisionRef = gameStateManagerRef.GetWorldCollision();
        playerRef = GameObject.FindGameObjectWithTag("Player").GetComponent<TWCharacterController>();

        //Init local reference - J.C.
        TearManagerLocalRef = GameObject.FindGameObjectWithTag("TearManager").GetComponent<TearManager>();
    }
    // Use this for initialization.
    public void Start()
    {
        // Keeping GameObject component grabbing consistent among classes. - J.T.
        GameObject mainObject = GameObject.FindGameObjectsWithTag("MainObject")[0];

        if(GameObject.FindGameObjectsWithTag("MainObject").Length > 1){
            GameObject[] mainObjectList = GameObject.FindGameObjectsWithTag("MainObject");
            for(int i = 0; i < mainObjectList.Length; ++i){
                if(mainObjectList[i].GetComponent<GameStateManager>().objectSaved){
                    mainObject = mainObjectList[i];
                }
            }
        }

        gameStateManagerRef = mainObject.GetComponent <GameStateManager>();
        gameStateManagerRef.EnsureGameScriptsAdded();
        gameStateManagerRef.EnsureCoreScriptsAdded();
        screenManagerRef = mainObject.GetComponent<ScreenManager>();
        animManagerRef = mainObject.GetComponent<AnimationManager>();
        worldCollisionRef = mainObject.GetComponent<WorldCollision>();
        touchController = gameObject.GetComponent<TouchController>();
        soundManagerRef = gameStateManagerRef.GetSoundManager();
        paperObject = GameObject.FindGameObjectWithTag("background");
        tearBorder = GameObject.FindGameObjectWithTag("DeadSpace");
        foldBorder = GameObject.FindGameObjectWithTag("foldborder");
        unfoldBorder = GameObject.FindGameObjectWithTag("unfoldborder");
        unfoldBlocker = GameObject.FindGameObjectWithTag("RayTraceBlocker");
        moveBorder = GameObject.FindGameObjectWithTag("insideBorder");
        menuButton = GameObject.Find("MenuButton_Prefab");
        restartButton = GameObject.Find("RestartButton_Prefab");
        moveMode = true;
        tearMode = false;
        foldMode = false;
        //Keeping old code here in case something gets broken. - J.T.
        // Ensures all necessary scripts are added for the MainObject.
        /*
        gameStateManagerRef = gameObject.GetComponent<GameStateManager>();
        gameStateManagerRef.EnsureCoreScriptsAdded();
        gameStateManagerRef.EnsureGameScriptsAdded();
        screenManagerRef = gameObject.GetComponent<ScreenManager>();
        animManagerRef = gameObject.GetComponent<AnimationManager>();
        worldCollisionRef = gameObject.GetComponent<WorldCollision>();
        touchController = gameObject.GetComponent<TouchController>();
        */
        idleTriggerLimit = Random.Range (1000, 3000);
        keyDownWatch = new Stopwatch();
        idleKeyWatch = new Stopwatch();
        releaseWatch = new Stopwatch();
        justPressedWatch = new Stopwatch();
        playerBottomCollisionWatch = new Stopwatch();
        idlePlayerWatch = new Stopwatch();

        watchList.Add(keyDownWatch);
        watchList.Add(idleKeyWatch);
        watchList.Add(releaseWatch);
        watchList.Add(justPressedWatch);
        watchList.Add(playerBottomCollisionWatch);
        watchList.Add(idlePlayerWatch);

        wasdRight = KeyCode.D;
        wasdLeft = KeyCode.A;
        arrowRight = KeyCode.RightArrow;
        arrowLeft = KeyCode.LeftArrow;
        keyJump = KeyCode.Space;

        hasHorizontalCollision = false;
        currentDirection = ScreenSide.NONE;
        tornPieceInitiated = false;
        movingTornPiece = false;
    }