Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
fix all bugs in unity 5
  • Loading branch information
liberodark committed Nov 20, 2016
1 parent d99c529 commit 599cc69
Show file tree
Hide file tree
Showing 23 changed files with 44 additions and 26 deletions.
Binary file removed Unity 5.7z
Binary file not shown.
12 changes: 6 additions & 6 deletions Unity 5/Assets/Assets/Prefabs/Player/Scripts/Builder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ void OnGUI () {
{
Vector3i? point = GetCursor(true);
if(point.HasValue && point.Value.y >= 2) {
if (Network.peerType == NetworkPeerType.Disconnected)
map.SetBlockAndRecompute(new BlockData(), point.Value);
else
this.DestroyBlock(point.Value);
if (Network.peerType == NetworkPeerType.Disconnected)
map.SetBlockAndRecompute(new BlockData(), point.Value);
else
this.DestroyBlock(point.Value);

Vector3i around = new Vector3i(point.Value.x,point.Value.y,point.Value.z);

Expand Down Expand Up @@ -173,13 +173,13 @@ void OnGUI () {

}

void DestroyBlock(Vector3i cursor_pos)
void DestroyBlock(Vector3i cursor_pos)
{
GetComponent<NetworkView>().RPC("RemoteDestroyBlock", RPCMode.All, (Vector3)cursor_pos);
}

[RPC]
void RemoteDestroyBlock(Vector3 cursor_pos)
void RemoteDestroyBlock(Vector3 cursor_pos)
{
Map.Instance.SetBlockAndRecompute(new BlockData(), new Vector3i(Mathf.RoundToInt(cursor_pos.x), Mathf.RoundToInt(cursor_pos.y), Mathf.RoundToInt(cursor_pos.z)));
}
Expand Down
40 changes: 24 additions & 16 deletions Unity 5/Assets/Scenes/Game/Scripts/Game/DontDestroyOnLoad.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,30 @@
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;

public class DontDestroyOnLoad : MonoBehaviour
public class DontDestroyOnLoad : MonoBehaviour
{
#region Input Data
public string _accepted_level = "Game";
#endregion
#region Input Data
public string _accepted_level = "Game";
#endregion

#region Unity
void Awake()
{
DontDestroyOnLoad(this.gameObject);
}

void OnLevelWasLoaded(int level)
{
if (Application.loadedLevelName != this._accepted_level)
Destroy(this.gameObject);
}
#endregion
#region Unity
void Awake()
{
DontDestroyOnLoad(this.gameObject);
SceneManager.sceneLoaded += LoadScene;
}

//void OnLevelWasLoaded(int level)
//{

//}

void LoadScene(Scene scene, LoadSceneMode mode)
{
SceneManager.LoadScene(this._accepted_level);
Destroy(this.gameObject);
}

#endregion
}
16 changes: 13 additions & 3 deletions Unity 5/Assets/Scenes/Game/Scripts/Game/GameSetup.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;

public class GameSetup : MonoBehaviour {

public static BlockSet blockSet;

void OnLevelWasLoaded(int level) {
if(blockSet != null) GetComponent<Map>().SetBlockSet(blockSet);
}
void Awake()
{
SceneManager.sceneLoaded += SceneManager_sceneLoaded;
}

private void SceneManager_sceneLoaded(Scene scene, LoadSceneMode mode)
{
if (blockSet != null) GetComponent<Map>().SetBlockSet(blockSet);
}

// void OnLevelWasLoaded(int level) {
//}

}
2 changes: 1 addition & 1 deletion Unity 5/Assets/VoxelEngine/Core/Map/Chunk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void SetBlock(BlockData block, Vector3i pos) {
}
public void SetBlock(BlockData block, int x, int y, int z) {
blocks[z, y, x] = block;
chunkInNum[z,y,x] = block.block.Index;
chunkInNum[z,y,x] = block.block == null ? 0 : block.block.Index;
}

public BlockData GetBlock(Vector3i pos) {
Expand Down
Binary file modified Unity 5/Library/CurrentLayout.dwlt
Binary file not shown.
Binary file modified Unity 5/Library/EditorUserBuildSettings.asset
Binary file not shown.
Binary file modified Unity 5/Library/ScriptAssemblies/Assembly-CSharp-Editor.dll
Binary file not shown.
Binary file modified Unity 5/Library/ScriptAssemblies/Assembly-CSharp-Editor.dll.mdb
Binary file not shown.
Binary file modified Unity 5/Library/ScriptAssemblies/Assembly-CSharp-firstpass.dll
Binary file not shown.
Binary file not shown.
Binary file modified Unity 5/Library/ScriptAssemblies/Assembly-CSharp.dll
Binary file not shown.
Binary file modified Unity 5/Library/ScriptAssemblies/Assembly-CSharp.dll.mdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Unity 5/Library/assetDatabase3
Binary file not shown.
Binary file modified Unity 5/Library/expandedItems
Binary file not shown.
Binary file modified Unity 5/Library/metadata/00/00000000000000004000000000000000
Binary file not shown.
Binary file modified Unity 5/Library/metadata/00/00000000000000006100000000000000
Binary file not shown.
Binary file modified Unity 5/Library/metadata/00/001442b3dff47da43b2ada5f92b51619
Binary file not shown.
Binary file modified Unity 5/Library/metadata/46/466d494647b3ce840bc06f67b96316ff
Binary file not shown.
Binary file modified Unity 5/Library/metadata/4b/4b75d1d55789a4241925af2942e5164d
Binary file not shown.
Binary file modified Unity 5/Library/metadata/92/92d707c3adf90d14aaac211e20f27691
Binary file not shown.

0 comments on commit 599cc69

Please sign in to comment.