diff --git a/Assets/_Datas/02.Scripts/AddressableManager.cs b/Assets/_Datas/02.Scripts/AddressableManager.cs index 61d93f3fb..69df5d185 100644 --- a/Assets/_Datas/02.Scripts/AddressableManager.cs +++ b/Assets/_Datas/02.Scripts/AddressableManager.cs @@ -1,4 +1,3 @@ - using System.Linq; #if UNITY_EDITOR using UnityEditor.AddressableAssets; diff --git a/Assets/_Datas/02.Scripts/AssetPostprocessors/AssetPostProcessor.cs b/Assets/_Datas/02.Scripts/AssetPostprocessors/AssetPostProcessor.cs index 006593873..161317d79 100644 --- a/Assets/_Datas/02.Scripts/AssetPostprocessors/AssetPostProcessor.cs +++ b/Assets/_Datas/02.Scripts/AssetPostprocessors/AssetPostProcessor.cs @@ -1,7 +1,7 @@ using UnityEditor; using UnityEngine; -namespace DDD.Editor +namespace DDD { public class AssetPostProcessor : AssetPostprocessor { diff --git a/Assets/_Datas/02.Scripts/AssetPostprocessors/AssetPostprocessorSprite.cs b/Assets/_Datas/02.Scripts/AssetPostprocessors/AssetPostprocessorSprite.cs index 0b2ab0185..72c38de6a 100644 --- a/Assets/_Datas/02.Scripts/AssetPostprocessors/AssetPostprocessorSprite.cs +++ b/Assets/_Datas/02.Scripts/AssetPostprocessors/AssetPostprocessorSprite.cs @@ -1,13 +1,12 @@ using System.Collections.Generic; using System.IO; -using System.Linq; using Superlazy; using UnityEditor; using UnityEditor.U2D; using UnityEngine; using UnityEngine.U2D; -namespace DDD.Editor +namespace DDD { public static class AssetPostprocessorSprite { diff --git a/Assets/_Datas/02.Scripts/BillBoardVisual.cs b/Assets/_Datas/02.Scripts/BillBoardVisual.cs index 07293af23..277a50be5 100644 --- a/Assets/_Datas/02.Scripts/BillBoardVisual.cs +++ b/Assets/_Datas/02.Scripts/BillBoardVisual.cs @@ -1,18 +1,20 @@ using UnityEngine; -public class BillBoardVisual : MonoBehaviour +namespace DDD { - private Camera cam; - - void Start() + public class BillBoardVisual : MonoBehaviour { - cam = Camera.main; - - } + private Camera cam; - // Update is called once per frame - void LateUpdate() - { - transform.localRotation = cam.transform.localRotation; + void Start() + { + cam = Camera.main; + } + + // Update is called once per frame + void LateUpdate() + { + transform.localRotation = cam.transform.localRotation; + } } -} +} \ No newline at end of file diff --git a/Assets/_Datas/02.Scripts/Items/ItemUI.cs b/Assets/_Datas/02.Scripts/Items/ItemUI.cs index acc2ab9bb..e43e1dd4e 100644 --- a/Assets/_Datas/02.Scripts/Items/ItemUI.cs +++ b/Assets/_Datas/02.Scripts/Items/ItemUI.cs @@ -1,21 +1,23 @@ -using DDD; using TMPro; using UnityEngine; -public class ItemUI : MonoBehaviour +namespace DDD { - public TextMeshProUGUI nameText; - - private Item _item; - - public void SetUpItem(Item item) + public class ItemUI : MonoBehaviour { - _item = item; - UpdateItem(); - } + public TextMeshProUGUI nameText; - private void UpdateItem() - { - nameText.text = _item.Name; + private Item _item; + + public void SetUpItem(Item item) + { + _item = item; + UpdateItem(); + } + + private void UpdateItem() + { + nameText.text = _item.Name; + } } } \ No newline at end of file diff --git a/Assets/_Datas/02.Scripts/Maps/CellManager.cs b/Assets/_Datas/02.Scripts/Maps/CellManager.cs index b9f4f5e31..80e271dea 100644 --- a/Assets/_Datas/02.Scripts/Maps/CellManager.cs +++ b/Assets/_Datas/02.Scripts/Maps/CellManager.cs @@ -1,104 +1,106 @@ -using System.Diagnostics; using UnityEngine; -public class CellManager : MonoBehaviour +namespace DDD { - public RectTransform cellCanvas; - public CellUI cell; - - public int minX = -20; - public int maxX = 20; - public int minZ = -20; - public int maxZ = 20; - - // 0 == 비어있음, 1 == 차있음, 2 == 잠김 - public const int offsetZ = 40; - private const int mapSize = 80; - private int[] tiles; - private CellUI[] tileUIs; - - void Start() + public class CellManager : MonoBehaviour { - tiles = new int [mapSize * mapSize]; + public RectTransform cellCanvas; + public CellUI cell; - // TODO: 데이터 입력 - for (int i = 0; i < mapSize * mapSize; i++) + public int minX = -20; + public int maxX = 20; + public int minZ = -20; + public int maxZ = 20; + + // 0 == 비어있음, 1 == 차있음, 2 == 잠김 + public const int offsetZ = 40; + private const int mapSize = 80; + private int[] tiles; + private CellUI[] tileUIs; + + void Start() { - tiles[i] = 0; - } + tiles = new int [mapSize * mapSize]; - cell.transform.SetParent(null); - cell.gameObject.SetActive(false); - - tileUIs = new CellUI[mapSize * mapSize]; - for (int i = 0; i < mapSize * mapSize; i++) - { - var newCell = Instantiate(cell, cellCanvas); - newCell.gameObject.SetActive(true); - tileUIs[i] = newCell.GetComponent(); - } - - UpdateCells(); - } - - public static Vector3 CellToWorld(Vector2Int cellPos) - { - var worldX = (cellPos.x - cellPos.y) * 0.5f * 1.414f; // sqrt(2) - var worldZ = -(cellPos.x + cellPos.y) * 0.5f * 1.414f + offsetZ; - return new Vector3(worldX, 0f, worldZ); - } - - public static Vector2Int WorldToCell(Vector3 worldPos) - { - var cellX = Mathf.RoundToInt((worldPos.x - (worldPos.z - offsetZ)) / 1.414f); - var cellY = Mathf.RoundToInt((-(worldPos.z - offsetZ) - worldPos.x) / 1.414f); - return new Vector2Int(cellX, cellY); - } - - public static int GetCellID(Vector2Int cellPos) - { - return cellPos.x + cellPos.y * mapSize; - } - - public static Vector3 GetCellWorldPos(int cellPos) - { - int x = cellPos % mapSize; // x는 열 (가로) - int y = cellPos / mapSize; // y는 행 (세로) - return CellToWorld(new Vector2Int(x, y)); - } - - private void Update() - { - //UpdateCells(); - } - - public void UpdateCells() - { - for (int i = 0; i < mapSize * mapSize; i++) - { - var worldPos = GetCellWorldPos(i); - // 바운더리체크 함수로 빼기 - if (minX > worldPos.x || worldPos.x > maxX) + // TODO: 데이터 입력 + for (int i = 0; i < mapSize * mapSize; i++) { - tileUIs[i].gameObject.SetActive(false); - continue; + tiles[i] = 0; } - if (minZ > worldPos.z || worldPos.z > maxZ) + cell.transform.SetParent(null); + cell.gameObject.SetActive(false); + + tileUIs = new CellUI[mapSize * mapSize]; + for (int i = 0; i < mapSize * mapSize; i++) { - tileUIs[i].gameObject.SetActive(false); - continue; + var newCell = Instantiate(cell, cellCanvas); + newCell.gameObject.SetActive(true); + tileUIs[i] = newCell.GetComponent(); } - tileUIs[i].SetTile(tiles[i]); - - tileUIs[i].gameObject.SetActive(true); - tileUIs[i].transform.position = GetCellWorldPos(i); + UpdateCells(); } - } - public void SetupCell(Vector3 position) - { - tiles[GetCellID(WorldToCell(position))] = 1; + public static Vector3 CellToWorld(Vector2Int cellPos) + { + var worldX = (cellPos.x - cellPos.y) * 0.5f * 1.414f; // sqrt(2) + var worldZ = -(cellPos.x + cellPos.y) * 0.5f * 1.414f + offsetZ; + return new Vector3(worldX, 0f, worldZ); + } + + public static Vector2Int WorldToCell(Vector3 worldPos) + { + var cellX = Mathf.RoundToInt((worldPos.x - (worldPos.z - offsetZ)) / 1.414f); + var cellY = Mathf.RoundToInt((-(worldPos.z - offsetZ) - worldPos.x) / 1.414f); + return new Vector2Int(cellX, cellY); + } + + public static int GetCellID(Vector2Int cellPos) + { + return cellPos.x + cellPos.y * mapSize; + } + + public static Vector3 GetCellWorldPos(int cellPos) + { + int x = cellPos % mapSize; // x는 열 (가로) + int y = cellPos / mapSize; // y는 행 (세로) + return CellToWorld(new Vector2Int(x, y)); + } + + private void Update() + { + //UpdateCells(); + } + + public void UpdateCells() + { + for (int i = 0; i < mapSize * mapSize; i++) + { + var worldPos = GetCellWorldPos(i); + // 바운더리체크 함수로 빼기 + if (minX > worldPos.x || worldPos.x > maxX) + { + tileUIs[i].gameObject.SetActive(false); + continue; + } + + if (minZ > worldPos.z || worldPos.z > maxZ) + { + tileUIs[i].gameObject.SetActive(false); + continue; + } + + tileUIs[i].SetTile(tiles[i]); + + tileUIs[i].gameObject.SetActive(true); + tileUIs[i].transform.position = GetCellWorldPos(i); + } + } + + public void SetupCell(Vector3 position) + { + tiles[GetCellID(WorldToCell(position))] = 1; + } } } \ No newline at end of file diff --git a/Assets/_Datas/02.Scripts/Maps/CellUI.cs b/Assets/_Datas/02.Scripts/Maps/CellUI.cs index 40328715a..6aae14665 100644 --- a/Assets/_Datas/02.Scripts/Maps/CellUI.cs +++ b/Assets/_Datas/02.Scripts/Maps/CellUI.cs @@ -1,46 +1,48 @@ -using System; using UnityEditor; using UnityEngine; using UnityEngine.UI; -public class CellUI : MonoBehaviour +namespace DDD { - public Color emptyColor = Color.white; - public Color selectedColor = Color.white; - public Color batchedColor = Color.white; - public Color lockedColor = Color.white; - - private Image image; - - private void OnEnable() + public class CellUI : MonoBehaviour { - image = GetComponent(); - } + public Color emptyColor = Color.white; + public Color selectedColor = Color.white; + public Color batchedColor = Color.white; + public Color lockedColor = Color.white; - public void SetTile(int tile) - { - // 0 == 비어있음, 1 == 차있음, 2 == 잠김 - switch (tile) + private Image image; + + private void OnEnable() { - case 0: - image.color = emptyColor; - break; - case 1: - image.color = batchedColor; - break; - case 2: - image.color = lockedColor; - break; + image = GetComponent(); + } + + public void SetTile(int tile) + { + // 0 == 비어있음, 1 == 차있음, 2 == 잠김 + switch (tile) + { + case 0: + image.color = emptyColor; + break; + case 1: + image.color = batchedColor; + break; + case 2: + image.color = lockedColor; + break; + } + } + + private void OnDrawGizmos() + { + // 기즈모 위치 예시 + Vector3 pos = transform.position; + + // 텍스트 표시 + Handles.color = Color.black; + Handles.Label(pos, CellManager.WorldToCell(transform.position).ToString()); } } - - private void OnDrawGizmos() - { - // 기즈모 위치 예시 - Vector3 pos = transform.position; - - // 텍스트 표시 - Handles.color = Color.black; - Handles.Label(pos, CellManager.WorldToCell(transform.position).ToString()); - } -} +} \ No newline at end of file diff --git a/Assets/_Datas/02.Scripts/Restaurants/RestaurantPlayer.cs b/Assets/_Datas/02.Scripts/Restaurants/RestaurantPlayer.cs index 5a9841849..07f1bc7b5 100644 --- a/Assets/_Datas/02.Scripts/Restaurants/RestaurantPlayer.cs +++ b/Assets/_Datas/02.Scripts/Restaurants/RestaurantPlayer.cs @@ -1,9 +1,7 @@ -using System; using System.Collections; using Sirenix.OdinInspector; using UnityEngine; using UnityEngine.InputSystem; -using UnityEngine.Serialization; namespace DDD {