Fertiges Game hochgeladen
This commit is contained in:
17
Assets/Scripts/Menüs/Haupt_Menü.cs
Normal file
17
Assets/Scripts/Menüs/Haupt_Menü.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class Haupt_Menü : MonoBehaviour
|
||||
{
|
||||
public void StarteSpiel()
|
||||
{
|
||||
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex +1);
|
||||
}
|
||||
|
||||
public void VerlasseSpiel()
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
}
|
11
Assets/Scripts/Menüs/Haupt_Menü.cs.meta
Normal file
11
Assets/Scripts/Menüs/Haupt_Menü.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cbcbe4ebdc142f641ae18af3bd622ed3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
31
Assets/Scripts/Menüs/Load Open World.cs
Normal file
31
Assets/Scripts/Menüs/Load Open World.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class LoadOpenWorld : MonoBehaviour
|
||||
{
|
||||
private KeyCode loadMeToOpWo = KeyCode.Mouse0;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
ActionToLoadOpWo();
|
||||
}
|
||||
|
||||
private void ActionToLoadOpWo()
|
||||
{
|
||||
if (Input.GetKeyDown(loadMeToOpWo))
|
||||
{
|
||||
SceneManager.LoadScene(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
//https://www.youtube.com/watch?v=ztJPnBpae_0&t=470s
|
||||
|
11
Assets/Scripts/Menüs/Load Open World.cs.meta
Normal file
11
Assets/Scripts/Menüs/Load Open World.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 666b6272125f93a4699b053b2289b3a1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
48
Assets/Scripts/Menüs/Ui Text Fade.cs
Normal file
48
Assets/Scripts/Menüs/Ui Text Fade.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
|
||||
public class UIFadeText : MonoBehaviour
|
||||
{
|
||||
public Text uiText; // Das UI-Text-Element
|
||||
public float fadeDuration = 1.5f; // Dauer des Fade-Effekts
|
||||
public float waitTime = 1.0f; // Wartezeit zwischen Fade-Out und Fade-In
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (uiText == null)
|
||||
{
|
||||
uiText = GetComponent<Text>(); // Falls kein Text zugewiesen ist, wird dieser gesucht.
|
||||
}
|
||||
StartCoroutine(FadeTextLoop());
|
||||
}
|
||||
|
||||
private IEnumerator FadeTextLoop()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
yield return StartCoroutine(FadeText(1, 0)); // Text ausblenden
|
||||
yield return new WaitForSeconds(waitTime);
|
||||
yield return StartCoroutine(FadeText(0, 1)); // Text einblenden
|
||||
yield return new WaitForSeconds(waitTime);
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator FadeText(float startAlpha, float endAlpha)
|
||||
{
|
||||
float elapsedTime = 0;
|
||||
Color textColor = uiText.color;
|
||||
|
||||
while (elapsedTime < fadeDuration)
|
||||
{
|
||||
elapsedTime += Time.deltaTime;
|
||||
float newAlpha = Mathf.Lerp(startAlpha, endAlpha, elapsedTime / fadeDuration);
|
||||
uiText.color = new Color(textColor.r, textColor.g, textColor.b, newAlpha);
|
||||
yield return null;
|
||||
}
|
||||
|
||||
uiText.color = new Color(textColor.r, textColor.g, textColor.b, endAlpha);
|
||||
}
|
||||
}
|
||||
|
||||
//https://chatgpt.com
|
11
Assets/Scripts/Menüs/Ui Text Fade.cs.meta
Normal file
11
Assets/Scripts/Menüs/Ui Text Fade.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f576dac274966fe488e0e9bfadf2eb36
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user