private void LeaveWork()
        {
            Debug.Log("Clock out time reached");
            ts.timePaused = true;

            if (sceneName == null)
            {
                Debug.LogError("No Scene to load into for this door.");
            }
            else
            {
                int previousMoneyValue = PlayerPrefs.GetInt(GlobalConfig.key_Money);
                int gainedMoney        = CalculateHoursWorked() * 100;
                PlayerPrefs.SetInt(GlobalConfig.key_GainedMoney, gainedMoney);
                previousMoneyValue += gainedMoney;
                PlayerPrefs.SetInt(GlobalConfig.key_Money, previousMoneyValue);

                GlobalConfig.SaveTime(ts);

                SceneTransitioner.FadeOut(sceneName);
            }

            StopCoroutine(CheckForClockOut());
        }
        public void InteractionFunction()
        {
            TimeSystem.Instance.timePaused          = true;
            PlayerMovement.Instance.ableToMove      = false;
            InteractionSystem.Instance.ableToAction = false;

            GlobalConfig.SaveForMorning(TimeSystem.Instance.currentDayOfTheWeek);
            PlayerHealth.Instance.SetLastTimePlayerSlept();

            bool stinkBool = PlayerHealth.Instance.playerStinks;

            if (stinkBool)
            {
                PlayerPrefs.SetInt(GlobalConfig.key_Showering_PlayerStinks, 1);
            }
            else
            {
                PlayerPrefs.SetInt(GlobalConfig.key_Showering_PlayerStinks, 0);
            }

            GlobalConfig.SaveSleepHealth(PlayerHealth.Instance);

            SceneTransitioner.FadeOut(UnityEngine.SceneManagement.SceneManager.GetActiveScene().name);
        }
Beispiel #3
0
 // Use this for initialization
 void Start()
 {
     t = GetComponent <SceneTransitioner>();
 }
Beispiel #4
0
 void Awake()
 {
     S = this;
 }
Beispiel #5
0
 void Start()
 {
     st = new SceneTransitioner();
 }
Beispiel #6
0
    IEnumerator DoLevelLoad(LevelData levelToLoad)
    {
        IsLoading = true;

        Debug.Log("Starting Level Load : " + levelToLoad.SceneFile.SceneName);

        DontDestroyOnLoad(gameObject);

        Scene oldScene = SceneManager.GetActiveScene();

        SceneTransitioner transitioner = SceneTransitioner.GetTransition(SceneTransitionType.Fade);

        transitioner.Run(SceneTransitionDirection.Out, 1f, false);
        yield return(new WaitForSecondsRealtime(1.1f));

        //First load the loading screen
        AsyncOperation loadOp = SceneManager.LoadSceneAsync(SceneNames.LoadingScreen, LoadSceneMode.Single);

        while (!loadOp.isDone)
        {
            yield return(null);
        }

        Fun_MonoBehaviourInitializer.Initialized = false;

        transitioner.Run(SceneTransitionDirection.In, 1f, false);
        yield return(new WaitForSecondsRealtime(1.1f));

        Time.timeScale = 0f;

        //Then load the new level
        loadOp = SceneManager.LoadSceneAsync(levelToLoad.SceneFile.SceneName, LoadSceneMode.Additive);
        Scene sceneToLoad = SceneManager.GetSceneByName(levelToLoad.SceneFile.SceneName);

        loadOp.allowSceneActivation = false;
        while (!loadOp.isDone && !sceneToLoad.isLoaded)
        {
            if (loadOp.progress >= .9f)
            {
                loadOp.allowSceneActivation = true;
            }

            yield return(null);
        }

        Debug.Log("Scene " + levelToLoad.SceneFile.SceneName + " Loaded; Setting Active");
        SceneManager.SetActiveScene(sceneToLoad);

        //now do our fun monobehaviour queueing!!
        Fun_MonoBehaviourInitializer.Run();

        while (!Fun_MonoBehaviourInitializer.Initialized)
        {
            yield return(null);
        }

        yield return(null);

        transitioner.Run(SceneTransitionDirection.Out, 1f, false);
        yield return(new WaitForSecondsRealtime(1.1f));

        //unload the loading screen
        AsyncOperation unloadOp = SceneManager.UnloadSceneAsync(SceneNames.LoadingScreen);

        while (!unloadOp.isDone)
        {
            yield return(null);
        }

        Time.timeScale = 1f;

        Debug.Log("Loading Screen Unloaded");

        transitioner.Run(SceneTransitionDirection.In, 1f, true);
        yield return(new WaitForSecondsRealtime(1.1f));

        IsLoading = false;

        Debug.Log("Successfully Loaded Level : " + levelToLoad.SceneFile.SceneName);

        Destroy(gameObject);
    }
Beispiel #7
0
 private void Awake()
 {
     Instance = this;
     StartCoroutine(FadeOut());
 }
Beispiel #8
0
 protected override void ActionPerformed(GameCharacterController gameCharacterController)
 {
     base.ActionPerformed(gameCharacterController);
     SceneTransitioner.GetInstance().GoToScene(3);
 }
        public void InteractionFunction()
        {
            if (openable)
            {
                PlayerMovement.Instance.ableToMove      = false;
                InteractionSystem.Instance.ableToAction = false;

                if (sceneName == null)
                {
                    Debug.LogError("No Scene to load into for this door.");
                }
                else
                {
                    ts.timePaused = true;

                    if (workDoor)
                    {
                        WeeklyTasks wt = WeeklyTasks.Instance;
                        if (ts.currentHour > 8)
                        {
                            Debug.LogWarning("Player is late to work.");
                            wt.timesLateToWork += 1;
                        }
                        wt.daysWorked += 1;

                        GlobalConfig.SaveWeeklyTasks(wt);
                    }

                    GlobalConfig.SaveTime(ts);

                    GlobalConfig.SaveCitizenStatus(FindObjectOfType <CitizenRanking>());

                    bool stinkBool = PlayerHealth.Instance.playerStinks;

                    if (stinkBool)
                    {
                        PlayerPrefs.SetInt(GlobalConfig.key_Showering_PlayerStinks, 1);
                    }
                    else
                    {
                        PlayerPrefs.SetInt(GlobalConfig.key_Showering_PlayerStinks, 0);
                    }

                    #region Player Inventory
                    PlayerPrefs.SetInt(GlobalConfig.key_Trash, pi.trashOnHand);
                    PlayerPrefs.SetInt(GlobalConfig.key_Money, pi.money);
                    if (pi.hasWeapon)
                    {
                        PlayerPrefs.SetInt(GlobalConfig.key_Weapon, 1);
                    }
                    else
                    {
                        PlayerPrefs.SetInt(GlobalConfig.key_Weapon, 0);
                    }
                    #endregion

                    attachedAnimator.SetTrigger("Open");

                    SceneTransitioner.FadeOut(sceneName);
                }
            }
        }
Beispiel #10
0
 protected override void Die()
 {
     base.Die();
     StartCoroutine(SceneTransitioner.GetInstance().GoToSceneAfterNSeconds(indexScene: 2, deadAnimationTime));
 }
 // Use this for initialization
 void Start()
 {
     t = GetComponent <SceneTransitioner>();
     GetComponent <AudioSource>().PlayOneShot(Resources.Load <AudioClip>("Sound/SFX/Misc/Death"), 0.7f);
 }