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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user