Komplett Lauffähig + Vibration + Boni + Enemie "Jumpscares" - Audio
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user