Exemple #1
0
 public void NewGame(int saveIndex)
 {
     GlobalPlayerVariables.New(saveIndex);
     UpdateLoadButtons();
     UpdateNewSaveButtons();
     StartGame();
 }
Exemple #2
0
    void Start()
    {
        #if UNITY_EDITOR
        if (GlobalPlayerVariables.save == null)
        {
            print("Loading fake debug save..");
            GlobalPlayerVariables.LoadFakeDebugSave();
        }
        #endif

        Cursor.lockState   = CursorLockMode.Locked;
        cameraController   = transform.GetComponent <CameraController>();
        healthController   = transform.GetComponent <HealthController>();
        movementController = transform.GetComponent <MovementController>();

        // not a direct component of player due to it needing to be attached to MainCamera, but managed as though it were.
        inventoryController = transform.GetComponentInChildren <PlayerInventoryController>();

        // ui components minus anything relating directly to the inventory (ammo, guns)
        uiController = transform.GetComponentInChildren <GameUIController>();
        colorOverlay = transform.GetComponentInChildren <UIColorOverlayController>();
        infoSection  = transform.GetComponentInChildren <UIInfoSectionController>();
        LoadPlayerState();
        uiController.SetValue("UI_HealthPos", (int)Mathf.Clamp(healthController.health, 0f, 999f) + "%");
        uiController.SetValue("UI_ArmorPos", (int)Mathf.Clamp(healthController.armor, 0f, 999f) + "%");
        inventoryController.UpdateGUI();
        //Application.targetFrameRate = 15;
    }
Exemple #3
0
 public void EndLevel()
 {
     MenuNavigation(true);
     GlobalPlayerVariables.Save();
     menuBG.SetActive(true);
     if (GlobalLevelVariables.instanceOf == null)
     {
         EnableMenu(menuMain);
     }
     else
     {
         EnableMenu(endMenu.gameObject, true);
         StartCoroutine(endMenu.BeginAnimations());
     }
 }
Exemple #4
0
    void Start()
    {
        float volumeValue = PlayerPrefs.GetFloat("Volume");

        if (volumeSlider != null)
        {
            volumeSlider.value = volumeValue;
        }

        if (volumeDisplay != null)
        {
            volumeDisplay.SetValue(volumeValue + "");
        }

        GlobalPlayerVariables.LoadAll();
        UpdateLoadButtons();
        UpdateNewSaveButtons();
        isEnabled = true;
        EnableMenu(menuMain);
        pauseMenuBack.gameObject.SetActive(false);
    }
Exemple #5
0
 public void LoadGame(int saveIndex)
 {
     GlobalPlayerVariables.Load(saveIndex);
     StartGame();
 }