예제 #1
0
    // Update is called once per frame
    private void Update()
    {
        //temp keybind;
        if (Input.GetKeyDown(KeyCode.Space))
        {
            levelGenerator.DestroyOldLevel();
            GoToLevel();
        }

        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            mainCanvas.FadeToBlack();
        }
        if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            mainCanvas.FadeOutBlack();
        }

        ManageInputEvents();

        if (gameHasStarted && _screenSize.Contains(Input.mousePosition))
        {
            RaycastHit hit  = new RaycastHit();
            int        mask = (1 << 9);
            Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 500, ~mask);
            if (hit.transform != null)
            {
                ManageGameObjectOnMouse(hit.transform.gameObject);
            }
        }

        //Fade out the blackground when neccesary
        if (_hasToFadeOut && DateTime.Now > _fadeTime)
        {
            mainCanvas.FadeOutBlack();
            _hasToFadeOut = false;
            gameController.isTransitioning = false;
        }

        if (_loadingLevel)
        {
            LoadLevel();
        }
        if (_loadingHub)
        {
            LoadHub();
        }
    }