コード例 #1
0
    //
    // LEVEL COMPLETED Events
    //
    private void OnLevelComplete(WindowIDs ignore1, WindowIDs ignore)
    {
        _IM.StopInput();
        _inGame        = false;
        Time.timeScale = 0.0f;

        switch (_currentLevel)
        {
        case 1:
            if (SOSaveHandler.CurrentLevel1Time < SOSaveHandler.BestLevel1Time || SOSaveHandler.BestLevel1Time <= 1.0f)
            {
                SOSaveHandler.BestLevel1Time = SOSaveHandler.CurrentLevel1Time;
            }
            break;

        case 2:
            if (SOSaveHandler.CurrentLevel2Time < SOSaveHandler.BestLevel2Time || SOSaveHandler.BestLevel2Time <= 1.0f)
            {
                SOSaveHandler.BestLevel2Time = SOSaveHandler.CurrentLevel2Time;
            }
            break;

        case 3:
            if (SOSaveHandler.CurrentLevel3Time < SOSaveHandler.BestLevel3Time || SOSaveHandler.BestLevel3Time <= 1.0f)
            {
                SOSaveHandler.BestLevel3Time = SOSaveHandler.CurrentLevel3Time;
            }
            break;
        }

        _playeTime = 0.0f;
    }
コード例 #2
0
 /// <summary>
 /// A method that allows all windows derived from GenericWindow to have access to the ToggleWindows method in the WindowManager
 /// </summary>
 /// <param name="close"></param>
 /// <param name="open"></param>
 protected virtual void ToggleWindows(WindowIDs close, WindowIDs open)
 {
     if (OnToggleWindows != null)
     {
         OnToggleWindows(close, open);
     }
 }
コード例 #3
0
 private void OnPauseBackToMain(WindowIDs ignore1, WindowIDs ignore2)
 {
     _paused = false;
     SceneManager.LoadScene(0);
     Time.timeScale = _defaultTimeScale;
     _inGame        = false;
 }
コード例 #4
0
 private void OnLoadNextLevel(WindowIDs ignore1, WindowIDs ignore2)
 {
     SOSaveHandler.NextLevel();
     SceneManager.LoadScene(SOSaveHandler.CurrentLevel);
     _inGame        = true;
     Time.timeScale = _defaultTimeScale;
     _paused        = false;
 }
コード例 #5
0
 private void OnNewGame(WindowIDs ignore1, WindowIDs ignore2)
 {
     SOSaveHandler.NewGame();
     SceneManager.LoadScene(1);
     _inGame    = true;
     _playeTime = 0.0f;
     _paused    = false;
 }
コード例 #6
0
    private void OnPauseRestartLevel(WindowIDs ignore1, WindowIDs ignore2)
    {
        SOSaveHandler.RestartLevel();
        SceneManager.LoadScene(SOSaveHandler.CurrentLevel);
        _paused        = false;
        Time.timeScale = _defaultTimeScale;

        _playeTime = 0.0f;
    }
コード例 #7
0
    private void OnBackToMain(WindowIDs close, WindowIDs open)
    {
        _inGame = false;
        _paused = false;

        if (Application.loadedLevel < 3)
        {
            SOSaveHandler.NextLevel();
        }
        else
        {
            SOSaveHandler.NewGame();
        }
        SceneManager.LoadScene(0);
        Time.timeScale = _defaultTimeScale;
    }
コード例 #8
0
ファイル: WindowManager.cs プロジェクト: tpearce01/ICS168
    // This function handles displaying and un-displaying the windows
    public void ToggleWindows(WindowIDs close, WindowIDs open)
    {
        // If the "close" window being passed in isn't the empty window (-1 in enum), un-display it
        if (close != WindowIDs.None)
        {
            _windows[(int)close].GetComponent <GenericWindow>().Close();
        }

        // Set the current window to the "open" window that was passed in
        currentWindow = open;

        // If the "open" window that was passed in isn't the empty window, display it
        if (currentWindow != WindowIDs.None)
        {
            _windows[(int)currentWindow].GetComponent <GenericWindow>().Open();
        }
    }
コード例 #9
0
    protected override void Awake()
    {
        //_GM = GameManager.Instance.GetComponent<GameManager>(); ;
        _camera         = Camera.main;
        currentWindowID = WindowIDs.None;
        DontDestroyOnLoad(gameObject);

        if (Application.loadedLevel == 0)
        {
            ToggleWindows(WindowIDs.None, WindowIDs.StartWindow);
        }

        // Get a list of all availabe gamepads
        string[] inputs = Input.GetJoystickNames();

        // Determine if the player is using a Dualshock or Xbox controller
        // Stop looking after the first one is found.
        foreach (string input in inputs)
        {
            if (input != "")
            {
                controllerType = input == "Wireless Controller" ? 0 : 1;
                break;
            }
        }

        StandaloneInputModule eventSystem = EventSystemSingleton.Instance.GetComponent <StandaloneInputModule>();

        if (controllerType == 0)
        {
            eventSystem.horizontalAxis = "DS_DPAD_X";
            eventSystem.verticalAxis   = "DS_DPAD_Y";
            eventSystem.submitButton   = "DS_X";
            eventSystem.cancelButton   = "DS_OPTIONS";
        }
        else
        {
            eventSystem.horizontalAxis = "XBOX_DPAD_X";
            eventSystem.verticalAxis   = "XBOX_DPAD_Y";
            eventSystem.submitButton   = "XBOX_A";
            eventSystem.cancelButton   = "XBOX_START";
        }

        DontDestroyOnLoad(eventSystem);
    }
コード例 #10
0
    //
    // Start Window Events
    //
    public void OnContinue(WindowIDs ignore1, WindowIDs ignore2)
    {
        SceneManager.LoadScene(SOSaveHandler.CurrentLevel);
        _inGame = true;
        _paused = false;

        switch (_currentLevel)
        {
        case 1:
            _playeTime = SOSaveHandler.CurrentLevel1Time; break;

        case 2:
            _playeTime = SOSaveHandler.CurrentLevel2Time; break;

        case 3:
            _playeTime = SOSaveHandler.CurrentLevel3Time; break;
        }
    }
コード例 #11
0
    public void ToggleWindows(WindowIDs close, WindowIDs open)
    {
        // Stop all coroutines so there is no ambiguity as to which window should be shown
        StopAllCoroutines();

        // Transitions Checks
        // Start && Stats
        if (close == WindowIDs.StartWindow && open == WindowIDs.StatsWindow)
        {
            StartCoroutine(StartToStatsTransition());
        }
        else if (close == WindowIDs.StatsWindow && open == WindowIDs.StartWindow)
        {
            StartCoroutine(StatsToStartTransition());
        }

        // Start && Level Select
        else if (close == WindowIDs.StartWindow && open == WindowIDs.LevelSelectWindow)
        {
            StartCoroutine(StartToLevelSelectTransition());
        }
        else if (close == WindowIDs.LevelSelectWindow && open == WindowIDs.StartWindow)
        {
            StartCoroutine(LevelSelectToStartTransition());
        }

        // Start && Credits Select
        else if (close == WindowIDs.StartWindow && open == WindowIDs.CreditsWindow)
        {
            StartCoroutine(StartToCreditsTransition());
        }
        else if (close == WindowIDs.CreditsWindow && open == WindowIDs.StartWindow)
        {
            StartCoroutine(CreditsToStartTransition());
        }

        // CHECK TO SEE WHEN THE TITLE SHOULD BE DISPLAYED OR NOT
        if (open == WindowIDs.None || open == WindowIDs.EndOfLevelWindow || currentWindowID == WindowIDs.None)
        {
            _title.enabled = false;
        }
        else
        {
            if (!_title.enabled)
            {
                _title.enabled = true;
            }
        }


        // ACTUAL OPENING CLOSING WINDOWS
        if (close != WindowIDs.None)
        {
            windows[(int)close].Close();
        }
        currentWindowID = open;

        if (currentWindowID != WindowIDs.None)
        {
            windows[(int)currentWindowID].Open();
        }
    }
コード例 #12
0
 //
 // PAUSE MENU EVENTS
 //
 private void OnPauseContinue(WindowIDs ignore1, WindowIDs ignore2)
 {
     _paused        = false;
     Time.timeScale = _defaultTimeScale;
 }
コード例 #13
0
 private void ResetStats(WindowIDs ignore1, WindowIDs ignore2)
 {
     SOSaveHandler.ResetAllStats();
 }