Komplett mit Audio, Fehler beim Start der Spielszenen: standardHealth und standardEnergy werden nicht wie gewollt übermittelt
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user