Pausenmenü und Änderungen Level selecter
This commit is contained in:
@@ -59,7 +59,7 @@ public class CharControllerMod : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(Input.GetButtonDown("Jump") && grounded)
|
||||
{
|
||||
rb.velocity = new Vector2(rb.velocity.x, jumpHeight);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@@ -7,7 +8,29 @@ using UnityEngine.UI;
|
||||
public class MainMenu : MonoBehaviour
|
||||
{
|
||||
private int selectedLevel;
|
||||
|
||||
|
||||
private Dictionary<int, int> levels;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
levels = new Dictionary<int, int>()
|
||||
{// das hier geht nicht, die build indexes müssen manuell eingetragen werden
|
||||
{1, SceneManager.GetSceneByPath("2PlatzhalterTutorial").buildIndex},
|
||||
{2, SceneManager.GetSceneByPath("3MeowlinTalk").buildIndex},
|
||||
{3, SceneManager.GetSceneByPath("4DScene").buildIndex},
|
||||
{4, SceneManager.GetSceneByPath("5.0TutorialDimShift").buildIndex},
|
||||
{5, SceneManager.GetSceneByPath("6.0Luna").buildIndex},
|
||||
{6, SceneManager.GetSceneByPath("7Prototype").buildIndex},
|
||||
{7, SceneManager.GetSceneByPath("8Francois").buildIndex},
|
||||
{8, SceneManager.GetSceneByPath("9Catman1").buildIndex},
|
||||
{9, SceneManager.GetSceneByPath("10Conflict").buildIndex},
|
||||
{10, SceneManager.GetSceneByPath("11Catman2").buildIndex},
|
||||
{11, SceneManager.GetSceneByPath("14Level_Vanessa").buildIndex},
|
||||
{12, SceneManager.GetSceneByPath("15.0BossVorher").buildIndex},
|
||||
{13, SceneManager.GetSceneByPath("Credits").buildIndex}
|
||||
};
|
||||
}
|
||||
|
||||
public void startGame()
|
||||
{
|
||||
Debug.Log("Main Menu: New Game");
|
||||
@@ -22,47 +45,12 @@ public class MainMenu : MonoBehaviour
|
||||
|
||||
public void setSelectedLeve(int level)
|
||||
{
|
||||
selectedLevel = level;
|
||||
selectedLevel = ++level;
|
||||
}
|
||||
|
||||
public void loadScene()
|
||||
{
|
||||
switch (++selectedLevel)
|
||||
{
|
||||
case 5:
|
||||
selectedLevel = 7;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
selectedLevel = 10;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
selectedLevel = 11;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
selectedLevel = 12;
|
||||
break;
|
||||
|
||||
case 9:
|
||||
selectedLevel = 13;
|
||||
break;
|
||||
|
||||
case 10:
|
||||
selectedLevel = 14;
|
||||
break;
|
||||
|
||||
case 11:
|
||||
selectedLevel = 15;
|
||||
break;
|
||||
|
||||
case 12:
|
||||
selectedLevel = 16;
|
||||
break;
|
||||
}
|
||||
|
||||
Debug.Log("Main Menu: Load Level " + selectedLevel);
|
||||
SceneManager.LoadScene(selectedLevel);
|
||||
Debug.Log("Main Menu: Load Level " + levels[selectedLevel]);
|
||||
SceneManager.LoadScene(levels[selectedLevel]);
|
||||
}
|
||||
}
|
||||
|
||||
26
Assets/AssetsFORELLE/Script/PauseMenu.cs
Normal file
26
Assets/AssetsFORELLE/Script/PauseMenu.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class PauseMenu : MonoBehaviour
|
||||
{
|
||||
private GameObject pauseMenu;
|
||||
|
||||
void Start()
|
||||
{
|
||||
pauseMenu = GameObject.Find("PauseMenu");
|
||||
|
||||
pauseMenu.SetActive(false);
|
||||
}
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Escape))
|
||||
pauseMenu.SetActive(!pauseMenu.activeSelf);
|
||||
}
|
||||
|
||||
public void backToMainMenu()
|
||||
{
|
||||
SceneManager.LoadScene(0);
|
||||
}
|
||||
|
||||
}
|
||||
3
Assets/AssetsFORELLE/Script/PauseMenu.cs.meta
generated
Normal file
3
Assets/AssetsFORELLE/Script/PauseMenu.cs.meta
generated
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2046cbb93ecd46f0984dd38207269a95
|
||||
timeCreated: 1687771311
|
||||
Reference in New Issue
Block a user