Wall 그리기 기능 리팩토링

This commit is contained in:
geondo55
2025-04-16 11:14:53 +09:00
parent 2c3f69b0b8
commit 1cd614a45d
7 changed files with 44 additions and 100 deletions

View File

@@ -2973,72 +2973,6 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 4, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1001 &812349387
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 1093055756}
m_Modifications:
- target: {fileID: 3963811325703941763, guid: a906cd4ab09260143b9d87e622d9e458, type: 3}
propertyPath: m_Name
value: WallBuilder
objectReference: {fileID: 0}
- target: {fileID: 3963811325703941763, guid: a906cd4ab09260143b9d87e622d9e458, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7756644939596186566, guid: a906cd4ab09260143b9d87e622d9e458, type: 3}
propertyPath: m_LocalPosition.x
value: 1.3484559
objectReference: {fileID: 0}
- target: {fileID: 7756644939596186566, guid: a906cd4ab09260143b9d87e622d9e458, type: 3}
propertyPath: m_LocalPosition.y
value: 3.002852
objectReference: {fileID: 0}
- target: {fileID: 7756644939596186566, guid: a906cd4ab09260143b9d87e622d9e458, type: 3}
propertyPath: m_LocalPosition.z
value: -2.1850286
objectReference: {fileID: 0}
- target: {fileID: 7756644939596186566, guid: a906cd4ab09260143b9d87e622d9e458, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7756644939596186566, guid: a906cd4ab09260143b9d87e622d9e458, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7756644939596186566, guid: a906cd4ab09260143b9d87e622d9e458, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7756644939596186566, guid: a906cd4ab09260143b9d87e622d9e458, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7756644939596186566, guid: a906cd4ab09260143b9d87e622d9e458, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7756644939596186566, guid: a906cd4ab09260143b9d87e622d9e458, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7756644939596186566, guid: a906cd4ab09260143b9d87e622d9e458, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a906cd4ab09260143b9d87e622d9e458, type: 3}
--- !u!4 &812349388 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 7756644939596186566, guid: a906cd4ab09260143b9d87e622d9e458, type: 3}
m_PrefabInstance: {fileID: 812349387}
m_PrefabAsset: {fileID: 0}
--- !u!1 &827571245
GameObject:
m_ObjectHideFlags: 0
@@ -4244,7 +4178,6 @@ Transform:
- {fileID: 1149817090}
- {fileID: 636283413}
- {fileID: 2021424132}
- {fileID: 812349388}
- {fileID: 538683123}
- {fileID: 617235297}
- {fileID: 749092880}

View File

@@ -12,5 +12,23 @@ namespace XED
Select,
Setting
}
public enum VirtualPoint
{
LeftTop,
LeftBottom,
RightTop,
RightBottom,
LeftCenter,
RightCenter,
}
public enum BuilderState
{
None,
PointModfiy,
PointRemove,
Drawing
}
}
}

View File

@@ -5,9 +5,9 @@ using TriLibCore.Dae.Schema;
using UnityEngine;
using XRLib;
namespace XED
namespace XED.Manage
{
public class MeshCreator : MonoBehaviour,ISingle
public class MeshCreator : Manager
{
Vector3[] vertices;
int[] triangles;
@@ -15,6 +15,11 @@ namespace XED
private MeshFilter meshfilter;
//private Vector3 offset = Vector3.zero;
public override void Init()
{
}
public void MeshDeformer<T>(HashSet<T> type)
{
if(type is HashSet<Floor>)

View File

@@ -5,7 +5,7 @@ using System.Linq;
using System.Security.Cryptography;
using UnityEngine;
using XRLib;
using static XED.WallBuilder;
using static XED.Enums;
using Color = UnityEngine.Color;
namespace XED

View File

@@ -9,28 +9,13 @@ using XRLib;
using XED.Interfaces;
using XED.Manage;
using XED.RuntimeGizmo;
using Object = UnityEngine.Object;
using static XED.Enums;
namespace XED
namespace XED.Manage
{
public class WallBuilder : MonoBehaviour, ISingle, IInputHandler, IModeController
public class WallBuilder : Manager, IInputHandler, IModeController
{
public enum VirtualPoint
{
LeftTop,
LeftBottom,
RightTop,
RightBottom,
LeftCenter,
RightCenter,
}
public enum BuilderState
{
None,
PointModfiy,
PointRemove,
Drawing
}
public float thickness;
private GameObject renderParent;
private Material lineMat;
@@ -81,7 +66,8 @@ namespace XED
wallLines.Add(wallLine);
}
}
public override void AfterAwake()
public override void Init()
{
renderParent = new GameObject("LineRenderParent");
lineMat = Resources.Load<Material>("Materials/Mat_LineRender");
@@ -90,7 +76,7 @@ namespace XED
prf_Wall = Resources.Load<Wall>("Prefabs/PRF_Wall");
prf_WallGroup = Resources.Load<WallGroup>("Prefabs/PRF_WallGroup");
meshCreator = FindSingle<MeshCreator>();
meshCreator = ManagerHub.instance.Get<MeshCreator>();
handler = GetInputHandler();
}
@@ -146,14 +132,14 @@ namespace XED
{
//ToDo..연결된 포인트가 없는 Point찾아서 제거
DisconnectLine(removeWalls[i]);
Destroy(removeWalls[i].gameObject);
Object.Destroy(removeWalls[i].gameObject);
}
Remove(lp);
}
public LinePoint CreateLinePoint(Vector3 pos)
{
var result = Instantiate(prf_LinePoint);
var result = Object.Instantiate(prf_LinePoint);
result.transform.SetParent(renderParent.transform);
result.name = cc++.ToString();
result.transform.position = pos;
@@ -175,7 +161,7 @@ namespace XED
private Wall CreateWall(LinePoint lcp, LinePoint rcp)
{
var result = Instantiate(prf_Wall);
var result = Object.Instantiate(prf_Wall);
result.Generate(lcp, rcp, lineMat, thickness);
result.name = "WallLine" + index++;
walls.Add(result);
@@ -339,7 +325,7 @@ namespace XED
{
linePoints.Remove(lp);
pointToWall.Remove(lp);
Destroy(lp.gameObject);
Object.Destroy(lp.gameObject);
}
void BuildWall(Vector3 endPos)
@@ -426,7 +412,7 @@ namespace XED
pointToWall.Remove(rcp);
}
wall.Deselect();
Destroy(wall.gameObject);
Object.Destroy(wall.gameObject);
}
Wall BuildContinuesWall(Vector3 p)
@@ -684,7 +670,7 @@ namespace XED
private WallGroup CreateWallGroup()
{
var group = Instantiate(prf_WallGroup);
var group = Object.Instantiate(prf_WallGroup);
groupTable.Add(group, new());
wallgroups.Add(group);
@@ -1026,7 +1012,7 @@ namespace XED
linePoints.Remove(handlePoint);
pointToWall.Remove(handlePoint);
handlePoint.Release();
Destroy(handlePoint.gameObject);
Object.Destroy(handlePoint.gameObject);
}
if (pilePoint != null)
@@ -1044,7 +1030,7 @@ namespace XED
{
walls.Remove(tempWall);
tempWall.Release();
Destroy(tempWall.gameObject);
Object.Destroy(tempWall.gameObject);
}
tempWall = null;

View File

@@ -25,6 +25,8 @@ namespace XED.Manage
Join(new NodeGizmoController());
Join(new AGVNodeLinkManager());
Join(new AGVManager());
Join(new WallBuilder());
Join(new MeshCreator());
foreach(var m in managers)
{

View File

@@ -1,7 +1,7 @@
using System;
using UnityEngine.UI;
using XRLib.UI;
using static XED.WallBuilder;
using static XED.Enums;
namespace XED.UI
{