Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        try
        {
            if (type == "WayBack")
            {
                TimeJump typeO = player
                                 .GetComponent <TimeJump>();
                percentLeft = typeO.fuel / typeO.maxFuel;
            }
            else if (type == "JetPack")
            {
                Jetpack typeO = GameObject.Find("JetpackP").GetComponent <Jetpack>();
                percentLeft = typeO.fuel / typeO.maxFuel;
            }
            if (changed != percentLeft)
            {
                Invoke("hide", 2f);
            }
            changed = percentLeft;

            bar.localScale = new Vector3(1f, percentLeft);
        }
        catch
        {
        }
    }
Exemplo n.º 2
0
    private void ActivateTimeJump(TimeJump _timeJump)
    {
        currentTimeJump = _timeJump;

        GameManager.Instance.PauseGame();

        _timeJump.OnFinished.AddListener(DeactivateTimeJump);
        GameManager.Instance.UIManager.ActivateTimeJumpWindow(_timeJump.From, _timeJump.To, _timeJump.OnFinished.Invoke);
    }
Exemplo n.º 3
0
 // Start is called before the first frame update
 void Start()
 {
     tj = player.GetComponent <TimeJump>();
     for (int i = 1; i <= FindObjectsOfType <Camera>().Length; i++)
     {
         cams.Add("Level" + world + "-" + i);
         resets.Add("SpawnPoint" + i);
     }
     cameraWork();
     restart();
 }
Exemplo n.º 4
0
    public void OnNightTime()
    {
        TimeSystem.IsPaused = true;

        //Save current date before it changes to the next day and breaks the system
        EventManager.TimeJumpCheckDate.Day   = TimeSystem.CurrentDate.Day;
        EventManager.TimeJumpCheckDate.Month = TimeSystem.CurrentDate.Month;
        EventManager.TimeJumpCheckDate.Year  = TimeSystem.CurrentDate.Year;

        TimeSystem.SetTimeToMorning();

        //Handle TimeJump already so the right date is saved in the save file
        TimeJump _timeJump = EventManager.CheckForTimeJumpAndReturnJump();

        if (_timeJump != null)
        {
            TimeSystem.SetDate(_timeJump.To);
        }

        //Save the game
        SaveSystem.UpdateSaveData();
        SaveSystem.SaveGame();

        UnityAction _onFinished = null;

        _onFinished += NPCManager.TeleportAllNPCsToTheirHome;
        _onFinished += CameraController.Unfocus;
        _onFinished += PauseGame;

        //Check for escaping colonists (only if they are unhappy)
        if (CheckIfColonistEscapes())
        {
            _onFinished += EventManager.StartColonistEscapesEvent;
        }
        else
        {
            _onFinished += UIManager.ActivateEndOfDayWindow;
        }

        NPCManager.MakeAllNPCsGoHome();
        UIManager.Fade(false, 5f, _onFinished);
    }