Exemplo n.º 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;
 }
Exemplo n.º 2
0
 private void Start()
 {
     diving      = false;
     coll        = GetComponent <BoxCollider>();
     subInstance = submarineMovement.instance;
     abilityUI   = UIManager.instance.abilityUI;
 }
Exemplo n.º 3
0
 public void Awake()
 {
     if (instance != null)
     {
         return;
     }
     instance = this;
 }
Exemplo n.º 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);
    }