Vorbereitung für Animationen
This commit is contained in:
87
Assets/Scripts/GameManager.cs
Normal file
87
Assets/Scripts/GameManager.cs
Normal 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);
|
||||
}
|
||||
|
||||
}
|
2
Assets/Scripts/GameManager.cs.meta
Normal file
2
Assets/Scripts/GameManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e953be56a64cae4d863553e9fa11776
|
@@ -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;
|
||||
|
7
Assets/Scripts/TextNote.cs
Normal file
7
Assets/Scripts/TextNote.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class TextNote : MonoBehaviour
|
||||
{
|
||||
public string headline;
|
||||
public string content;
|
||||
}
|
2
Assets/Scripts/TextNote.cs.meta
Normal file
2
Assets/Scripts/TextNote.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d3ac442b4d3f827469ce9b5f0043e0df
|
Reference in New Issue
Block a user