Skip to content

Commit

Permalink
0.5 update
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown committed Dec 3, 2022
1 parent a7d3ba0 commit a405819
Show file tree
Hide file tree
Showing 525 changed files with 6,232 additions and 4,071 deletions.
9 changes: 6 additions & 3 deletions Assembly-CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@
<ImplicitlyExpandDesignTimeFacades>false</ImplicitlyExpandDesignTimeFacades>
</PropertyGroup>
<ItemGroup>
<Compile Include="Assets\MapGenerator.cs" />
<Compile Include="Assets\SeedOK.cs" />
<Compile Include="Assets\MapGenRNG.cs" />
<Compile Include="Assets\Item.cs" />
<Compile Include="Assets\Code\MapGenerator.cs" />
<Compile Include="Assets\Code\SeedOK.cs" />
<Compile Include="Assets\Code\MapGenRNG.cs" />
<Compile Include="Assets\Code\PlayerController.cs" />
<Compile Include="Assets\Code\CameraController.cs" />
<Compile Include="Assets\Register.cs" />
<Compile Include="Assets\BlockData.cs" />
<Reference Include="UnityEngine">
<HintPath>C:\Program Files\Unity\Hub\Editor\2021.3.6f1\Editor\Data\Managed\UnityEngine\UnityEngine.dll</HintPath>
</Reference>
Expand Down
16 changes: 16 additions & 0 deletions Assets/BlockData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BlockData : MonoBehaviour
{
public int BlockID;
public int DropItem;
public List<int> BreakSound;
public List<int> PlaceSound;
public void DestroyBlock()
{
GameObject.Find("Register").GetComponent<AudioSource>().PlayOneShot(GameObject.Find("Register").GetComponent<Register>().audioClips[BreakSound[Random.Range(0, BreakSound.Count)]]);
Destroy(gameObject);
}
}
11 changes: 11 additions & 0 deletions Assets/BlockData.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions Assets/BlockPrefab/bedrock.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ GameObject:
- component: {fileID: 4270592643306706412}
- component: {fileID: 7497733538320505746}
- component: {fileID: 3960274095988114761}
- component: {fileID: 8487921397132645989}
m_Layer: 0
m_Name: bedrock
m_TagString: Untagged
Expand Down Expand Up @@ -97,3 +98,19 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &8487921397132645989
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1543852175261655460}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 88bd0cff86173bd47872233d8df8f927, type: 3}
m_Name:
m_EditorClassIdentifier:
BlockID: 3
DropItem: 0
BreakSound: 00000000010000000200000003000000
PlaceSound: 00000000010000000200000003000000
17 changes: 17 additions & 0 deletions Assets/BlockPrefab/diamond_ore.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ GameObject:
- component: {fileID: 191426941927142711}
- component: {fileID: 815508546568139290}
- component: {fileID: 1097022585117793511}
- component: {fileID: 3979157269338744038}
m_Layer: 0
m_Name: diamond_ore
m_TagString: Untagged
Expand Down Expand Up @@ -97,3 +98,19 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &3979157269338744038
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6410864843946777017}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 88bd0cff86173bd47872233d8df8f927, type: 3}
m_Name:
m_EditorClassIdentifier:
BlockID: 5
DropItem: 0
BreakSound: 00000000010000000200000003000000
PlaceSound: 00000000010000000200000003000000
17 changes: 17 additions & 0 deletions Assets/BlockPrefab/dirt.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ GameObject:
- component: {fileID: 1115080669142474687}
- component: {fileID: 4825841512934322253}
- component: {fileID: 7173536592808306671}
- component: {fileID: 6095435838520071082}
m_Layer: 0
m_Name: dirt
m_TagString: Untagged
Expand Down Expand Up @@ -97,3 +98,19 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &6095435838520071082
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 860561913648787290}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 88bd0cff86173bd47872233d8df8f927, type: 3}
m_Name:
m_EditorClassIdentifier:
BlockID: 1
DropItem: 0
BreakSound: 08000000090000000a0000000b000000
PlaceSound: 08000000090000000a0000000b000000
17 changes: 17 additions & 0 deletions Assets/BlockPrefab/grass_block.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ GameObject:
- component: {fileID: 7265487213935417188}
- component: {fileID: 4841586656615310254}
- component: {fileID: 6509399474074609280}
- component: {fileID: 6303180868407895002}
m_Layer: 0
m_Name: grass_block
m_TagString: Untagged
Expand Down Expand Up @@ -97,3 +98,19 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 0.02, y: 0.02, z: 0.02}
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &6303180868407895002
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6354641856549880443}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 88bd0cff86173bd47872233d8df8f927, type: 3}
m_Name:
m_EditorClassIdentifier:
BlockID: 0
DropItem: 0
BreakSound: 04000000050000000600000007000000
PlaceSound: 04000000050000000600000007000000
17 changes: 17 additions & 0 deletions Assets/BlockPrefab/iron_ore.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ GameObject:
- component: {fileID: 8323562316856312293}
- component: {fileID: 5164795813497419517}
- component: {fileID: 8270820665802403655}
- component: {fileID: 8533437927370309190}
m_Layer: 0
m_Name: iron_ore
m_TagString: Untagged
Expand Down Expand Up @@ -97,3 +98,19 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &8533437927370309190
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8214443392773755508}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 88bd0cff86173bd47872233d8df8f927, type: 3}
m_Name:
m_EditorClassIdentifier:
BlockID: 5
DropItem: 0
BreakSound: 00000000010000000200000003000000
PlaceSound: 00000000010000000200000003000000
17 changes: 17 additions & 0 deletions Assets/BlockPrefab/stone.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ GameObject:
- component: {fileID: 4029196795410050578}
- component: {fileID: 3253176493350138603}
- component: {fileID: 4533409571609800781}
- component: {fileID: 5490119700369900207}
m_Layer: 0
m_Name: stone
m_TagString: Untagged
Expand Down Expand Up @@ -97,3 +98,19 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &5490119700369900207
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2327779537744443050}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 88bd0cff86173bd47872233d8df8f927, type: 3}
m_Name:
m_EditorClassIdentifier:
BlockID: 2
DropItem: 0
BreakSound: 00000000010000000200000003000000
PlaceSound: 00000000010000000200000003000000
File renamed without changes.
File renamed without changes.
20 changes: 11 additions & 9 deletions Assets/MapGenerator.cs → Assets/Code/MapGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,45 @@ public class MapGenerator : MonoBehaviour
float x = 0;
float y = 8;
float z = 0;
public GameObject stonePrefab;
/*public GameObject stonePrefab;
public GameObject grassBlockPrefab;
public GameObject dirtPrefab;
public GameObject bedrockPrefab;
public GameObject ironOrePrefab;
public GameObject diamondOrePrefab;
public GameObject diamondOrePrefab;*/
public MapGenRNG RNG;
public int MapSize;
public int Height;
List<GameObject> blockRegister;
// Start is called before the first frame update
void Genererate1Chunk(float x, float z)
{
for (float bx = x; bx < x + 16; bx += 1)
{
for (float bz = z; bz < z + 16; bz += 1)
{
GameObject grass_block = Instantiate(grassBlockPrefab);
GameObject dirt1 = Instantiate(dirtPrefab);
GameObject dirt2 = Instantiate(dirtPrefab);
GameObject grass_block = Instantiate(blockRegister[0]);
GameObject dirt1 = Instantiate(blockRegister[1]);
GameObject dirt2 = Instantiate(blockRegister[1]);
for (int i = 61; i > 1; i--)
{
int BlockRate = RNG.IntRandom(0, 100); // 0 ~ 99
GameObject block;
if (BlockRate == 0) // 1%
{
block = Instantiate(diamondOrePrefab);
block = Instantiate(blockRegister[5]);
}
else if (BlockRate < 6) // 5%
{
block = Instantiate(ironOrePrefab);
block = Instantiate(blockRegister[4]);
}
else // 94%
{
block = Instantiate(stonePrefab);
block = Instantiate(blockRegister[2]);
}
block.transform.position = new Vector3(bx, i, bz);
}
GameObject bedrock = Instantiate(bedrockPrefab);
GameObject bedrock = Instantiate(blockRegister[3]);
grass_block.transform.position = new Vector3(bx, 64, bz);
dirt1.transform.position = new Vector3(bx, 63, bz);
dirt2.transform.position = new Vector3(bx, 62, bz);
Expand All @@ -57,6 +58,7 @@ void Genererate1Chunk(float x, float z)
void Start()
{
RNG = GameObject.Find("MapGenRNG").GetComponent<MapGenRNG>();
blockRegister = GameObject.Find("Register").GetComponent<Register>().blocks;
MapSize = RNG.mapSize;
for (int x = -MapSize * 16; x <= MapSize * 16; x += 16)
{
Expand Down
File renamed without changes.
67 changes: 62 additions & 5 deletions Assets/Code/PlayerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ public class PlayerController : MonoBehaviour
public float MoveSpeed;
public float JumpPower;
public float RotateSpeed;
List<GameObject> blockRegister;
public Text PosX;
public Text PosY;
public Text PosZ;
public Text Seed;
// Start is called before the first frame update
void Start()
{
blockRegister = GameObject.Find("Register").GetComponent<Register>().blocks;
rigid = gameObject.GetComponent<Rigidbody>();
if (GameObject.Find("MapGenRNG").GetComponent<MapGenRNG>().seed == null)
{
Expand All @@ -25,7 +27,55 @@ void Start()
Seed.text = $"seed = {GameObject.Find("MapGenRNG").GetComponent<MapGenRNG>().seed}";
}
}
Vector3 GetAxisSide(Vector3 point) {
float [] axiss = new float[3];
axiss[0] = point.x;
axiss[1] = point.y;
axiss[2] = point.z;
int largeNumIndex = 0;

for (int i = 1; i < 3; i++) {
//절댓값이 가장 큰 축을 찾는다
if (Mathf.Abs(axiss[largeNumIndex]) < Mathf.Abs(axiss[i]))
largeNumIndex = i;
}

switch (largeNumIndex) {
//x축이 가장 절댓값이 크다면
case 0:
point.y = 0;
point.z = 0;
//x축이 양수라면
if (axiss[largeNumIndex] > 0)
point.x = 1;
else
point.x = -1;
return point;
//y축이 가장 절댓값이 크다면
case 1:
point.x = 0;
point.z = 0;
//y축이 양수라면
if (axiss[largeNumIndex] > 0)
point.y = 1;
else
point.y = -1;
return point;
//z축이 가장 절댓값이 크다면
case 2:
point.x = 0;
point.y = 0;
//z축이 양수라면
if (axiss[largeNumIndex] > 0)
point.z = 1;
else
point.z = -1;
return point;
default:
Debug.Log("축 절댓값 인덱스가 잘못되었습니다");
return Vector3.zero;
}
}
// Update is called once per frame
void Update()
{
Expand All @@ -39,18 +89,21 @@ void Update()
RaycastHit hit;
if (Physics.Raycast(ray, out hit, 5))
{
Destroy(hit.collider.gameObject);
hit.collider.gameObject.GetComponent<BlockData>().DestroyBlock();
}
}
/*if (Input.GetMouseButtonDown(2))
if (Input.GetMouseButtonDown(1))
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit, 5))
{
hit.
Vector3 axisSide = GetAxisSide(hit.transform.position - ray.GetPoint(hit.distance));
Vector3 blockPos = hit.transform.position - axisSide;
Debug.Log(blockPos);
GameObject.Find("Register").GetComponent<Register>().PlaceBlock(blockRegister[2], blockPos);
}
}*/
}
if (Input.GetKey("w"))
{
rigid.velocity = transform.rotation * Vector3.forward * MoveSpeed;
Expand Down Expand Up @@ -82,5 +135,9 @@ void Update()
{
transform.Rotate(0, RotateSpeed, 0);
}
if (Input.GetKey("e"))
{
//GameObject.Find("Canvas").transform.Find("Inventory").gameObject.SetActive(true);
}
}
}
}
2 changes: 1 addition & 1 deletion Assets/SeedOK.cs → Assets/Code/SeedOK.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void OK()
if (MapSizeInput.GetComponent<Text>().text != "")
{
GameObject.Find("MapGenRNG").GetComponent<MapGenRNG>().mapSize = int.Parse(MapSizeInput.GetComponent<Text>().text);
SceneManager.LoadScene("MainScene");
}
SceneManager.LoadScene("MainScene");
}
}
File renamed without changes.
Loading

0 comments on commit a405819

Please sign in to comment.