Commit 7b1a3753 authored by 18손재민's avatar 18손재민

머지 완료. 이제 일반 벽이랑 거울을 구분하지 않음.

parent 5ac41704
This diff is collapsed.
fileFormatVersion: 2
guid: efdd0a8c7422a444aaf46a97886b9674
guid: dbb2e09c19fe5ad49b11a6b95e5ac9e8
PrefabImporter:
externalObjects: {}
userData:
......
......@@ -60,7 +60,6 @@ Transform:
m_Children:
- {fileID: 630498074586648373}
- {fileID: 630498075143909937}
- {fileID: 3826732887261846405}
- {fileID: 529438060023616287}
m_Father: {fileID: 0}
m_RootOrder: 0
......@@ -81,8 +80,7 @@ MonoBehaviour:
testInputSizeY: 0
maxMapSize: 0
floors: {fileID: 630498074586648370}
normalWalls: {fileID: 630498075143909950}
mirrors: {fileID: 7511194446601115184}
walls: {fileID: 630498075143909950}
objects: {fileID: 4632550998073714819}
startFloors: []
--- !u!1 &630498075143909950
......@@ -95,7 +93,7 @@ GameObject:
m_Component:
- component: {fileID: 630498075143909937}
m_Layer: 0
m_Name: NormalWalls
m_Name: Walls
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
......@@ -143,35 +141,5 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 630498074781569475}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &7511194446601115184
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3826732887261846405}
m_Layer: 0
m_Name: Mirrors
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3826732887261846405
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7511194446601115184}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 630498074781569475}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......@@ -30,7 +30,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1444571407667829093}
m_RootOrder: 3
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1}
......@@ -190,7 +190,7 @@ RectTransform:
m_Children:
- {fileID: 1439117913}
m_Father: {fileID: 1444571407667829093}
m_RootOrder: 8
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
......@@ -280,7 +280,7 @@ MonoBehaviour:
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 3
m_IntArgument: 4
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
......@@ -300,7 +300,7 @@ GameObject:
- component: {fileID: 696008945}
- component: {fileID: 696008944}
m_Layer: 5
m_Name: Select Wall
m_Name: Select NormalWall
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
......@@ -323,7 +323,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -100, y: -300}
m_AnchoredPosition: {x: -100, y: -250}
m_SizeDelta: {x: 150, y: 150}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &696008946
......@@ -527,11 +527,11 @@ RectTransform:
m_Children:
- {fileID: 369540419}
m_Father: {fileID: 1444571407667829093}
m_RootOrder: 4
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -100, y: -502}
m_AnchoredPosition: {x: -100, y: -552}
m_SizeDelta: {x: 150, y: 150}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &820947106
......@@ -702,7 +702,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Wall
m_Text: Normal Wall
--- !u!1 &1313533563
GameObject:
m_ObjectHideFlags: 0
......@@ -735,7 +735,7 @@ RectTransform:
m_Children:
- {fileID: 1986925106}
m_Father: {fileID: 1444571407667829093}
m_RootOrder: 7
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
......@@ -1181,7 +1181,7 @@ RectTransform:
m_Children:
- {fileID: 1689662818}
m_Father: {fileID: 1444571407667829093}
m_RootOrder: 5
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
......@@ -1565,6 +1565,135 @@ MonoBehaviour:
m_CallState: 2
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!1 &81655362707678673
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8783809867742632484}
- component: {fileID: 3181193321318070976}
- component: {fileID: 6686507055774122234}
- component: {fileID: 1575022290113492524}
m_Layer: 5
m_Name: Select Mirror
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8783809867742632484
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 81655362707678673}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 3609199073757121303}
m_Father: {fileID: 1444571407667829093}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -100, y: -400}
m_SizeDelta: {x: 150, y: 150}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3181193321318070976
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 81655362707678673}
m_CullTransparentMesh: 0
--- !u!114 &6686507055774122234
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 81655362707678673}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
--- !u!114 &1575022290113492524
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 81655362707678673}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 6686507055774122234}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1444571408780882988}
m_MethodName: SwitchMode
m_Mode: 3
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 3
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!1 &1444571407224148018
GameObject:
m_ObjectHideFlags: 0
......@@ -1739,6 +1868,7 @@ RectTransform:
- {fileID: 1397994405}
- {fileID: 2052786946}
- {fileID: 696008943}
- {fileID: 8783809867742632484}
- {fileID: 153720728}
- {fileID: 820947103}
- {fileID: 1805658145}
......@@ -2328,6 +2458,85 @@ MonoBehaviour:
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: y
--- !u!1 &1635523780322756234
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3609199073757121303}
- component: {fileID: 7505153412200370459}
- component: {fileID: 3354903131333413546}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3609199073757121303
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1635523780322756234}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 8783809867742632484}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7505153412200370459
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1635523780322756234}
m_CullTransparentMesh: 0
--- !u!114 &3354903131333413546
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1635523780322756234}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 50
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 3
m_MaxSize: 300
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Mirror
--- !u!1 &1659395240958955467
GameObject:
m_ObjectHideFlags: 0
......@@ -2567,5 +2776,5 @@ Transform:
- {fileID: 1444571408487427164}
- {fileID: 4478955882850902285}
m_Father: {fileID: 1444571407667829093}
m_RootOrder: 6
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......@@ -47,9 +47,10 @@ MonoBehaviour:
floor: {fileID: 19711883686801522, guid: 71931eea896a59a4683986cfd369b8ee, type: 3}
normalWall: {fileID: 2953616027608884528, guid: a4dcd71ec9f819f4e88c7b5ac24f4b0d,
type: 3}
mirror: {fileID: 0}
players: []
player: {fileID: 8862060874303168220, guid: 6ba287375b5ad4b458a7b7b99c6d6a08, type: 3}
currentMap: {fileID: 0}
surface: {fileID: 0}
stage:
- {fileID: 2597539376576235671, guid: bec0ce48aa2c7d14abcf504346360066, type: 3}
- {fileID: 2496973653136699540, guid: dbb2e09c19fe5ad49b11a6b95e5ac9e8, type: 3}
......@@ -1215,7 +1215,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &1444571408780882984
Transform:
m_ObjectHideFlags: 0
......
......@@ -491,11 +491,6 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1444571407667829093, guid: 0b18400fb62a12d4e9cb5fbb8ecbb53f,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 0b18400fb62a12d4e9cb5fbb8ecbb53f, type: 3}
--- !u!1001 &5089720519379341084
......@@ -639,12 +634,6 @@ PrefabInstance:
propertyPath: surface
value:
objectReference: {fileID: 2102809461}
- target: {fileID: 3268100033343711389, guid: 11285456de5f1854d947bea83275646f,
type: 3}
propertyPath: stage.Array.data[0]
value:
objectReference: {fileID: 1662066324165145400, guid: efdd0a8c7422a444aaf46a97886b9674,
type: 3}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 11285456de5f1854d947bea83275646f, type: 3}
--- !u!1001 &7277015660625800392
......
......@@ -8,12 +8,10 @@ public class Map : MonoBehaviour
public int testInputSizeX, testInputSizeY;
public int maxMapSize;
public Dictionary<Vector2Int, Floor> floorGrid;
public Dictionary<Vector2, NormalWall> normalWallGrid;
public Dictionary<Vector2, Mirror> mirrorGrid;
public Dictionary<Vector2, Wall> wallGrid;
public Dictionary<Vector2Int, IObject> objectGrid;
public GameObject floors;
public GameObject normalWalls;
public GameObject mirrors;
public GameObject walls;
public GameObject objects;
public List<Floor> startFloors;
......@@ -38,7 +36,7 @@ public class Map : MonoBehaviour
/// <returns></returns>
public Wall GetWallAtPos(Vector2 pos)
{
return normalWallGrid.ContainsKey(pos) ? normalWallGrid[pos] : null;
return wallGrid.ContainsKey(pos) ? wallGrid[pos] : null;
}
/// <summary>
/// Create floor at position.
......@@ -99,7 +97,8 @@ public class Map : MonoBehaviour
/// Create wall at position.
/// </summary>
/// <param name="pos">Position of wall.</param>
public void CreateNormalWall(Vector2 pos)
/// <param name="wallType">Type of walls.</param>
public void CreateWall(Vector2 pos, WallType wallType)
{
if (((int)pos.x >= 0 ? ((int)pos.x > maxMapSize / 2) : ((int)pos.x < -maxMapSize / 2)) || ((int)pos.y >= 0 ? ((int)pos.y > maxMapSize / 2) : ((int)pos.y < -maxMapSize / 2)))
{
......@@ -111,14 +110,18 @@ public class Map : MonoBehaviour
Debug.Log("Inappropriate position of wall.");
return;
}
if (!normalWallGrid.ContainsKey(pos))
if (!wallGrid.ContainsKey(pos))
{
normalWallGrid.Add(pos, Instantiate(MapManager.inst.normalWall, new Vector3(pos.x, 0, pos.y), Quaternion.identity, normalWalls.transform).GetComponent<NormalWall>());
normalWallGrid[pos].mapPos = pos;
if(wallType == WallType.Normal)
wallGrid.Add(pos, Instantiate(MapManager.inst.normalWall, new Vector3(pos.x, 0, pos.y), Quaternion.identity, walls.transform).GetComponent<Wall>());
else if (wallType == WallType.Mirror)
wallGrid.Add(pos, Instantiate(MapManager.inst.mirror, new Vector3(pos.x, 0, pos.y), Quaternion.identity, walls.transform).GetComponent<Wall>());
wallGrid[pos].mapPos = pos;
wallGrid[pos].type = wallType;
if (Mathf.Abs(pos.x * 10) % 10 == 5)
normalWallGrid[pos].transform.eulerAngles = new Vector3(0, 90, 0);
wallGrid[pos].transform.eulerAngles = new Vector3(0, 90, 0);
else if (Mathf.Abs(pos.y * 10) % 10 == 5)
normalWallGrid[pos].transform.eulerAngles = new Vector3(0, 0, 0);
wallGrid[pos].transform.eulerAngles = new Vector3(0, 0, 0);
StartCoroutine(MapManager.inst.Rebaker());
}
else
......@@ -130,12 +133,13 @@ public class Map : MonoBehaviour
/// <param name="pos">Start position of wall.</param>
/// <param name="dir">Direction of walls.</param>
/// <param name="length">Amount of walls.</param>
public void CreateNormalWall(Vector2 pos, Vector2 dir, int length)
/// <param name="wallType">Type of walls.</param>
public void CreateWall(Vector2 pos, Vector2 dir, int length, WallType wallType)
{
Vector2 wallPos = pos;
for (int i = 0; i < length; i++)
{
CreateNormalWall(wallPos);
CreateWall(wallPos, wallType);
wallPos += new Vector2((int)dir.x, (int)dir.y);
}
}
......@@ -145,10 +149,10 @@ public class Map : MonoBehaviour
/// <param name="pos">Position of wall.</param>
public void RemoveWall(Vector2 pos)
{
if (normalWallGrid.ContainsKey(pos))
if (wallGrid.ContainsKey(pos))
{
Destroy(normalWallGrid[pos].gameObject);
normalWallGrid.Remove(pos);
Destroy(wallGrid[pos].gameObject);
wallGrid.Remove(pos);
StartCoroutine(MapManager.inst.Rebaker());
}
else
......@@ -158,25 +162,19 @@ public class Map : MonoBehaviour
private void LoadObjects()
{
floorGrid = new Dictionary<Vector2Int, Floor>();
normalWallGrid = new Dictionary<Vector2, NormalWall>();
mirrorGrid = new Dictionary<Vector2, Mirror>();
wallGrid = new Dictionary<Vector2, Wall>();
objectGrid = new Dictionary<Vector2Int, IObject>();
for (int i = 0; i < floors.transform.childCount; i++)
{
Floor floor = floors.transform.GetChild(i).GetComponent<Floor>();
floorGrid.Add(floor.mapPos, floor);
}
for (int i = 0; i < normalWalls.transform.childCount; i++)
for (int i = 0; i < walls.transform.childCount; i++)
{
NormalWall normalWall = normalWalls.transform.GetChild(i).GetComponent<NormalWall>();
normalWallGrid.Add(normalWall.mapPos, normalWall);
Wall wall = walls.transform.GetChild(i).GetComponent<Wall>();
wallGrid.Add(wall.mapPos, wall);
}
for (int i = 0; i < mirrors.transform.childCount; i++)
{
Mirror mirror = mirrors.transform.GetChild(i).GetComponent<Mirror>();
mirrorGrid.Add(mirror.mapPos, mirror);
}
for (int i = 0; i < mirrors.transform.childCount; i++)
for (int i = 0; i < objects.transform.childCount; i++)
{
IObject iObject = objects.transform.GetChild(i).GetComponent<IObject>();
objectGrid.Add(iObject.GetPos(), iObject);
......@@ -186,7 +184,7 @@ public class Map : MonoBehaviour
public void InitiateMap()
{
floorGrid = new Dictionary<Vector2Int, Floor>();
normalWallGrid = new Dictionary<Vector2, NormalWall>();
wallGrid = new Dictionary<Vector2, Wall>();
startFloors = new List<Floor>();
}
......
......@@ -36,17 +36,11 @@ public class Mirror : Wall, IBulletInteractor, IBreakable
};
// check before reflect (check walls and mirrors)
foreach (var wall in MapManager.inst.currentMap.normalWallGrid)
foreach (var wall in MapManager.inst.currentMap.wallGrid)
{
Pair<float, float> pair = new Pair<float, float>(PointToParRay(stPos, wall.Value.ldPos, false), PointToParRay(stPos, wall.Value.rdPos, false));
if (pair.l > pair.r) pair = pair.Swap();
SubtractRay(parRay, pair);
}
foreach (var mirr in MapManager.inst.currentMap.mirrorGrid)
{
if (mirr.Value != this)
if (wall.Value.mapPos != mapPos)
{
Pair<float, float> pair = new Pair<float, float>(PointToParRay(stPos, mirr.Value.ldPos, false), PointToParRay(stPos, mirr.Value.rdPos, false));
Pair<float, float> pair = new Pair<float, float>(PointToParRay(stPos, wall.Value.ldPos, false), PointToParRay(stPos, wall.Value.rdPos, false));
if (pair.l > pair.r) pair = pair.Swap();
SubtractRay(parRay, pair);
}
......@@ -70,8 +64,9 @@ public class Mirror : Wall, IBulletInteractor, IBreakable
{
if ((dir ? floor.Key.y : floor.Key.x) == i)
{
if (IsInRay(parRay, PointToParRay(stPos, floor.Value.mapPos, true)))
{ // copy floor
if (IsInRay(parRay, PointToParRay(stPos, floor.Value.mapPos, true)))
{
/*copy floor*/
int nextx = dir ? floor.Key.x : 2 * ldPos.x - floor.Key.x;
int nexty = dir ? 2 * ldPos.y - floor.Key.y : floor.Key.y;
MapManager.inst.currentMap.CreateFloor(new Vector2Int(nextx, nexty));
......@@ -88,23 +83,18 @@ public class Mirror : Wall, IBulletInteractor, IBreakable
}
}
}
foreach (var wall in MapManager.inst.currentMap.normalWallGrid)
foreach (var wall in MapManager.inst.currentMap.wallGrid)
{
if ((dir ? wall.Key.y : wall.Key.x) == i)
{
Pair<float, float> pair = new Pair<float, float>(PointToParRay(stPos, wall.Value.ldPos, true), PointToParRay(stPos, wall.Value.rdPos, true));
if (pair.l > pair.r) pair = pair.Swap();
/*copy wall*/
SubtractRay(parRay, pair);
}
}
foreach (var mirr in MapManager.inst.currentMap.mirrorGrid)
{
if (mirr.Value != this && (dir ? mirr.Key.y : mirr.Key.x) == i)
{
Pair<float, float> pair = new Pair<float, float>(PointToParRay(stPos, mirr.Value.ldPos, true), PointToParRay(stPos, mirr.Value.rdPos, true));
if (pair.l > pair.r) pair = pair.Swap();
/*copy mirror*/
float nextx = dir ? wall.Key.x : 2 * ldPos.x - wall.Key.x;
float nexty = dir ? 2 * ldPos.y - wall.Key.y : wall.Key.y;
MapManager.inst.currentMap.CreateWall(new Vector2(nextx, nexty), wall.Value.type);
SubtractRay(parRay, pair);
}
}
......
......@@ -11,7 +11,7 @@ public class MapEditor : SingletonBehaviour<MapEditor>
public Map currentMap;
public Map[] stage;
public MapEditorTile tile;
public enum TileMode { None, Floor, Wall, StartFloor };
public enum TileMode { None, Floor, NormalWall, Mirror, StartFloor };
TileMode currentMode;
public Text modeSign;
public GameObject startSign;
......@@ -47,13 +47,13 @@ public class MapEditor : SingletonBehaviour<MapEditor>
Debug.Log("There is no start floor.");
else
{
foreach(Transform child in currentMap.normalWalls.transform)
foreach(Transform child in currentMap.walls.transform)
{
child.gameObject.GetComponent<MeshRenderer>().material = realWallMat;
}
PrefabUtility.SaveAsPrefabAsset(_newMap.gameObject, localPath);
Debug.Log("Map saved at " + localPath);
foreach (Transform child in currentMap.normalWalls.transform)
foreach (Transform child in currentMap.walls.transform)
{
child.gameObject.GetComponent<MeshRenderer>().material = editWallMat;
}
......@@ -142,18 +142,30 @@ public class MapEditor : SingletonBehaviour<MapEditor>
else
currentMap.RemoveFloor(clickedPos);
}
else if(currentMode == TileMode.Wall)
else if(currentMode == TileMode.NormalWall)
{
if (isCreateMode)
{
Debug.Log(wallPos);
currentMap.CreateNormalWall(wallPos);
currentMap.CreateWall(wallPos, WallType.Normal);
if(currentMap.GetWallAtPos(wallPos) != null)
currentMap.GetWallAtPos(wallPos).gameObject.GetComponent<MeshRenderer>().material = editWallMat;
}
else
currentMap.RemoveWall(wallPos);
}
else if (currentMode == TileMode.Mirror)
{
if (isCreateMode)
{
Debug.Log(wallPos);
currentMap.CreateWall(wallPos, WallType.Mirror);
if (currentMap.GetWallAtPos(wallPos) != null)
currentMap.GetWallAtPos(wallPos).gameObject.GetComponent<MeshRenderer>().material = editWallMat;
}
else
currentMap.RemoveWall(wallPos);
}
else if(currentMode == TileMode.StartFloor)
{
if (isCreateMode)
......
......@@ -9,6 +9,7 @@ public class MapManager : SingletonBehaviour<MapManager>
public bool isMapEditingOn;
public Floor floor;
public NormalWall normalWall;
public Mirror mirror;
public List<GameObject> players;
public GameObject player;
public Map currentMap;
......
......@@ -8,7 +8,7 @@ public class MirrorReflect : MonoBehaviour
enum Direction { X, Z } // +X direction and +Z direction. Mirror on both side
[SerializeField]
private Direction direction;
private Direction direction = Direction.X;
public Transform mirror;
public Transform mainCam;
......
......@@ -9,7 +9,7 @@ public class TestTools : MonoBehaviour
public InputField wallXInput, wallYInput;
public void AddFloor()
/*public void AddFloor()
{
MapManager.inst.currentMap.CreateFloor(new Vector2Int(int.Parse(floorXInput.text), int.Parse(floorYInput.text)));
}
......@@ -19,7 +19,7 @@ public class TestTools : MonoBehaviour
}
public void AddWall()
{
MapManager.inst.currentMap.CreateNormalWall(new Vector2(float.Parse(wallXInput.text), float.Parse(wallYInput.text)));
MapManager.inst.currentMap.CreateWall(new Vector2(float.Parse(wallXInput.text), float.Parse(wallYInput.text)));
}
public void RemoveWall()
{
......@@ -33,7 +33,7 @@ public class TestTools : MonoBehaviour
public void LoadMap()
{
MapManager.inst.LoadMap(MapManager.inst.stage[1]);
}
}*/
// Start is called before the first frame update
void Start()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment