Komplett mit Audio, Fehler beim Start der Spielszenen: standardHealth und standardEnergy werden nicht wie gewollt übermittelt
This commit is contained in:
44
Assets/Scripts/Audio/AudioManager.cs
Normal file
44
Assets/Scripts/Audio/AudioManager.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class AudioManager : MonoBehaviour
|
||||
|
||||
//wird noch barbeitet, ist gerade nur ein Copy Past aus Seascape
|
||||
{
|
||||
[Header("Audio Source")]
|
||||
[SerializeField] AudioSource musicSource;
|
||||
[SerializeField] AudioSource SFXSource;
|
||||
|
||||
|
||||
[Header("Audio Clip")]
|
||||
public AudioClip background;
|
||||
|
||||
public AudioClip button;
|
||||
public AudioClip buy;
|
||||
|
||||
[Header("Enemy Audio")]
|
||||
|
||||
public AudioClip fieHit;
|
||||
public AudioClip haiHit;
|
||||
public AudioClip silvHit;
|
||||
public AudioClip rearrange;
|
||||
|
||||
public AudioClip bang;
|
||||
public AudioClip comingCloser;
|
||||
public AudioClip scare;
|
||||
|
||||
[Header("Player")]
|
||||
public AudioClip energyOut;
|
||||
public AudioClip death;
|
||||
public AudioClip door;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
musicSource.clip = background;
|
||||
musicSource.Play();
|
||||
}
|
||||
|
||||
public void PlaySFX(AudioClip clip)
|
||||
{
|
||||
SFXSource.PlayOneShot(clip);
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Audio/AudioManager.cs.meta
Normal file
2
Assets/Scripts/Audio/AudioManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d864abe946f1f26428a70997e338f712
|
||||
@@ -5,7 +5,7 @@ public class SFXManager : MonoBehaviour
|
||||
{
|
||||
public static SFXManager instance;
|
||||
|
||||
[SerializeField] private AudioSource sFXObject;
|
||||
[SerializeField] AudioSource SFXSource;
|
||||
|
||||
private void Awake() {
|
||||
if (instance == null) {
|
||||
@@ -15,7 +15,7 @@ public class SFXManager : MonoBehaviour
|
||||
|
||||
// Muss noch schauen, wie ich das für das jeweilige Vieh seine seperaten Sounds einstelle und nicht universal
|
||||
public void PlaySFXClip(AudioClip clip, Transform spawnTransform, float volume) {
|
||||
AudioSource audioSource = Instantiate(sFXObject, spawnTransform.position, Quaternion.identity);
|
||||
AudioSource audioSource = Instantiate(SFXSource, spawnTransform.position, Quaternion.identity);
|
||||
|
||||
audioSource.clip = clip;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ public class CreditsScript : MonoBehaviour
|
||||
{
|
||||
|
||||
public float scrollSpeed;
|
||||
private float maxScrollSpeed = 300f;
|
||||
private float maxScrollSpeed = 400f;
|
||||
[SerializeField] public float maxYPosition;
|
||||
[SerializeField] public float minYPosition;
|
||||
[SerializeField] GameObject minYPo;
|
||||
@@ -23,7 +23,7 @@ public class CreditsScript : MonoBehaviour
|
||||
scrollSpeed = 200f;
|
||||
textfeld = this.text;
|
||||
|
||||
maxYPosition = 3200;
|
||||
maxYPosition = 8000;
|
||||
minYPosition = 0;
|
||||
rectTransform = GetComponent<RectTransform>();
|
||||
|
||||
@@ -67,11 +67,38 @@ public class CreditsScript : MonoBehaviour
|
||||
{
|
||||
//die Credits einfach hardcoden, dann kann ich die schneller anpassen
|
||||
//funktioniert
|
||||
|
||||
/*
|
||||
textfeld.text = "Assets" +
|
||||
"Dark UI kit by kΩsmaragd on Unity Store" +
|
||||
"Clean Vector Icons by PONETI on Unity Store" +
|
||||
"UX Flat Icons [Free] by Heathen Engineering on Unity Store" +
|
||||
"Help Me Font by GGBotNet on itch.io ";
|
||||
|
||||
|
||||
Lilia:
|
||||
- MusicManager
|
||||
- SFX Manager
|
||||
- Door
|
||||
- DoorController
|
||||
- LightController
|
||||
|
||||
- Fiefetti 3D Modell
|
||||
- Silpathisch 3D Modell
|
||||
- Haiphisch 3D Modell
|
||||
- Level Design
|
||||
- Level 3D Modell
|
||||
|
||||
|
||||
Xilver:
|
||||
- ShopScript
|
||||
- MainMenue
|
||||
- AudioManager
|
||||
- Vibrator
|
||||
- EnemyScripts (FieScript, HaiScript, SilvScript) und weitere Logik
|
||||
- HandleEnergy
|
||||
- ChangeHealth
|
||||
- LevelBehaviour
|
||||
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ public class GameOver : MonoBehaviour
|
||||
[SerializeField] GameObject eFie;
|
||||
[SerializeField] GameObject eSilv;
|
||||
[SerializeField] GameObject eHai;
|
||||
[SerializeField] GameObject audioScript;
|
||||
|
||||
|
||||
InventoryScript inventory;
|
||||
@@ -42,6 +43,7 @@ public class GameOver : MonoBehaviour
|
||||
SilvScript silv;
|
||||
HaiScript hai;
|
||||
LevelBehavior level;
|
||||
AudioManager audio;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -52,12 +54,12 @@ public class GameOver : MonoBehaviour
|
||||
hai = eHai.GetComponent<HaiScript>();
|
||||
silv = eSilv.GetComponent<SilvScript>();
|
||||
level = levelScript.GetComponent<LevelBehavior>();
|
||||
audio = audioScript.GetComponent<AudioManager>();
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
timer = 10f;
|
||||
inventory.Gems = 599;
|
||||
deathPanel.SetActive(false);
|
||||
}
|
||||
|
||||
@@ -76,6 +78,7 @@ public class GameOver : MonoBehaviour
|
||||
|
||||
public void ShowDeathScreen()
|
||||
{
|
||||
audio.PlaySFX(audio.death);
|
||||
//Time.timeScale = 0;
|
||||
timerOn = true;
|
||||
timer = 10f;
|
||||
@@ -118,6 +121,7 @@ public class GameOver : MonoBehaviour
|
||||
Debug.Log(inventory.Gems);
|
||||
timerOn = false;
|
||||
timer = 10f;
|
||||
audio.PlaySFX(audio.rearrange);
|
||||
}
|
||||
|
||||
else //EINBAUEN, DASS MAN DORT GEMS KAUFEN KANN
|
||||
@@ -215,16 +219,16 @@ public class GameOver : MonoBehaviour
|
||||
public void SpeakEnemy()
|
||||
{
|
||||
|
||||
if (fie.fieKill)
|
||||
if (fie.fieKill == true)
|
||||
{
|
||||
infoText.text = "HAAHAHAHAHAAHAHAHAHAHAHAHAHA";
|
||||
}
|
||||
|
||||
if (silv.silvKill)
|
||||
if (silv.silvKill == true)
|
||||
{
|
||||
infoText.text = "Oh no, I accidently killed someone again. I'm sowy. I just wanted to hug you :(";
|
||||
}
|
||||
if (hai.haiKill)
|
||||
if (hai.haiKill == true)
|
||||
{
|
||||
infoText.text = "You sound great...";
|
||||
}
|
||||
|
||||
@@ -6,6 +6,13 @@ using UnityEngine.UIElements;
|
||||
|
||||
public class MenueScript : MonoBehaviour
|
||||
{
|
||||
[SerializeField] GameObject audioScript;
|
||||
AudioManager audio;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
audio = audioScript.GetComponent<AudioManager>();
|
||||
}
|
||||
public void ReturnHome()
|
||||
{
|
||||
SceneManager.LoadSceneAsync(0);
|
||||
@@ -15,6 +22,7 @@ public class MenueScript : MonoBehaviour
|
||||
{
|
||||
SceneManager.LoadSceneAsync(2);
|
||||
Vibrator.Vibrate();
|
||||
audio.PlaySFX(audio.button);
|
||||
}
|
||||
|
||||
public void Credits()
|
||||
|
||||
@@ -24,6 +24,9 @@ public class ShopScript : MonoBehaviour
|
||||
[SerializeField] InventoryScript inventory;
|
||||
[SerializeField] ChangeHealth healthScript;
|
||||
[SerializeField] HandleEnergy battery;
|
||||
[SerializeField] GameObject audioScript;
|
||||
|
||||
AudioManager audio;
|
||||
|
||||
[Header("BuyValues")]
|
||||
|
||||
@@ -63,7 +66,7 @@ public class ShopScript : MonoBehaviour
|
||||
inventory = backgroundPanel.GetComponent<InventoryScript>();
|
||||
healthScript = backgroundPanel.GetComponent<ChangeHealth>();
|
||||
battery = backgroundPanel.GetComponent<HandleEnergy>();
|
||||
|
||||
audio = audioScript.GetComponent<AudioManager>();
|
||||
|
||||
}
|
||||
void Start()
|
||||
@@ -97,18 +100,22 @@ public class ShopScript : MonoBehaviour
|
||||
shopPanel.SetActive(true);
|
||||
LeanTween.scale(shopPanel, transform.localScale * 0.5f, duration * Time.deltaTime).setDelay(.1f).setEase(LeanTweenType.easeOutBounce);
|
||||
Vibrator.Vibrate();
|
||||
|
||||
audio.PlaySFX(audio.button);
|
||||
}
|
||||
|
||||
public void CloseShop()
|
||||
{
|
||||
LeanTween.scale(shopPanel, transform.localScale * 0f, duration * Time.deltaTime).setDelay(.1f).setEase(LeanTweenType.easeOutBounce);
|
||||
shopPanel.SetActive(false);
|
||||
audio.PlaySFX(audio.button);
|
||||
}
|
||||
|
||||
public void ClosePanel()
|
||||
{
|
||||
LeanTween.scale(errorPanel, transform.localScale * 0f, duration * Time.deltaTime).setDelay(.1f).setEase(LeanTweenType.easeOutBounce);
|
||||
errorPanel.SetActive(false);
|
||||
audio.PlaySFX(audio.button);
|
||||
}
|
||||
|
||||
public void AddLife()
|
||||
@@ -126,6 +133,8 @@ public class ShopScript : MonoBehaviour
|
||||
inventory.StandardHealth++;
|
||||
|
||||
inventory.Gems -= updateCost;
|
||||
|
||||
audio.PlaySFX(audio.buy);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,6 +152,8 @@ public class ShopScript : MonoBehaviour
|
||||
inventory.StandardEnergy++;
|
||||
|
||||
inventory.Gems -= updateCost;
|
||||
|
||||
audio.PlaySFX(audio.buy);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,6 +174,7 @@ public class ShopScript : MonoBehaviour
|
||||
moneten -= gemsCost;
|
||||
Debug.Log("Ich mag Moeneten");
|
||||
inventory.Gems += 100;
|
||||
audio.PlaySFX(audio.buy);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,6 +204,8 @@ public class ShopScript : MonoBehaviour
|
||||
Debug.Log("Ich mag Moeneten");
|
||||
|
||||
inventory.Gems += 200;
|
||||
|
||||
audio.PlaySFX(audio.buy);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -214,6 +228,8 @@ public class ShopScript : MonoBehaviour
|
||||
//textfeldA.text = inventory.Energy.ToString();
|
||||
//textfeldB.text = inventory.Health.ToString();
|
||||
//textfeldC.text = moneten.ToString();
|
||||
|
||||
audio.PlaySFX(audio.button);
|
||||
}
|
||||
|
||||
public void ResetValues()
|
||||
@@ -224,8 +240,10 @@ public class ShopScript : MonoBehaviour
|
||||
moneten = 10f;
|
||||
|
||||
errorPanel.SetActive(true);
|
||||
errorText.text = "All values have been reset to standard.";
|
||||
errorText.text = "Values have been reset.";
|
||||
LeanTween.scale(errorPanel, transform.localScale * 0.5f, duration * Time.deltaTime).setDelay(.1f).setEase(LeanTweenType.easeOutBounce);
|
||||
|
||||
audio.PlaySFX(audio.button);
|
||||
}
|
||||
|
||||
public void ChangeActivation()
|
||||
@@ -241,6 +259,7 @@ public class ShopScript : MonoBehaviour
|
||||
errorText.text = "PaymentSystem active";
|
||||
LeanTween.scale(errorPanel, transform.localScale * 0.5f, duration * Time.deltaTime).setDelay(.1f).setEase(LeanTweenType.easeOutBounce);
|
||||
|
||||
audio.PlaySFX(audio.button);
|
||||
}
|
||||
|
||||
else
|
||||
@@ -262,5 +281,7 @@ public class ShopScript : MonoBehaviour
|
||||
devPanel.SetActive(false);
|
||||
|
||||
ClosePanel();
|
||||
|
||||
audio.PlaySFX(audio.button);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,11 @@ public class DoorController : MonoBehaviour
|
||||
[SerializeField] private Door door;
|
||||
[SerializeField] GameObject energyScript;
|
||||
[SerializeField] GameObject inventoryScript;
|
||||
[SerializeField] GameObject audioScript;
|
||||
|
||||
HandleEnergy energy;
|
||||
InventoryScript inventory;
|
||||
AudioManager audio;
|
||||
|
||||
|
||||
float timer = 0f;
|
||||
@@ -18,6 +20,7 @@ public class DoorController : MonoBehaviour
|
||||
{
|
||||
energy = energyScript.GetComponent<HandleEnergy>();
|
||||
inventory = inventoryScript.GetComponent<InventoryScript>();
|
||||
audio = audioScript.GetComponent<AudioManager>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
@@ -36,6 +39,7 @@ public class DoorController : MonoBehaviour
|
||||
|
||||
if (inventory.Energy > 0)
|
||||
{
|
||||
audio.PlaySFX(audio.door);
|
||||
Vibrator.Vibrate();
|
||||
door.isOpen = false;
|
||||
Debug.Log("Hier kommt niemand rein");
|
||||
|
||||
@@ -34,10 +34,13 @@ public class FieScript : MonoBehaviour
|
||||
[SerializeField] GameObject eSilv;
|
||||
[SerializeField] GameObject eHai;
|
||||
|
||||
[SerializeField] GameObject audioScript;
|
||||
|
||||
LevelBehavior level;
|
||||
ChangeHealth healthScript;
|
||||
Door doorSwitch;
|
||||
Door doorSwitch2;
|
||||
AudioManager audio;
|
||||
|
||||
SilvScript silv;
|
||||
HaiScript hai;
|
||||
@@ -48,6 +51,7 @@ public class FieScript : MonoBehaviour
|
||||
doorSwitch = door1.GetComponent<Door>();
|
||||
doorSwitch2 = door2.GetComponent<Door>();
|
||||
level = levelScript.GetComponent<LevelBehavior>();
|
||||
audio = audioScript.GetComponent<AudioManager>();
|
||||
|
||||
silv = eSilv.GetComponent<SilvScript>();
|
||||
hai = eHai.GetComponent<HaiScript>();
|
||||
@@ -72,6 +76,7 @@ public class FieScript : MonoBehaviour
|
||||
public void HitPlayer()
|
||||
{
|
||||
healthScript.GetHit();
|
||||
audio.PlaySFX(audio.fieHit);
|
||||
}
|
||||
|
||||
public void StartStuff()
|
||||
@@ -106,6 +111,7 @@ public class FieScript : MonoBehaviour
|
||||
while (elapsed < stateTime)
|
||||
{
|
||||
elapsed += Time.deltaTime;
|
||||
|
||||
}
|
||||
yield return new WaitForSeconds(stateTime);
|
||||
|
||||
@@ -114,6 +120,8 @@ public class FieScript : MonoBehaviour
|
||||
|
||||
IEnumerator WanderClose()
|
||||
{
|
||||
|
||||
|
||||
float elapsed2 = 0;
|
||||
|
||||
if (spawnLeft == true) //1 bedeutet immer left
|
||||
@@ -134,10 +142,14 @@ public class FieScript : MonoBehaviour
|
||||
while (elapsed2 < stateTime)
|
||||
{
|
||||
elapsed2 += Time.deltaTime;
|
||||
|
||||
audio.PlaySFX(audio.comingCloser);
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(stateTime);
|
||||
|
||||
audio.PlaySFX(audio.scare);
|
||||
|
||||
StartCoroutine(GetTooClose());
|
||||
}
|
||||
|
||||
@@ -193,7 +205,7 @@ public class FieScript : MonoBehaviour
|
||||
Debug.Log("Du hast bereits " + level.earnedGems + " Gems verdient.");
|
||||
Debug.Log("Fiefetti: Och menno");
|
||||
Fiefetti.transform.position = SPBack.transform.position;
|
||||
|
||||
audio.PlaySFX(audio.bang);
|
||||
}
|
||||
|
||||
spawnLeft = false;
|
||||
|
||||
@@ -33,10 +33,13 @@ public class HaiScript : MonoBehaviour
|
||||
[SerializeField] GameObject eFie;
|
||||
[SerializeField] GameObject eSilv;
|
||||
|
||||
[SerializeField] GameObject audioScript;
|
||||
|
||||
ChangeHealth healthScript;
|
||||
Door doorSwitch;
|
||||
Door doorSwitch2;
|
||||
LevelBehavior level;
|
||||
AudioManager audio;
|
||||
|
||||
FieScript fie;
|
||||
SilvScript silv;
|
||||
@@ -47,6 +50,7 @@ public class HaiScript : MonoBehaviour
|
||||
doorSwitch = door1.GetComponent<Door>();
|
||||
doorSwitch2 = door2.GetComponent<Door>();
|
||||
level = levelScript.GetComponent<LevelBehavior>();
|
||||
audio = audioScript.GetComponent<AudioManager>();
|
||||
|
||||
fie = eFie.GetComponent<FieScript>();
|
||||
silv = eSilv.GetComponent<SilvScript>();
|
||||
@@ -71,6 +75,7 @@ public class HaiScript : MonoBehaviour
|
||||
public void HitPlayer()
|
||||
{
|
||||
healthScript.GetHit();
|
||||
audio.PlaySFX(audio.haiHit);
|
||||
}
|
||||
|
||||
public void StartStuff()
|
||||
@@ -115,6 +120,8 @@ public class HaiScript : MonoBehaviour
|
||||
|
||||
IEnumerator WanderClose()
|
||||
{
|
||||
|
||||
|
||||
float elapsed2 = 0;
|
||||
|
||||
if (spawnLeft == true) //1 bedeutet immer left
|
||||
@@ -132,10 +139,13 @@ public class HaiScript : MonoBehaviour
|
||||
while (elapsed2 < stateTime)
|
||||
{
|
||||
elapsed2 += Time.deltaTime;
|
||||
audio.PlaySFX(audio.comingCloser);
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(stateTime);
|
||||
|
||||
audio.PlaySFX(audio.scare);
|
||||
|
||||
StartCoroutine(GetTooClose());
|
||||
}
|
||||
|
||||
@@ -189,6 +199,7 @@ public class HaiScript : MonoBehaviour
|
||||
level.earnedGems += level.earnGems;
|
||||
Debug.Log("Hai: Och menno");
|
||||
Hai.transform.position = SPBack.transform.position;
|
||||
audio.PlaySFX(audio.bang);
|
||||
}
|
||||
|
||||
spawnLeft = false;
|
||||
|
||||
@@ -29,6 +29,7 @@ public class SilvScript : MonoBehaviour
|
||||
[SerializeField] GameObject door1; //1 is always Left
|
||||
[SerializeField] GameObject door2;
|
||||
[SerializeField] GameObject levelScript;
|
||||
[SerializeField] GameObject audioScript;
|
||||
|
||||
[SerializeField] GameObject eFie;
|
||||
[SerializeField] GameObject eHai;
|
||||
@@ -37,6 +38,7 @@ public class SilvScript : MonoBehaviour
|
||||
ChangeHealth healthScript;
|
||||
Door doorSwitch;
|
||||
Door doorSwitch2;
|
||||
AudioManager audio;
|
||||
|
||||
FieScript fie;
|
||||
HaiScript hai;
|
||||
@@ -47,6 +49,7 @@ public class SilvScript : MonoBehaviour
|
||||
healthScript = scriptPile.GetComponent<ChangeHealth>();
|
||||
doorSwitch = door1.GetComponent<Door>();
|
||||
doorSwitch2 = door2.GetComponent<Door>();
|
||||
audio = audioScript.GetComponent<AudioManager>();
|
||||
|
||||
fie = eFie.GetComponent<FieScript>();
|
||||
hai = eHai.GetComponent<HaiScript>();
|
||||
@@ -71,6 +74,7 @@ public class SilvScript : MonoBehaviour
|
||||
public void HitPlayer()
|
||||
{
|
||||
healthScript.GetHit();
|
||||
audio.PlaySFX(audio.silvHit);
|
||||
}
|
||||
|
||||
public void StartStuff()
|
||||
@@ -115,6 +119,7 @@ public class SilvScript : MonoBehaviour
|
||||
|
||||
IEnumerator WanderClose()
|
||||
{
|
||||
|
||||
|
||||
float elapsed2 = 0;
|
||||
|
||||
@@ -133,10 +138,13 @@ public class SilvScript : MonoBehaviour
|
||||
while (elapsed2 < stateTime)
|
||||
{
|
||||
elapsed2 += Time.deltaTime;
|
||||
audio.PlaySFX(audio.comingCloser);
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(stateTime);
|
||||
|
||||
audio.PlaySFX(audio.scare);
|
||||
|
||||
StartCoroutine(GetTooClose());
|
||||
}
|
||||
|
||||
@@ -193,6 +201,7 @@ public class SilvScript : MonoBehaviour
|
||||
level.earnedGems += level.earnGems;
|
||||
Debug.Log("Silv: Och menno");
|
||||
Silv.transform.position = SPBack.transform.position;
|
||||
audio.PlaySFX(audio.bang);
|
||||
}
|
||||
|
||||
spawnLeft = false;
|
||||
|
||||
@@ -39,9 +39,9 @@ public class ChangeHealth : MonoBehaviour
|
||||
end = guessWhatAgain.GetComponent<GameOver>();
|
||||
level = scriptPile.GetComponent<LevelBehavior>();
|
||||
|
||||
fie = eFie.GetComponent<FieScript>();
|
||||
silv = eSilv.GetComponent<SilvScript>();
|
||||
hai = eHai.GetComponent<HaiScript>();
|
||||
//fie = eFie.GetComponent<FieScript>();
|
||||
//silv = eSilv.GetComponent<SilvScript>();
|
||||
//hai = eHai.GetComponent<HaiScript>();
|
||||
}
|
||||
|
||||
void Start()
|
||||
|
||||
@@ -16,14 +16,19 @@ public class HandleEnergy : MonoBehaviour
|
||||
[Header("ScriptPile")]
|
||||
|
||||
[SerializeField] GameObject scriptPile;
|
||||
[SerializeField] GameObject audioScript;
|
||||
|
||||
InventoryScript inventory;
|
||||
GameOver end;
|
||||
AudioManager audio;
|
||||
|
||||
bool energyOut = true;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
inventory = scriptPile.GetComponent<InventoryScript>();
|
||||
end = scriptPile.GetComponent<GameOver>(); //UNNÖTIG, BEI ENEGRY 0 IST JA KEIN GAMEOVER
|
||||
audio = audioScript.GetComponent<AudioManager>();
|
||||
}
|
||||
|
||||
void Start()
|
||||
@@ -36,16 +41,30 @@ public class HandleEnergy : MonoBehaviour
|
||||
void Update()
|
||||
{
|
||||
energyHUD.text = inventory.Energy.ToString();
|
||||
|
||||
if (energyOut == true && inventory.Energy == 0)
|
||||
{
|
||||
CheckEnergy();
|
||||
}
|
||||
}
|
||||
|
||||
public void LoseEnergy()
|
||||
{
|
||||
if (inventory.Energy > 0)
|
||||
inventory.Energy -= 1; //MAGIC NUMBER BEACHTEN ERSTMAL AUSPROBIEREN
|
||||
else
|
||||
{
|
||||
Debug.Log("Alle alle.");
|
||||
}
|
||||
CheckEnergy();
|
||||
|
||||
if (inventory.Energy > 0)
|
||||
{
|
||||
inventory.Energy -= 1; //MAGIC NUMBER BEACHTEN ERSTMAL AUSPROBIEREN
|
||||
}
|
||||
}
|
||||
|
||||
public void CheckEnergy()
|
||||
{
|
||||
if (inventory.Energy == 0)
|
||||
{
|
||||
audio.PlaySFX(audio.energyOut);
|
||||
|
||||
energyOut = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,9 +47,9 @@ public class InventoryScript : MonoBehaviour
|
||||
//Gems
|
||||
[SerializeField] int gems;
|
||||
|
||||
[SerializeField] int standardHealth = 3;
|
||||
[SerializeField] int standardHealth;
|
||||
|
||||
[SerializeField] int standardEnergy = 10;
|
||||
[SerializeField] int standardEnergy;
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user