Menu Update
Gombok megjelenése, eltűnése
This commit is contained in:
@@ -5,15 +5,19 @@ using UnityEditor;
|
||||
|
||||
public class WallCollision : MonoBehaviour
|
||||
{
|
||||
jatekmanager jatekmanager;
|
||||
|
||||
private void OnTriggerEnter(Collider other) {
|
||||
if(other.gameObject.tag == "Player"){
|
||||
|
||||
Debug.Log("neki ment a falnak");
|
||||
|
||||
#if UNITY_EDITOR
|
||||
jatekmanager.UpdateGameState(jatekmanager.GameState.Meghaltal);
|
||||
/*#if UNITY_EDITOR
|
||||
EditorApplication.isPlaying = false;
|
||||
#else
|
||||
Application.Quit();
|
||||
#endif
|
||||
#endif*/
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,10 +10,18 @@ using UnityEngine.UI;
|
||||
|
||||
public class jatekmanager : MonoBehaviour
|
||||
{
|
||||
//gamestate-s cuccok
|
||||
public static jatekmanager Instance;
|
||||
public GameState State;
|
||||
public static event Action<GameState> OnGameStateChanged;
|
||||
|
||||
//gameobjectek,gombok,scriptek
|
||||
public GameObject playButton;
|
||||
public GameObject garazs;
|
||||
public GameObject homeGomb;
|
||||
public GameObject settingsGomb;
|
||||
public GameObject shopGomb;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
@@ -62,29 +70,82 @@ public class jatekmanager : MonoBehaviour
|
||||
Meghaltal
|
||||
}
|
||||
|
||||
public void ChangeToHome()
|
||||
{
|
||||
UpdateGameState(GameState.Home);
|
||||
homeGomb.SetActive(true);
|
||||
settingsGomb.SetActive(true);
|
||||
shopGomb.SetActive(true);
|
||||
}
|
||||
|
||||
private async void HandleHome()
|
||||
{
|
||||
StartCoroutine(TimerHome());
|
||||
GetComponent<GroundController>().enabled = false;
|
||||
GetComponent<PlayerController>().enabled = false;
|
||||
garazs.SetActive(true);
|
||||
}
|
||||
|
||||
IEnumerator TimerHome()
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(2);
|
||||
playButton.SetActive(true);
|
||||
}
|
||||
|
||||
public void ChangeToSettings()
|
||||
{
|
||||
UpdateGameState(GameState.Settings);
|
||||
}
|
||||
|
||||
private async void HandleSettings()
|
||||
{
|
||||
playButton.SetActive(false);
|
||||
}
|
||||
|
||||
public void ChangeToShop()
|
||||
{
|
||||
UpdateGameState(GameState.Shop);
|
||||
}
|
||||
|
||||
private async void HandleShop()
|
||||
{
|
||||
playButton.SetActive(false);
|
||||
}
|
||||
|
||||
public void ChangeToGame()
|
||||
{
|
||||
UpdateGameState(GameState.Game);
|
||||
homeGomb.SetActive(false);
|
||||
settingsGomb.SetActive(false);
|
||||
shopGomb.SetActive(false);
|
||||
}
|
||||
|
||||
IEnumerator TimerGame()
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(1);
|
||||
garazs.SetActive(false);
|
||||
}
|
||||
|
||||
private async void HandleGame()
|
||||
{
|
||||
playButton.SetActive(false);
|
||||
StartCoroutine(TimerGame());
|
||||
GetComponent <GroundController> ().enabled = true;
|
||||
GetComponent <PlayerController>().enabled = true;
|
||||
}
|
||||
|
||||
public void ChangeToMeghaltal()
|
||||
{
|
||||
UpdateGameState(GameState.Meghaltal);
|
||||
}
|
||||
|
||||
private async void HandleMeghaltal()
|
||||
{
|
||||
|
||||
playButton.SetActive(false);
|
||||
homeGomb.SetActive(true);
|
||||
GetComponent<GroundController>().enabled = false;
|
||||
GetComponent<PlayerController>().enabled = false;
|
||||
garazs.SetActive(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Cinemachine;
|
||||
|
||||
public class playbutton : MonoBehaviour
|
||||
{
|
||||
public CinemachineVirtualCamera currentCamera;
|
||||
public CinemachineTrackedDolly cinemachineTrackedDolly;
|
||||
public CinemachinePathBase.PositionUnits m_PositionUnits;
|
||||
|
||||
public CinemachineTrackedDolly dolly;
|
||||
|
||||
public CinemachineSmoothPath smoothPath;
|
||||
public CinemachinePath utvonal;
|
||||
public float pathPosition = 0.0f;
|
||||
public float speed = 0.2f;
|
||||
public float pathLength;
|
||||
public GameObject playButton;
|
||||
public Transform cameraTransform;
|
||||
public Vector3 cameraTransformOriginal;
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
//CinemachineVirtualCamera.GetComponent<CinemachineVirtualCamera>;
|
||||
pathPosition = 0.0f;
|
||||
cinemachineTrackedDolly = currentCamera.GetCinemachineComponent<CinemachineTrackedDolly>();
|
||||
pathLength = utvonal.MaxPos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void PlayButton()
|
||||
{
|
||||
playButton.SetActive(false);
|
||||
if (pathPosition < pathLength)
|
||||
{
|
||||
pathPosition += speed;
|
||||
cinemachineTrackedDolly.m_PathPosition = pathPosition;
|
||||
//smoothPath.m_PathPosition = pathPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 87ae71cc7940e4650b0424d51e2b8e28
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user