Vorbereitung für Animationen

This commit is contained in:
doz_neuhaus
2025-08-24 22:57:58 +02:00
parent ba6076bfd7
commit d29fd71cc4
6 changed files with 12 additions and 4 deletions

View File

@@ -0,0 +1,87 @@
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class GameManager : MonoBehaviour
{
public static GameManager gameManager;
public GameObject playerPrefab;
public GameObject player;
public GameObject uiPanel;
public GameObject textPanel;
public TMP_Text tmp_headline;
public TMP_Text tmp_content;
public bool isRunning;
private void Awake()
{
// Singleton:
// If there is an instance, and it's not me, delete myself.
if (gameManager != null && gameManager != this)
{
Destroy(this);
}
else
{
gameManager = this;
}
}
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
isRunning = false;
TurnUIOn();
Time.timeScale = 1;
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
ToggleUI();
}
}
public void StartGame()
{
TurnUIOff();
isRunning = true;
player = Instantiate(playerPrefab);
}
public void ToggleUI()
{
if (uiPanel.activeInHierarchy)
{
TurnUIOff();
}
else
{
TurnUIOn();
}
}
public void TurnUIOn()
{
uiPanel.SetActive(true);
Time.timeScale = 0;
}
public void TurnUIOff()
{
uiPanel.SetActive(false);
Time.timeScale = 1;
}
public void ShowText(string headline, string content)
{
tmp_headline.text = headline;
tmp_content.text = content;
textPanel.SetActive(true);
}
public void HideText()
{
textPanel.SetActive(false);
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 4e953be56a64cae4d863553e9fa11776

View File

@@ -17,6 +17,12 @@ public class PlayerMovement : MonoBehaviour
[SerializeField]
private float maxSpeed;
public bool isJumping;
public bool isDoubleJumping;
public bool isDashing;
public bool isSliding;
public bool isWalking;
public bool isGrounded;
public bool shallJump;

View File

@@ -0,0 +1,7 @@
using UnityEngine;
public class TextNote : MonoBehaviour
{
public string headline;
public string content;
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d3ac442b4d3f827469ce9b5f0043e0df