Merge branch 'main' of https://github.com/jonasbraus/Minecraft
This commit is contained in:
@@ -253,6 +253,11 @@ public class Client
|
||||
//send Chunk with position in Chunk
|
||||
Send(new byte[] { 3, (byte)chunk.x, (byte)chunk.z, xInChunk, yInChunk, zInChunk, blockID });
|
||||
}
|
||||
|
||||
public void SendDeadMessage()
|
||||
{
|
||||
Send(new byte[]{10});
|
||||
}
|
||||
|
||||
//default send method
|
||||
private void Send(byte[] data)
|
||||
|
||||
@@ -177,7 +177,10 @@ public class Player : MonoBehaviour
|
||||
|
||||
if (transform.position.y < 0)
|
||||
{
|
||||
world.ShowDeadScreen();
|
||||
if(Time.timeScale > 0)
|
||||
{
|
||||
world.ShowDeadScreen();
|
||||
}
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Escape))
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
@@ -154,9 +155,9 @@ public class World : MonoBehaviour
|
||||
//returns if a block is on the position
|
||||
public bool CheckBlock(Vector3 positionInWorld)
|
||||
{
|
||||
if (positionInWorld.x < -1 || positionInWorld.z < -1 ||
|
||||
positionInWorld.x > worldSize * Data.chunkWidth ||
|
||||
positionInWorld.z > worldSize * Data.chunkWidth)
|
||||
if (positionInWorld.x < 0 || positionInWorld.z < 0 ||
|
||||
positionInWorld.x >= worldSize * Data.chunkWidth ||
|
||||
positionInWorld.z >= worldSize * Data.chunkWidth)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -255,12 +256,6 @@ public class World : MonoBehaviour
|
||||
client.Disconnect();
|
||||
}
|
||||
|
||||
|
||||
public void BackToMenu()
|
||||
{
|
||||
SceneManager.LoadScene("Scenes/Login", LoadSceneMode.Single);
|
||||
}
|
||||
|
||||
public Client GetClient()
|
||||
{
|
||||
return client;
|
||||
@@ -277,6 +272,7 @@ public class World : MonoBehaviour
|
||||
|
||||
public void ShowDeadScreen()
|
||||
{
|
||||
client.SendDeadMessage();
|
||||
Cursor.visible = true;
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
deadScreen.SetActive(true);
|
||||
@@ -310,6 +306,7 @@ public class World : MonoBehaviour
|
||||
|
||||
public void QuitButton()
|
||||
{
|
||||
Time.timeScale = 1;
|
||||
client.Disconnect();
|
||||
SceneManager.LoadScene("Login");
|
||||
deadScreen.SetActive(false);
|
||||
|
||||
Reference in New Issue
Block a user