Komplett Lauffähig + Vibration + Boni + Enemie "Jumpscares" - Audio
This commit is contained in:
@@ -17,11 +17,17 @@ public class InventoryData
|
||||
//Gems
|
||||
public int gems;
|
||||
|
||||
public InventoryData(int energy, int health, int gems)
|
||||
public int standardHealth;
|
||||
|
||||
public int standardEnergy;
|
||||
|
||||
public InventoryData(int energy, int health, int gems, int standardHealth, int standardEnergy)
|
||||
{
|
||||
this.energy = energy;
|
||||
this.health = health;
|
||||
this.gems = gems;
|
||||
this.standardHealth = standardHealth;
|
||||
this.standardEnergy = standardEnergy;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +47,10 @@ public class InventoryScript : MonoBehaviour
|
||||
//Gems
|
||||
[SerializeField] int gems;
|
||||
|
||||
[SerializeField] int standardHealth = 3;
|
||||
|
||||
[SerializeField] int standardEnergy = 10;
|
||||
|
||||
|
||||
|
||||
private void Awake()
|
||||
@@ -74,6 +84,18 @@ public class InventoryScript : MonoBehaviour
|
||||
set { gems = value; ValChanged(); }
|
||||
}
|
||||
|
||||
public int StandardHealth
|
||||
{
|
||||
get { return standardHealth; }
|
||||
set { standardHealth = value; ValChanged(); }
|
||||
}
|
||||
|
||||
public int StandardEnergy
|
||||
{
|
||||
get { return standardEnergy; }
|
||||
set { standardEnergy = value; ValChanged(); }
|
||||
}
|
||||
|
||||
// Achtung, ValChanged wird NICHT aufgerufen, wenn man die Werte im Inspector verändert,
|
||||
// weil das nur die Felder, nicht die Properties setzt.
|
||||
// Ändert man aber per Script die Property, wird ValChanged aufgerufen und sofort die Werte ins File gespeichert.
|
||||
@@ -98,7 +120,7 @@ public class InventoryScript : MonoBehaviour
|
||||
}
|
||||
private void SaveInventoryData()
|
||||
{
|
||||
inventoryData = new InventoryData(energy, health, gems); // erstellt ein neues Objekt InventoryData aus den Werten dieses Scripts
|
||||
inventoryData = new InventoryData(energy, health, gems, standardHealth, standardEnergy); // erstellt ein neues Objekt InventoryData aus den Werten dieses Scripts
|
||||
string datastring = JsonUtility.ToJson(inventoryData); // macht einen JSON String aus diesem Objekt (dafür brauchen wir es auch nur)
|
||||
File.WriteAllText(path, datastring);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user