コード例 #1
0
ファイル: PlayerStats.cs プロジェクト: S00181590/The-Emporium
    private void Update()
    {
        StaminaSlider.value = GetCurrentStamina();
        ManaSlider.value    = GetCurrentMana();
        healthslider.value  = GetCurrentHealth();

        if (PlayersHealth <= 0)
        {
            Time.timeScale = 1f;
            FindObjectOfType <GameOver>().gameoverScreen.SetActive(true);

            if (isdead == true)
            {
                Instantiate(playerDeathFx, transform.position, Quaternion.identity);
                Destroy(gameObject);
            }
        }

        if (PlayersHealth >= MaxHealth)
        {
            PlayersHealth = MaxHealth;
            FindObjectOfType <GameOver>().gameoverScreen.SetActive(false);
        }

        if (PlayersMana >= MaxMana)
        {
            PlayersMana = MaxMana;
        }

        CurrenTime += 1 * Time.deltaTime;
        if (CurrenTime >= 800)
        {
            SaveMangerSystem.SavePlayerData(this);
            //AutosaveText.gameObject.SetActive(true);

            Debug.Log("autoSaved");
            CurrenTime = 0;
        }
        //else
        //{
        //    AutosaveText.gameObject.SetActive(false);
        //}

        if (PlayersMana < MaxMana)
        {
            {
                PlayersMana += 5 * Time.deltaTime;
            }
        }

        if (PlayersStamina < MaxStamina)
        {
            {
                PlayersStamina += 4 * Time.deltaTime;
            }
        }
    }
コード例 #2
0
ファイル: PlayerStats.cs プロジェクト: S00181590/The-Emporium
 public void SavePlayer()
 {
     SaveMangerSystem.SavePlayerData(this);
 }