Komplett Lauffähig + Vibration + Boni + Enemie "Jumpscares" - Audio
This commit is contained in:
@@ -12,6 +12,7 @@ public class CreditsScript : MonoBehaviour
|
||||
private float maxScrollSpeed = 300f;
|
||||
[SerializeField] public float maxYPosition;
|
||||
[SerializeField] public float minYPosition;
|
||||
[SerializeField] GameObject minYPo;
|
||||
[SerializeField] public TMP_Text text;
|
||||
TMP_Text textfeld;
|
||||
|
||||
@@ -41,6 +42,8 @@ public class CreditsScript : MonoBehaviour
|
||||
|
||||
//this.transform.position.y = minYPosition;
|
||||
Debug.Log("The End");
|
||||
|
||||
this.transform.position = minYPo.transform.position;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,10 +13,14 @@ public class GameOver : MonoBehaviour
|
||||
private float duration = 4f;
|
||||
[SerializeField] public float timer;
|
||||
[SerializeField] TMP_Text deathTime;
|
||||
[SerializeField] TMP_Text infoText;
|
||||
[SerializeField] public TMP_Text infoText;
|
||||
[SerializeField] public TMP_Text GameStateText;
|
||||
[SerializeField] public GameObject retryButton;
|
||||
[SerializeField] public GameObject costField;
|
||||
[SerializeField] TMP_Text costText;
|
||||
[SerializeField] int cost;
|
||||
//[SerializeField] public bool recentDeath; //discaraded
|
||||
[SerializeField] GameObject levelScript;
|
||||
|
||||
[SerializeField] public bool timerOn;
|
||||
|
||||
@@ -27,12 +31,17 @@ public class GameOver : MonoBehaviour
|
||||
|
||||
[SerializeField] GameObject scriptPile;
|
||||
[SerializeField] GameObject eFie;
|
||||
[SerializeField] GameObject eSilv;
|
||||
[SerializeField] GameObject eHai;
|
||||
|
||||
|
||||
InventoryScript inventory;
|
||||
ChangeHealth healthScript;
|
||||
HandleEnergy battery;
|
||||
FieScript fie;
|
||||
SilvScript silv;
|
||||
HaiScript hai;
|
||||
LevelBehavior level;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -40,6 +49,9 @@ public class GameOver : MonoBehaviour
|
||||
healthScript = scriptPile.GetComponent<ChangeHealth>();
|
||||
battery = scriptPile.GetComponent<HandleEnergy>();
|
||||
fie = eFie.GetComponent<FieScript>();
|
||||
hai = eHai.GetComponent<HaiScript>();
|
||||
silv = eSilv.GetComponent<SilvScript>();
|
||||
level = levelScript.GetComponent<LevelBehavior>();
|
||||
}
|
||||
|
||||
void Start()
|
||||
@@ -51,26 +63,26 @@ public class GameOver : MonoBehaviour
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (level.gameWon == true)
|
||||
{
|
||||
CheckWinTime();
|
||||
}
|
||||
else
|
||||
{
|
||||
CheckDeathTime();
|
||||
}
|
||||
|
||||
CheckDeathTime();
|
||||
//if (Time.timeScale == 1)
|
||||
//{
|
||||
// Debug.Log("The game is running.");
|
||||
//}
|
||||
//else if(Time.timeScale == 0)
|
||||
//{
|
||||
// Debug.Log("The game should be paused now.");
|
||||
//}
|
||||
}
|
||||
|
||||
public void ShowDeathScreen()
|
||||
{
|
||||
fie.StopAllCoroutines();
|
||||
//Time.timeScale = 0;
|
||||
timerOn = true;
|
||||
timer = 10f;
|
||||
deathPanel.SetActive(true);
|
||||
LeanTween.scale(deathPanel, transform.localScale * 0.5f, duration * Time.deltaTime).setDelay(.1f).setEase(LeanTweenType.easeOutBounce);
|
||||
retryButton.SetActive(true);
|
||||
costField.SetActive(true);
|
||||
LeanTween.scale(deathPanel, transform.localScale * 1f, duration * Time.deltaTime).setDelay(.1f).setEase(LeanTweenType.easeOutBounce);
|
||||
SpeakEnemy();
|
||||
costText.text = cost.ToString(); //ZUM DEBUGGEN
|
||||
CheckDeathTime();
|
||||
@@ -78,6 +90,25 @@ public class GameOver : MonoBehaviour
|
||||
//OPTION INS MAINMENUE ZURÜCKZUKEHREN
|
||||
}
|
||||
|
||||
public void ShowWinScreen()
|
||||
{
|
||||
Debug.Log("Gut gemacht");
|
||||
StopEnemies();
|
||||
|
||||
timerOn = true;
|
||||
timer = 10f;
|
||||
deathPanel.SetActive(true);
|
||||
LeanTween.scale(deathPanel, transform.localScale * 1f, duration * Time.deltaTime).setDelay(.1f).setEase(LeanTweenType.easeOutBounce);
|
||||
|
||||
|
||||
CheckWinTime();
|
||||
|
||||
GameStateText.text = "You won!";
|
||||
infoText.text = "You earned " + level.earnedGems + " Gems!";
|
||||
retryButton.SetActive(false);
|
||||
costField.SetActive(false);
|
||||
}
|
||||
|
||||
public void GiveNewChance()
|
||||
{
|
||||
if (inventory.Gems >= cost)
|
||||
@@ -97,17 +128,17 @@ public class GameOver : MonoBehaviour
|
||||
|
||||
public void StopBothering()
|
||||
{
|
||||
Time.timeScale = 1; //UNSICHER OB LADEN VON SCENE DEN WERT AUTO. AUF 1 SETZT
|
||||
//Time.timeScale = 1; //UNSICHER OB LADEN VON SCENE DEN WERT AUTO. AUF 1 SETZT //ausgebaut
|
||||
Debug.Log("Jetzt würdest du wieder in die MainMenueScene geschmissen werden");
|
||||
//SceneManager.LoadSceneAsync(0); //MUSS AM ENDE WIEDER EINGEBAUT WERDEN
|
||||
SceneManager.LoadSceneAsync(0);
|
||||
}
|
||||
|
||||
|
||||
public void NewChance()
|
||||
{
|
||||
inventory.Health = healthScript.standardHealth;
|
||||
inventory.Health = inventory.StandardHealth;
|
||||
|
||||
if (battery.standardEnergy >= (inventory.Energy + battery.addEnergyValue))
|
||||
if (inventory.StandardEnergy >= (inventory.Energy + battery.addEnergyValue))
|
||||
{
|
||||
inventory.Energy += battery.addEnergyValue;
|
||||
}
|
||||
@@ -119,6 +150,10 @@ public class GameOver : MonoBehaviour
|
||||
//Logik: bei Retry, soll der Player nochmal neue Energie bekommen
|
||||
|
||||
fie.StartStuff();
|
||||
silv.StartStuff();
|
||||
hai.StartStuff();
|
||||
|
||||
level.gameOngoing = true;
|
||||
}
|
||||
|
||||
public void CheckDeathTime()
|
||||
@@ -140,6 +175,28 @@ public class GameOver : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void CheckWinTime()
|
||||
{
|
||||
if (timerOn == true)
|
||||
{
|
||||
timer += zeit - Time.deltaTime;
|
||||
|
||||
deathTime.text = Convert.ToInt32(timer).ToString();
|
||||
|
||||
if (timer <= 0.0f)
|
||||
{
|
||||
timerOn = false;
|
||||
timer = 10f;
|
||||
|
||||
Debug.Log("Next up: SwitchScene()");
|
||||
|
||||
level.SwitchScene();
|
||||
|
||||
Debug.Log("Just swapped scripts");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CalculateCost()
|
||||
{
|
||||
cost = healthScript.deathCounter * 100;
|
||||
@@ -155,9 +212,6 @@ public class GameOver : MonoBehaviour
|
||||
infoText.text = "But you refused.";
|
||||
}
|
||||
}
|
||||
|
||||
public bool silvKill;
|
||||
public bool haiKill;
|
||||
public void SpeakEnemy()
|
||||
{
|
||||
|
||||
@@ -166,11 +220,11 @@ public class GameOver : MonoBehaviour
|
||||
infoText.text = "HAAHAHAHAHAAHAHAHAHAHAHAHAHA";
|
||||
}
|
||||
|
||||
if (silvKill)
|
||||
if (silv.silvKill)
|
||||
{
|
||||
infoText.text = "Oh no, I accidently killed someone again. I'm sowy. I just wanted to hug you :(";
|
||||
}
|
||||
if (haiKill)
|
||||
if (hai.haiKill)
|
||||
{
|
||||
infoText.text = "You sound great...";
|
||||
}
|
||||
@@ -179,4 +233,10 @@ public class GameOver : MonoBehaviour
|
||||
infoText.text = "Try again?";
|
||||
}
|
||||
}
|
||||
public void StopEnemies()
|
||||
{
|
||||
fie.StopAllCoroutines();
|
||||
silv.StopAllCoroutines();
|
||||
hai.StopAllCoroutines();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,21 +9,20 @@ public class MenueScript : MonoBehaviour
|
||||
public void ReturnHome()
|
||||
{
|
||||
SceneManager.LoadSceneAsync(0);
|
||||
Vibrator.Vibrate();
|
||||
}
|
||||
public void GameStart()
|
||||
{
|
||||
SceneManager.LoadSceneAsync(5);
|
||||
SceneManager.LoadSceneAsync(2);
|
||||
Vibrator.Vibrate();
|
||||
}
|
||||
|
||||
public void Credits()
|
||||
{
|
||||
SceneManager.LoadSceneAsync(2);
|
||||
SceneManager.LoadSceneAsync(1);
|
||||
Vibrator.Vibrate();
|
||||
}
|
||||
|
||||
public void Shop()
|
||||
{
|
||||
SceneManager.LoadSceneAsync(1);
|
||||
}
|
||||
|
||||
public void Quit()
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ShopScript : MonoBehaviour
|
||||
|
||||
[Header("BuyValues")]
|
||||
|
||||
private float moneten = 10.00f; //als vorerstiger Ersatz für tatsächliches Geld
|
||||
private float moneten = 10f; //als vorerstiger Ersatz für tatsächliches Geld
|
||||
|
||||
private float gemsCost = 1.00f; //1€
|
||||
private float manyGemsCost = 2.00f; //2€
|
||||
@@ -39,6 +39,7 @@ public class ShopScript : MonoBehaviour
|
||||
[Header("DevMode")]
|
||||
|
||||
[SerializeField] GameObject devPanel;
|
||||
[SerializeField] GameObject devButton;
|
||||
|
||||
//TMP_Text textfeldA; //als textfeld
|
||||
//TMP_Text textfeldB;
|
||||
@@ -62,6 +63,7 @@ public class ShopScript : MonoBehaviour
|
||||
inventory = backgroundPanel.GetComponent<InventoryScript>();
|
||||
healthScript = backgroundPanel.GetComponent<ChangeHealth>();
|
||||
battery = backgroundPanel.GetComponent<HandleEnergy>();
|
||||
|
||||
|
||||
}
|
||||
void Start()
|
||||
@@ -84,8 +86,8 @@ public class ShopScript : MonoBehaviour
|
||||
|
||||
textfeld.text = inventory.Gems.ToString();
|
||||
|
||||
textfeldA.text = "Energy: " + inventory.Energy.ToString();
|
||||
textfeldB.text = "Health: " + inventory.Health.ToString();
|
||||
textfeldA.text = "Energy: " + inventory.StandardEnergy.ToString();
|
||||
textfeldB.text = "Health: " + inventory.StandardHealth.ToString();
|
||||
textfeldC.text = "Moneten: " + moneten.ToString();
|
||||
|
||||
}
|
||||
@@ -94,7 +96,7 @@ public class ShopScript : MonoBehaviour
|
||||
{
|
||||
shopPanel.SetActive(true);
|
||||
LeanTween.scale(shopPanel, transform.localScale * 0.5f, duration * Time.deltaTime).setDelay(.1f).setEase(LeanTweenType.easeOutBounce);
|
||||
|
||||
Vibrator.Vibrate();
|
||||
}
|
||||
|
||||
public void CloseShop()
|
||||
@@ -121,7 +123,7 @@ public class ShopScript : MonoBehaviour
|
||||
|
||||
else
|
||||
{
|
||||
healthScript.standardHealth++;
|
||||
inventory.StandardHealth++;
|
||||
|
||||
inventory.Gems -= updateCost;
|
||||
}
|
||||
@@ -138,7 +140,7 @@ public class ShopScript : MonoBehaviour
|
||||
|
||||
else
|
||||
{
|
||||
battery.standardEnergy++;
|
||||
inventory.StandardEnergy++;
|
||||
|
||||
inventory.Gems -= updateCost;
|
||||
}
|
||||
@@ -214,6 +216,18 @@ public class ShopScript : MonoBehaviour
|
||||
//textfeldC.text = moneten.ToString();
|
||||
}
|
||||
|
||||
public void ResetValues()
|
||||
{
|
||||
inventory.Gems = 100;
|
||||
inventory.StandardEnergy = 10;
|
||||
inventory.StandardHealth = 3;
|
||||
moneten = 10f;
|
||||
|
||||
errorPanel.SetActive(true);
|
||||
errorText.text = "All values have been reset to standard.";
|
||||
LeanTween.scale(errorPanel, transform.localScale * 0.5f, duration * Time.deltaTime).setDelay(.1f).setEase(LeanTweenType.easeOutBounce);
|
||||
}
|
||||
|
||||
public void ChangeActivation()
|
||||
{
|
||||
SpriteRenderer spriteRenderer = GetComponent<SpriteRenderer>();
|
||||
|
||||
@@ -5,5 +5,6 @@ public class Tester : MonoBehaviour
|
||||
void Start()
|
||||
{
|
||||
Vibrator.Vibrate();
|
||||
Vibrator.Vibrate(1000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,53 @@
|
||||
using JetBrains.Annotations;
|
||||
using UnityEngine;
|
||||
|
||||
public class DoorController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Door door;
|
||||
[SerializeField] GameObject energyScript;
|
||||
[SerializeField] GameObject inventoryScript;
|
||||
|
||||
HandleEnergy energy;
|
||||
InventoryScript inventory;
|
||||
|
||||
|
||||
float timer = 0f;
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
energy = energyScript.GetComponent<HandleEnergy>();
|
||||
inventory = inventoryScript.GetComponent<InventoryScript>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (door.isOpen == false)
|
||||
{
|
||||
TimeDoor();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void OnMouseDown()
|
||||
{
|
||||
if (door.isOpen == true)
|
||||
{
|
||||
door.isOpen = false;
|
||||
Debug.Log("Hier kommt niemand rein");
|
||||
|
||||
if (inventory.Energy > 0)
|
||||
{
|
||||
Vibrator.Vibrate();
|
||||
door.isOpen = false;
|
||||
Debug.Log("Hier kommt niemand rein");
|
||||
energy.LoseEnergy();
|
||||
}
|
||||
else
|
||||
{
|
||||
door.isOpen = true;
|
||||
|
||||
Debug.Log("Die Tür wird dich nicht mehr retten.");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -20,4 +58,16 @@ public class DoorController : MonoBehaviour
|
||||
//door.isOpen = !door.isOpen;
|
||||
|
||||
}
|
||||
|
||||
public void TimeDoor()
|
||||
{
|
||||
timer += Time.deltaTime;
|
||||
//Debug.Log(timer); //FUNKTIONAL
|
||||
|
||||
if (timer >= 5)
|
||||
{
|
||||
door.isOpen = true;
|
||||
timer = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections;
|
||||
using System.Timers;
|
||||
using UnityEngine;
|
||||
|
||||
public class FieScript : MonoBehaviour
|
||||
@@ -12,15 +13,15 @@ public class FieScript : MonoBehaviour
|
||||
[SerializeField] GameObject SPRight;
|
||||
[SerializeField] GameObject SPDeath;
|
||||
|
||||
bool spawn1 = false;
|
||||
bool spawn2 = false;
|
||||
public bool spawnLeft = false;
|
||||
public bool spawn2 = false;
|
||||
|
||||
[Header("Character")]
|
||||
|
||||
[SerializeField] GameObject Fiefetti;
|
||||
//[SerializeField] int damageDealt = 1; //hat aktuell keinen Zweck
|
||||
|
||||
[SerializeField] public float stateTime = 10f;
|
||||
[SerializeField] public float stateTime = 5f;
|
||||
public bool fieKill;
|
||||
|
||||
[Header("Scripts")]
|
||||
@@ -28,23 +29,35 @@ public class FieScript : MonoBehaviour
|
||||
[SerializeField] GameObject scriptPile;
|
||||
[SerializeField] GameObject door1; //1 is always Left
|
||||
[SerializeField] GameObject door2;
|
||||
[SerializeField] GameObject levelScript;
|
||||
|
||||
[SerializeField] GameObject eSilv;
|
||||
[SerializeField] GameObject eHai;
|
||||
|
||||
LevelBehavior level;
|
||||
ChangeHealth healthScript;
|
||||
Door doorSwitch;
|
||||
Door doorSwitch2;
|
||||
|
||||
SilvScript silv;
|
||||
HaiScript hai;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
healthScript = scriptPile.GetComponent<ChangeHealth>();
|
||||
doorSwitch = door1.GetComponent<Door>();
|
||||
doorSwitch2 = door2.GetComponent<Door>();
|
||||
level = levelScript.GetComponent<LevelBehavior>();
|
||||
|
||||
silv = eSilv.GetComponent<SilvScript>();
|
||||
hai = eHai.GetComponent<HaiScript>();
|
||||
}
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
button.SetActive(false); //zum vorherigen Debuggen genutzt
|
||||
spawn1 = false;
|
||||
spawn2 = false;
|
||||
spawnLeft = false;
|
||||
|
||||
|
||||
//StateOne();
|
||||
@@ -69,7 +82,7 @@ public class FieScript : MonoBehaviour
|
||||
|
||||
IEnumerator WanderAround()
|
||||
{
|
||||
|
||||
float elapsed = 0f;
|
||||
Debug.Log("Fiefetti: Wandering around");
|
||||
|
||||
button.SetActive(false);
|
||||
@@ -82,14 +95,18 @@ public class FieScript : MonoBehaviour
|
||||
int random = Random.Range(1, 3);
|
||||
if (random == 1) //1 bedeutet immer left
|
||||
{
|
||||
spawn1 = true;
|
||||
spawnLeft = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
spawn2 = true;
|
||||
spawnLeft = false;
|
||||
}
|
||||
Debug.Log("random = " + random);
|
||||
Debug.Log("random = " + random);
|
||||
|
||||
while (elapsed < stateTime)
|
||||
{
|
||||
elapsed += Time.deltaTime;
|
||||
}
|
||||
yield return new WaitForSeconds(stateTime);
|
||||
|
||||
StartCoroutine(WanderClose());
|
||||
@@ -97,20 +114,28 @@ public class FieScript : MonoBehaviour
|
||||
|
||||
IEnumerator WanderClose()
|
||||
{
|
||||
if (spawn1 == true) //1 bedeutet immer left
|
||||
float elapsed2 = 0;
|
||||
|
||||
if (spawnLeft == true) //1 bedeutet immer left
|
||||
{
|
||||
Fiefetti.transform.position = SPLeft.transform.position;
|
||||
Debug.Log("Ich stehe links.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Fiefetti.transform.position = SPRight.transform.position;
|
||||
Debug.Log("Ich stehe rechts.");
|
||||
}
|
||||
|
||||
StartCoroutine(WanderAround());
|
||||
|
||||
//einen von zwei Punkten aussuchen
|
||||
Debug.Log("Fiefetti: Komme näher");
|
||||
|
||||
while (elapsed2 < stateTime)
|
||||
{
|
||||
elapsed2 += Time.deltaTime;
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(stateTime);
|
||||
|
||||
StartCoroutine(GetTooClose());
|
||||
@@ -118,39 +143,67 @@ public class FieScript : MonoBehaviour
|
||||
|
||||
IEnumerator GetTooClose()
|
||||
{
|
||||
float elapsed3 = 0;
|
||||
|
||||
if (doorSwitch.isOpen == true)
|
||||
float stickAround = 0f;
|
||||
|
||||
if (spawnLeft && doorSwitch.isOpen == true)
|
||||
{
|
||||
Fiefetti.transform.position = SPDeath.transform.position;
|
||||
Debug.Log("Fiefetti: Hab dich!");
|
||||
//reingehen
|
||||
HitPlayer();
|
||||
//StateOne();
|
||||
|
||||
silv.silvKill = false;
|
||||
hai.haiKill = false;
|
||||
fieKill = true;
|
||||
stickAround += Time.deltaTime;
|
||||
if (stickAround >= 2f)
|
||||
{
|
||||
Fiefetti.transform.position = SPBack.transform.position;
|
||||
stickAround = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
else if (doorSwitch2.isOpen == true)
|
||||
else if (!spawnLeft && doorSwitch2.isOpen == true)
|
||||
{
|
||||
Fiefetti.transform.position = SPDeath.transform.position;
|
||||
Debug.Log("Fiefetti: Hab dich!");
|
||||
//reingehen
|
||||
HitPlayer();
|
||||
//StateOne();
|
||||
|
||||
silv.silvKill = false;
|
||||
hai.haiKill = false;
|
||||
fieKill = true;
|
||||
stickAround += Time.deltaTime;
|
||||
if (stickAround >= 2f)
|
||||
{
|
||||
Fiefetti.transform.position = SPBack.transform.position;
|
||||
stickAround = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
//AudioSpielen
|
||||
fieKill = false;
|
||||
|
||||
level.earnedGems += level.earnGems;
|
||||
Debug.Log("Du hast bereits " + level.earnedGems + " Gems verdient.");
|
||||
Debug.Log("Fiefetti: Och menno");
|
||||
Fiefetti.transform.position = SPBack.transform.position;
|
||||
|
||||
}
|
||||
|
||||
spawn1 = false;
|
||||
spawn2 = false;
|
||||
spawnLeft = false;
|
||||
//StateOne();
|
||||
|
||||
while (elapsed3 < stateTime)
|
||||
{
|
||||
elapsed3 += Time.deltaTime;
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(stateTime);
|
||||
|
||||
StartCoroutine(WanderAround());
|
||||
|
||||
206
Assets/Scripts/Enemy/HaiScript.cs
Normal file
206
Assets/Scripts/Enemy/HaiScript.cs
Normal file
@@ -0,0 +1,206 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public class HaiScript : MonoBehaviour
|
||||
{
|
||||
|
||||
[SerializeField] GameObject button;
|
||||
|
||||
[Header("Spawn Points")]
|
||||
|
||||
[SerializeField] GameObject SPBack;
|
||||
[SerializeField] GameObject SPLeft;
|
||||
[SerializeField] GameObject SPRight;
|
||||
[SerializeField] GameObject SPDeath;
|
||||
|
||||
bool spawnLeft = false;
|
||||
|
||||
[Header("Character")]
|
||||
|
||||
[SerializeField] GameObject Hai;
|
||||
//[SerializeField] int damageDealt = 1; //hat aktuell keinen Zweck
|
||||
|
||||
[SerializeField] public float stateTime = 10f;
|
||||
public bool haiKill;
|
||||
|
||||
[Header("Scripts")]
|
||||
|
||||
[SerializeField] GameObject scriptPile;
|
||||
[SerializeField] GameObject door1; //1 is always Left
|
||||
[SerializeField] GameObject door2;
|
||||
[SerializeField] GameObject levelScript;
|
||||
|
||||
[SerializeField] GameObject eFie;
|
||||
[SerializeField] GameObject eSilv;
|
||||
|
||||
ChangeHealth healthScript;
|
||||
Door doorSwitch;
|
||||
Door doorSwitch2;
|
||||
LevelBehavior level;
|
||||
|
||||
FieScript fie;
|
||||
SilvScript silv;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
healthScript = scriptPile.GetComponent<ChangeHealth>();
|
||||
doorSwitch = door1.GetComponent<Door>();
|
||||
doorSwitch2 = door2.GetComponent<Door>();
|
||||
level = levelScript.GetComponent<LevelBehavior>();
|
||||
|
||||
fie = eFie.GetComponent<FieScript>();
|
||||
silv = eSilv.GetComponent<SilvScript>();
|
||||
}
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
button.SetActive(false); //zum vorherigen Debuggen genutzt
|
||||
spawnLeft = false;
|
||||
|
||||
|
||||
//StateOne();
|
||||
StartStuff();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void HitPlayer()
|
||||
{
|
||||
healthScript.GetHit();
|
||||
}
|
||||
|
||||
public void StartStuff()
|
||||
{
|
||||
Debug.Log("I´m starting stuff.");
|
||||
StartCoroutine(WanderAround());
|
||||
}
|
||||
|
||||
IEnumerator WanderAround()
|
||||
{
|
||||
float elapsed = 0;
|
||||
|
||||
Debug.Log("Hai: Wandering around");
|
||||
|
||||
button.SetActive(false);
|
||||
|
||||
Hai.transform.position = SPBack.transform.position;
|
||||
|
||||
//Hauptposition
|
||||
Debug.Log("Hai: Bin hinten");
|
||||
|
||||
int random = Random.Range(1, 3);
|
||||
if (random == 1) //1 bedeutet immer left
|
||||
{
|
||||
spawnLeft = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
spawnLeft = false;
|
||||
}
|
||||
Debug.Log("random = " + random);
|
||||
|
||||
while (elapsed < stateTime)
|
||||
{
|
||||
elapsed += Time.deltaTime;
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(stateTime);
|
||||
|
||||
StartCoroutine(WanderClose());
|
||||
}
|
||||
|
||||
IEnumerator WanderClose()
|
||||
{
|
||||
float elapsed2 = 0;
|
||||
|
||||
if (spawnLeft == true) //1 bedeutet immer left
|
||||
{
|
||||
Hai.transform.position = SPLeft.transform.position;
|
||||
}
|
||||
else
|
||||
{
|
||||
Hai.transform.position = SPRight.transform.position;
|
||||
}
|
||||
|
||||
//einen von zwei Punkten aussuchen
|
||||
Debug.Log("Hai: Komme näher");
|
||||
|
||||
while (elapsed2 < stateTime)
|
||||
{
|
||||
elapsed2 += Time.deltaTime;
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(stateTime);
|
||||
|
||||
StartCoroutine(GetTooClose());
|
||||
}
|
||||
|
||||
IEnumerator GetTooClose()
|
||||
{
|
||||
float elapsed3 = 0;
|
||||
float stickAround = 0f;
|
||||
|
||||
if (spawnLeft && doorSwitch.isOpen == true)
|
||||
{
|
||||
Hai.transform.position = SPDeath.transform.position;
|
||||
Debug.Log("Hai: Hab dich!");
|
||||
//reingehen
|
||||
HitPlayer();
|
||||
|
||||
fie.fieKill = false;
|
||||
silv.silvKill = false;
|
||||
haiKill = true;
|
||||
|
||||
stickAround += Time.deltaTime;
|
||||
if (stickAround >= 2f)
|
||||
{
|
||||
Hai.transform.position = SPBack.transform.position;
|
||||
stickAround = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
else if (!spawnLeft && doorSwitch2.isOpen == true)
|
||||
{
|
||||
Hai.transform.position = SPDeath.transform.position;
|
||||
Debug.Log("Hai: Hab dich!");
|
||||
//reingehen
|
||||
HitPlayer();
|
||||
|
||||
fie.fieKill = false;
|
||||
silv.silvKill = false;
|
||||
haiKill = true;
|
||||
|
||||
stickAround += Time.deltaTime;
|
||||
if (stickAround >= 2f)
|
||||
{
|
||||
Hai.transform.position = SPBack.transform.position;
|
||||
stickAround = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
//AudioSpielen
|
||||
haiKill = false;
|
||||
level.earnedGems += level.earnGems;
|
||||
Debug.Log("Hai: Och menno");
|
||||
Hai.transform.position = SPBack.transform.position;
|
||||
}
|
||||
|
||||
spawnLeft = false;
|
||||
//StateOne();
|
||||
|
||||
while (elapsed3 < stateTime)
|
||||
{
|
||||
elapsed3 += Time.deltaTime;
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(stateTime);
|
||||
|
||||
StartCoroutine(WanderAround());
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Enemy/HaiScript.cs.meta
Normal file
2
Assets/Scripts/Enemy/HaiScript.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd201b6436c5bb94e8e0a18597566fd4
|
||||
@@ -1,3 +1,5 @@
|
||||
using JetBrains.Annotations;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
@@ -7,52 +9,124 @@ public class LevelBehavior : MonoBehaviour
|
||||
[SerializeField] GameObject eSilv;
|
||||
[SerializeField] GameObject eHai;
|
||||
|
||||
FieScript fie;
|
||||
[SerializeField] GameObject deathPanel;
|
||||
[SerializeField] GameObject inventoryScript;
|
||||
|
||||
FieScript fie;
|
||||
SilvScript silv;
|
||||
HaiScript hai;
|
||||
GameOver end;
|
||||
InventoryScript inventory;
|
||||
|
||||
int curScene = 0;
|
||||
float timer = 0f;
|
||||
|
||||
public bool gameOngoing;
|
||||
|
||||
public int earnGems = 5;
|
||||
public int earnedGems = 0;
|
||||
public bool gameWon;
|
||||
private void Awake()
|
||||
{
|
||||
fie = eFie.GetComponent<FieScript>();
|
||||
silv = eSilv.GetComponent<SilvScript>();
|
||||
hai = eHai.GetComponent<HaiScript>();
|
||||
|
||||
end = inventoryScript.GetComponent<GameOver>();
|
||||
inventory = inventoryScript.GetComponent<InventoryScript>();
|
||||
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
gameWon = false;
|
||||
gameOngoing = true;
|
||||
|
||||
// Create a temporary reference to the current scene.
|
||||
Scene currentScene = SceneManager.GetActiveScene();
|
||||
|
||||
// Retrieve the name of this scene.
|
||||
string sceneName = currentScene.name;
|
||||
|
||||
|
||||
// Retrieve the index of the scene in the project's build settings.
|
||||
int buildIndex = currentScene.buildIndex;
|
||||
|
||||
if (sceneName == "Day1")
|
||||
{
|
||||
Debug.Log("Es ist Tag 1");
|
||||
curScene = 2;
|
||||
fie.stateTime = 7;
|
||||
silv.stateTime = 25;
|
||||
hai.stateTime = 35;
|
||||
}
|
||||
|
||||
if (sceneName == "Day2")
|
||||
{
|
||||
|
||||
Debug.Log("Es ist Tag 2");
|
||||
curScene = 5;
|
||||
fie.stateTime = 5;
|
||||
silv.stateTime = 10;
|
||||
hai.stateTime = 25;
|
||||
// Do something...
|
||||
}
|
||||
else if (sceneName == "Day6")
|
||||
else if (sceneName == "Day3")
|
||||
{
|
||||
|
||||
Debug.Log("Es ist Tag 3");
|
||||
curScene = 4;
|
||||
fie.stateTime = 3;
|
||||
silv.stateTime = 10;
|
||||
hai.stateTime = 15;
|
||||
// Do something...
|
||||
}
|
||||
|
||||
// Retrieve the index of the scene in the project's build settings.
|
||||
int buildIndex = currentScene.buildIndex;
|
||||
|
||||
//// Check the scene name as a conditional.
|
||||
//switch (buildIndex)
|
||||
//{
|
||||
// case 0:
|
||||
// // Do something...
|
||||
// break;
|
||||
// case 1:
|
||||
// // Do something...
|
||||
// break;
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
if (gameOngoing == true)
|
||||
{
|
||||
TimeIs();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void TimeIs()
|
||||
{
|
||||
timer += Time.deltaTime;
|
||||
//Debug.Log(timer);
|
||||
|
||||
|
||||
if (timer >= 90)
|
||||
{
|
||||
end.ShowWinScreen();
|
||||
gameWon = true;
|
||||
inventory.Gems += earnedGems;
|
||||
|
||||
timer = 0;
|
||||
|
||||
gameOngoing = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void SwitchScene()
|
||||
{
|
||||
Debug.Log("Ich will jetzt in Scene " + curScene++ + " wechseln.");
|
||||
|
||||
gameOngoing = false;
|
||||
gameWon = false;
|
||||
|
||||
if (curScene < 5)
|
||||
{
|
||||
Debug.Log("Ist noch nicht Tag 3");
|
||||
|
||||
SceneManager.LoadSceneAsync(curScene++);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("Es war Tag 3");
|
||||
SceneManager.LoadScene(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
210
Assets/Scripts/Enemy/SilvScript.cs
Normal file
210
Assets/Scripts/Enemy/SilvScript.cs
Normal file
@@ -0,0 +1,210 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public class SilvScript : MonoBehaviour
|
||||
{
|
||||
|
||||
[SerializeField] GameObject button;
|
||||
|
||||
[Header("Spawn Points")]
|
||||
|
||||
[SerializeField] GameObject SPBack;
|
||||
[SerializeField] GameObject SPLeft;
|
||||
[SerializeField] GameObject SPRight;
|
||||
[SerializeField] GameObject SPDeath;
|
||||
|
||||
bool spawnLeft = false;
|
||||
|
||||
[Header("Character")]
|
||||
|
||||
[SerializeField] GameObject Silv;
|
||||
//[SerializeField] int damageDealt = 1; //hat aktuell keinen Zweck
|
||||
|
||||
[SerializeField] public float stateTime = 15f;
|
||||
public bool silvKill;
|
||||
|
||||
[Header("Scripts")]
|
||||
|
||||
[SerializeField] GameObject scriptPile;
|
||||
[SerializeField] GameObject door1; //1 is always Left
|
||||
[SerializeField] GameObject door2;
|
||||
[SerializeField] GameObject levelScript;
|
||||
|
||||
[SerializeField] GameObject eFie;
|
||||
[SerializeField] GameObject eHai;
|
||||
|
||||
LevelBehavior level;
|
||||
ChangeHealth healthScript;
|
||||
Door doorSwitch;
|
||||
Door doorSwitch2;
|
||||
|
||||
FieScript fie;
|
||||
HaiScript hai;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
level = levelScript.GetComponent<LevelBehavior>();
|
||||
healthScript = scriptPile.GetComponent<ChangeHealth>();
|
||||
doorSwitch = door1.GetComponent<Door>();
|
||||
doorSwitch2 = door2.GetComponent<Door>();
|
||||
|
||||
fie = eFie.GetComponent<FieScript>();
|
||||
hai = eHai.GetComponent<HaiScript>();
|
||||
}
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
button.SetActive(false); //zum vorherigen Debuggen genutzt
|
||||
spawnLeft = false;
|
||||
|
||||
|
||||
//StateOne();
|
||||
StartStuff();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void HitPlayer()
|
||||
{
|
||||
healthScript.GetHit();
|
||||
}
|
||||
|
||||
public void StartStuff()
|
||||
{
|
||||
Debug.Log("I´m starting stuff.");
|
||||
StartCoroutine(WanderAround());
|
||||
}
|
||||
|
||||
IEnumerator WanderAround()
|
||||
{
|
||||
float elapsed = 0;
|
||||
|
||||
Debug.Log("Silv: Wandering around");
|
||||
|
||||
button.SetActive(false);
|
||||
|
||||
Silv.transform.position = SPBack.transform.position;
|
||||
|
||||
//Hauptposition
|
||||
Debug.Log("Silv: Bin hinten");
|
||||
|
||||
int random = Random.Range(1, 3);
|
||||
if (random == 1) //1 bedeutet immer left
|
||||
{
|
||||
spawnLeft = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
spawnLeft = false;
|
||||
}
|
||||
Debug.Log("random = " + random);
|
||||
|
||||
while (elapsed < stateTime)
|
||||
{
|
||||
elapsed += Time.deltaTime;
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(stateTime);
|
||||
|
||||
StartCoroutine(WanderClose());
|
||||
}
|
||||
|
||||
IEnumerator WanderClose()
|
||||
{
|
||||
|
||||
float elapsed2 = 0;
|
||||
|
||||
if (spawnLeft == true) //1 bedeutet immer left
|
||||
{
|
||||
Silv.transform.position = SPLeft.transform.position;
|
||||
}
|
||||
else
|
||||
{
|
||||
Silv.transform.position = SPRight.transform.position;
|
||||
}
|
||||
|
||||
//einen von zwei Punkten aussuchen
|
||||
Debug.Log("Silv: Komme näher");
|
||||
|
||||
while (elapsed2 < stateTime)
|
||||
{
|
||||
elapsed2 += Time.deltaTime;
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(stateTime);
|
||||
|
||||
StartCoroutine(GetTooClose());
|
||||
}
|
||||
|
||||
IEnumerator GetTooClose()
|
||||
{
|
||||
float elapsed3 = 0;
|
||||
|
||||
float stickAround = 0f;
|
||||
|
||||
if (spawnLeft && doorSwitch.isOpen == true)
|
||||
{
|
||||
Silv.transform.position = SPDeath.transform.position;
|
||||
Debug.Log("Silv: Hab dich!");
|
||||
//reingehen
|
||||
HitPlayer();
|
||||
//StateOne();
|
||||
|
||||
fie.fieKill = false;
|
||||
hai.haiKill = false;
|
||||
silvKill = true;
|
||||
|
||||
stickAround += Time.deltaTime;
|
||||
if (stickAround >= 2f)
|
||||
{
|
||||
Silv.transform.position = SPBack.transform.position;
|
||||
stickAround = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
else if (!spawnLeft && doorSwitch2.isOpen == true)
|
||||
{
|
||||
Silv.transform.position = SPDeath.transform.position;
|
||||
Debug.Log("Silv: Hab dich!");
|
||||
//reingehen
|
||||
HitPlayer();
|
||||
//StateOne();
|
||||
|
||||
fie.fieKill = false;
|
||||
hai.haiKill = false;
|
||||
silvKill = true;
|
||||
|
||||
stickAround += Time.deltaTime;
|
||||
if (stickAround >= 2f)
|
||||
{
|
||||
Silv.transform.position = SPBack.transform.position;
|
||||
stickAround = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
//AudioSpielen
|
||||
silvKill = false;
|
||||
level.earnedGems += level.earnGems;
|
||||
Debug.Log("Silv: Och menno");
|
||||
Silv.transform.position = SPBack.transform.position;
|
||||
}
|
||||
|
||||
spawnLeft = false;
|
||||
//StateOne();
|
||||
|
||||
while (elapsed3 < stateTime)
|
||||
{
|
||||
elapsed3 += Time.deltaTime;
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(stateTime);
|
||||
|
||||
StartCoroutine(WanderAround());
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Enemy/SilvScript.cs.meta
Normal file
2
Assets/Scripts/Enemy/SilvScript.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3b3779046044f5944a44d2efba268051
|
||||
@@ -1,4 +1,5 @@
|
||||
using TMPro;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using static UnityEngine.EventSystems.EventTrigger;
|
||||
|
||||
@@ -8,26 +9,50 @@ public class ChangeHealth : MonoBehaviour
|
||||
|
||||
|
||||
[SerializeField] public int deathCounter;
|
||||
[SerializeField] GameObject panel;
|
||||
[SerializeField] GameObject scriptPile;
|
||||
[SerializeField] GameObject scriptPileAgain;
|
||||
[SerializeField] GameObject guessWhatAgain;
|
||||
[SerializeField] TMP_Text healthHUD;
|
||||
[SerializeField] public int standardHealth = 3;
|
||||
//[SerializeField] GameObject levelScript; //wird aktuell nicht genutzt
|
||||
|
||||
|
||||
[Header("Enemies")]
|
||||
[SerializeField] GameObject eFie;
|
||||
[SerializeField] GameObject eSilv;
|
||||
[SerializeField] GameObject eHai;
|
||||
|
||||
[Header("ScriptPile")]
|
||||
|
||||
LevelBehavior level;
|
||||
InventoryScript inventory;
|
||||
GameOver end;
|
||||
|
||||
|
||||
FieScript fie;
|
||||
SilvScript silv;
|
||||
HaiScript hai;
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
inventory = panel.GetComponent<InventoryScript>();
|
||||
end = panel.GetComponent<GameOver>();
|
||||
inventory = scriptPileAgain.GetComponent<InventoryScript>(); //TO DO: FIXEN
|
||||
end = guessWhatAgain.GetComponent<GameOver>();
|
||||
level = scriptPile.GetComponent<LevelBehavior>();
|
||||
|
||||
fie = eFie.GetComponent<FieScript>();
|
||||
silv = eSilv.GetComponent<SilvScript>();
|
||||
hai = eHai.GetComponent<HaiScript>();
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (level.gameOngoing == true)
|
||||
{
|
||||
Debug.Log("ich existiere!");
|
||||
}
|
||||
|
||||
deathCounter = 0;
|
||||
inventory.Health = standardHealth;
|
||||
inventory.Health = inventory.StandardHealth;
|
||||
Debug.Log(inventory.Health);
|
||||
}
|
||||
|
||||
@@ -40,6 +65,8 @@ public class ChangeHealth : MonoBehaviour
|
||||
|
||||
public void GetHit() //MUSS NOCH MIT ENEMIES VERKNÜPFT WERDEN
|
||||
{
|
||||
|
||||
Vibrator.Vibrate();
|
||||
if (inventory.Health > 0)
|
||||
{
|
||||
inventory.Health -= 1; //MAGIC NUMBER BITTE BEACHTEN
|
||||
@@ -55,6 +82,7 @@ public class ChangeHealth : MonoBehaviour
|
||||
|
||||
public void GetHitHard() //MUSS NOCH MIT ENEMIES VERKNÜPFT WERDEN
|
||||
{
|
||||
Vibrator.Vibrate();
|
||||
if (inventory.Health > 0)
|
||||
{
|
||||
inventory.Health -= 2; //MAGIC NUMBER BITTE BEACHTEN
|
||||
@@ -76,6 +104,10 @@ public class ChangeHealth : MonoBehaviour
|
||||
//Time.timeScale = 0; //Wieder umlegen
|
||||
end.ShowDeathScreen();
|
||||
Debug.Log("rest in pizza");
|
||||
|
||||
level.gameOngoing = false;
|
||||
|
||||
end.StopEnemies();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,8 +6,7 @@ public class HandleEnergy : MonoBehaviour
|
||||
{
|
||||
[Header("Values")]
|
||||
|
||||
[SerializeField] public int standardEnergy = 10;
|
||||
[SerializeField] public int addEnergyValue = 2;
|
||||
[SerializeField] public int addEnergyValue = 4;
|
||||
|
||||
[Header("UI and HUD")]
|
||||
|
||||
@@ -29,7 +28,7 @@ public class HandleEnergy : MonoBehaviour
|
||||
|
||||
void Start()
|
||||
{
|
||||
inventory.Energy = standardEnergy;
|
||||
inventory.Energy = inventory.StandardEnergy;
|
||||
Debug.Log(inventory.Energy);
|
||||
}
|
||||
|
||||
|
||||
@@ -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