Пример #1
0
 // Start is called before the first frame update
 void Start()
 {
     subinstance           = submarineMovement.instance;
     previousLightStrength = lights[0].intensity;
     toStart   = lights[0].intensity;
     fromStart = lights[0].intensity;
 }
Пример #2
0
 private void Start()
 {
     diving      = false;
     coll        = GetComponent <BoxCollider>();
     subInstance = submarineMovement.instance;
     abilityUI   = UIManager.instance.abilityUI;
 }
Пример #3
0
 public void Awake()
 {
     if (instance != null)
     {
         return;
     }
     instance = this;
 }
Пример #4
0
    public void SavePlayerData()
    {
        PlayerSaveData saveData = new PlayerSaveData();

        saveData.levelIdx = SceneManager.GetActiveScene().buildIndex;

        if (submarineMovement.instance)
        {
            submarineMovement subInstance = submarineMovement.instance;
            saveData.savePosition = subInstance.submarineStats.submarinePosition;
            saveData.playerHealth = subInstance.submarineStats.health;
        }
        else
        {
            Debug.LogWarning("can't save player in current state");
        }

        string json = JsonUtility.ToJson(saveData);

        File.WriteAllText(Application.persistentDataPath + "/saveData.json", json);
    }