Commit 95715b17 authored by 18손재민's avatar 18손재민

맵에디터 수정중. 현재 맵 에디터에서 거울을 생성하면 거울이 고장나는 버그가 있음. 수정할 것.

parent af34d9ac
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &646008409675212278
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5027787848459216200}
- component: {fileID: 841522919254151368}
m_Layer: 0
m_Name: Goal Sign
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5027787848459216200
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 646008409675212278}
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 2}
m_LocalScale: {x: 2, y: 2, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
--- !u!212 &841522919254151368
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 646008409675212278}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: b489da500f22d7a4b8c478cae46976ad, type: 3}
m_Color: {r: 1, g: 0.99501103, b: 0, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 0.16, y: 0.16}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
fileFormatVersion: 2 fileFormatVersion: 2
guid: 32ff564f49869bf40a53d07394eb081b guid: 6801da87b9c13dc4a97e2c31d6e37ab3
PrefabImporter: PrefabImporter:
externalObjects: {} externalObjects: {}
userData: userData:
......
...@@ -2381,10 +2381,13 @@ MonoBehaviour: ...@@ -2381,10 +2381,13 @@ MonoBehaviour:
modeSign: {fileID: 153720729} modeSign: {fileID: 153720729}
startSign: {fileID: 1215997560627761150, guid: 106914c4661964b47ad09efcc4bfba69, startSign: {fileID: 1215997560627761150, guid: 106914c4661964b47ad09efcc4bfba69,
type: 3} type: 3}
goalSign: {fileID: 646008409675212278, guid: 6801da87b9c13dc4a97e2c31d6e37ab3, type: 3}
mapSizeSetter: {fileID: 8774990006778924709} mapSizeSetter: {fileID: 8774990006778924709}
mapEditorTiles: {fileID: 1549724121} mapEditorTiles: {fileID: 1549724121}
editWallMat: {fileID: 2100000, guid: c741ce421701e7c43b7a48c4045a116b, type: 2} editNormalMat: {fileID: 2100000, guid: c741ce421701e7c43b7a48c4045a116b, type: 2}
realWallMat: {fileID: 2100000, guid: 9274dfd686c38aa4f91d973c6de1c8e9, type: 2} editMirrorMat: {fileID: 2100000, guid: 27bba424cd653c047a5d5f6dbd1a0da5, type: 2}
realNormalMat: {fileID: 2100000, guid: 9274dfd686c38aa4f91d973c6de1c8e9, type: 2}
realMirrorMat: {fileID: 2100000, guid: d8c28898e746cd84d8503fbd26995a55, type: 2}
--- !u!1 &1444571408998523813 --- !u!1 &1444571408998523813
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
This diff is collapsed.
...@@ -38,7 +38,7 @@ RenderSettings: ...@@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1 m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0} m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0} m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.18028334, g: 0.2257134, b: 0.30692226, a: 1} m_IndirectSpecularColor: {r: 0.18028334, g: 0.22571328, b: 0.3069217, a: 1}
m_UseRadianceAmbientProbe: 0 m_UseRadianceAmbientProbe: 0
--- !u!157 &3 --- !u!157 &3
LightmapSettings: LightmapSettings:
...@@ -501,6 +501,75 @@ PrefabInstance: ...@@ -501,6 +501,75 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 20dee07e28273f049a9093ae4453912f, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 20dee07e28273f049a9093ae4453912f, type: 3}
--- !u!1001 &1133429038
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 52444459818764334, guid: 42247a938bb6e554eb00dc08303a72d6,
type: 3}
propertyPath: m_Name
value: GameManager
objectReference: {fileID: 0}
- target: {fileID: 52444459818764335, guid: 42247a938bb6e554eb00dc08303a72d6,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 52444459818764335, guid: 42247a938bb6e554eb00dc08303a72d6,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 52444459818764335, guid: 42247a938bb6e554eb00dc08303a72d6,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 52444459818764335, guid: 42247a938bb6e554eb00dc08303a72d6,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 52444459818764335, guid: 42247a938bb6e554eb00dc08303a72d6,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 52444459818764335, guid: 42247a938bb6e554eb00dc08303a72d6,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 52444459818764335, guid: 42247a938bb6e554eb00dc08303a72d6,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 52444459818764335, guid: 42247a938bb6e554eb00dc08303a72d6,
type: 3}
propertyPath: m_RootOrder
value: 6
objectReference: {fileID: 0}
- target: {fileID: 52444459818764335, guid: 42247a938bb6e554eb00dc08303a72d6,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 52444459818764335, guid: 42247a938bb6e554eb00dc08303a72d6,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 52444459818764335, guid: 42247a938bb6e554eb00dc08303a72d6,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 42247a938bb6e554eb00dc08303a72d6, type: 3}
--- !u!1 &1295796961 --- !u!1 &1295796961
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
...@@ -40,5 +40,18 @@ public class GameManager : SingletonBehaviour<GameManager> ...@@ -40,5 +40,18 @@ public class GameManager : SingletonBehaviour<GameManager>
{ {
if (!MapManager.inst.isMapEditingOn) if (!MapManager.inst.isMapEditingOn)
MapManager.inst.LoadMap(MapManager.inst.stage[0]); MapManager.inst.LoadMap(MapManager.inst.stage[0]);
else
{
for (int i = 0; i < 9; i++) clearIndex[i] = -1;
nFloor = clearIndex[(int)ClearType.NFloor];
nTurret = clearIndex[(int)ClearType.NTurret];
nCase = clearIndex[(int)ClearType.NCase];
nPlayer = clearIndex[(int)ClearType.NPlayer];
aFloor = clearIndex[(int)ClearType.AllFloor];
aTurret = clearIndex[(int)ClearType.AllTurret];
aCase = clearIndex[(int)ClearType.AllCase];
white = clearIndex[(int)ClearType.White];
black = clearIndex[(int)ClearType.Black];
}
} }
} }
...@@ -32,20 +32,23 @@ public class ClearCondition ...@@ -32,20 +32,23 @@ public class ClearCondition
public void IsDone(int _count = 0, int _goal = 0) public void IsDone(int _count = 0, int _goal = 0)
{ {
count += _count; if (!MapManager.inst.isMapEditingOn)
goal += _goal;
if (goal <= count)
{ {
GameManager.inst.clearCounter--; count += _count;
isDone = true; goal += _goal;
Debug.Log(GameManager.inst.clearCounter); if (goal <= count)
if (GameManager.inst.clearCounter == 0) {
GameManager.inst.ClearStage(); GameManager.inst.clearCounter--;
} isDone = true;
else if (goal > count && isDone) Debug.Log(GameManager.inst.clearCounter);
{ if (GameManager.inst.clearCounter == 0)
GameManager.inst.clearCounter++; GameManager.inst.ClearStage();
isDone = false; }
else if (goal > count && isDone)
{
GameManager.inst.clearCounter++;
isDone = false;
}
} }
} }
} }
...@@ -61,7 +61,7 @@ public class Map : MonoBehaviour ...@@ -61,7 +61,7 @@ public class Map : MonoBehaviour
floorGrid[pos].mapPos = pos; floorGrid[pos].mapPos = pos;
floorGrid[pos].isGoalFloor = isGoal; floorGrid[pos].isGoalFloor = isGoal;
if (GameManager.aFloor >= 0 && isGoal) if (GameManager.aFloor >= 0 && isGoal)
MapManager.inst.currentMap.clearConditions[GameManager.aFloor].IsDone(0, 1); clearConditions[GameManager.aFloor].IsDone(0, 1);
StartCoroutine(MapManager.inst.Rebaker()); StartCoroutine(MapManager.inst.Rebaker());
} }
else else
...@@ -96,7 +96,7 @@ public class Map : MonoBehaviour ...@@ -96,7 +96,7 @@ public class Map : MonoBehaviour
if (floorGrid.ContainsKey(pos)) if (floorGrid.ContainsKey(pos))
{ {
if (GameManager.aFloor >= 0 && floorGrid[pos].isGoalFloor) if (GameManager.aFloor >= 0 && floorGrid[pos].isGoalFloor)
MapManager.inst.currentMap.clearConditions[GameManager.aFloor].IsDone(0, -1); clearConditions[GameManager.aFloor].IsDone(0, -1);
Destroy(floorGrid[pos].gameObject); Destroy(floorGrid[pos].gameObject);
floorGrid.Remove(pos); floorGrid.Remove(pos);
StartCoroutine(MapManager.inst.Rebaker()); StartCoroutine(MapManager.inst.Rebaker());
...@@ -219,12 +219,12 @@ public class Map : MonoBehaviour ...@@ -219,12 +219,12 @@ public class Map : MonoBehaviour
case ObjType.Briefcase: case ObjType.Briefcase:
objectGrid.Add(pos, Instantiate(MapManager.inst.briefCase, new Vector3(pos.x, 0, pos.y), Quaternion.identity, objects.transform).GetComponent<IObject>()); objectGrid.Add(pos, Instantiate(MapManager.inst.briefCase, new Vector3(pos.x, 0, pos.y), Quaternion.identity, objects.transform).GetComponent<IObject>());
if (GameManager.aCase >= 0) if (GameManager.aCase >= 0)
MapManager.inst.currentMap.clearConditions[GameManager.aCase].IsDone(0, 1); clearConditions[GameManager.aCase].IsDone(0, 1);
break; break;
case ObjType.Camera: case ObjType.Camera:
objectGrid.Add(pos, Instantiate(MapManager.inst.cameraTurret, new Vector3(pos.x, 0, pos.y), Quaternion.identity, objects.transform).GetComponent<IObject>()); objectGrid.Add(pos, Instantiate(MapManager.inst.cameraTurret, new Vector3(pos.x, 0, pos.y), Quaternion.identity, objects.transform).GetComponent<IObject>());
if (GameManager.aTurret >= 0) if (GameManager.aTurret >= 0)
MapManager.inst.currentMap.clearConditions[GameManager.aTurret].IsDone(0, 1); clearConditions[GameManager.aTurret].IsDone(0, 1);
break; break;
case ObjType.Mannequin: case ObjType.Mannequin:
objectGrid.Add(pos, Instantiate(MapManager.inst.mannequins[Random.Range(0, 5)], new Vector3(pos.x, 0, pos.y), Quaternion.identity, objects.transform).GetComponent<IObject>()); objectGrid.Add(pos, Instantiate(MapManager.inst.mannequins[Random.Range(0, 5)], new Vector3(pos.x, 0, pos.y), Quaternion.identity, objects.transform).GetComponent<IObject>());
...@@ -246,15 +246,15 @@ public class Map : MonoBehaviour ...@@ -246,15 +246,15 @@ public class Map : MonoBehaviour
if (objectGrid.ContainsKey(pos)) if (objectGrid.ContainsKey(pos))
{ {
if(objectGrid[pos].GetType() == ObjType.Briefcase && GameManager.aCase >= 0) if(objectGrid[pos].GetType() == ObjType.Briefcase && GameManager.aCase >= 0)
MapManager.inst.currentMap.clearConditions[GameManager.aCase].IsDone(0, -1); clearConditions[GameManager.aCase].IsDone(0, -1);
else if (objectGrid[pos].GetType() == ObjType.Camera && GameManager.aTurret >= 0) else if (objectGrid[pos].GetType() == ObjType.Camera && GameManager.aTurret >= 0)
MapManager.inst.currentMap.clearConditions[GameManager.aTurret].IsDone(0, -1); clearConditions[GameManager.aTurret].IsDone(0, -1);
else if(objectGrid[pos].GetType() == ObjType.Mannequin) else if(objectGrid[pos].GetType() == ObjType.Mannequin)
{ {
if(objectGrid[pos].GetObject().GetComponent<Mannequin>().isWhite && GameManager.white >= 0) if(objectGrid[pos].GetObject().GetComponent<Mannequin>().isWhite && GameManager.white >= 0)
MapManager.inst.currentMap.clearConditions[GameManager.white].IsDone(0, -1); clearConditions[GameManager.white].IsDone(0, -1);
else if (!objectGrid[pos].GetObject().GetComponent<Mannequin>().isWhite && GameManager.black >= 0) else if (!objectGrid[pos].GetObject().GetComponent<Mannequin>().isWhite && GameManager.black >= 0)
MapManager.inst.currentMap.clearConditions[GameManager.black].IsDone(0, -1); clearConditions[GameManager.black].IsDone(0, -1);
} }
Destroy(objectGrid[pos].GetObject()); Destroy(objectGrid[pos].GetObject());
objectGrid.Remove(pos); objectGrid.Remove(pos);
......
...@@ -9,16 +9,13 @@ public class MapEditor : SingletonBehaviour<MapEditor> ...@@ -9,16 +9,13 @@ public class MapEditor : SingletonBehaviour<MapEditor>
public Map currentMap; public Map currentMap;
public Map[] stage; public Map[] stage;
public MapEditorTile tile; public MapEditorTile tile;
public enum TileMode { None, Floor, NormalWall, Mirror, StartFloor, Briefcase, Camera, WMannequin, BMannequin }; public enum TileMode { None, Floor, Normal, Mirror, StartFloor, Briefcase, Camera, WMannequin, BMannequin, goalFloor };
TileMode currentMode; TileMode currentMode;
public Text modeSign; public Text modeSign;
public GameObject startSign; public GameObject startSign, goalSign, mapSizeSetter, mapEditorTiles;
public Dictionary<Floor, GameObject> startSigns; public Dictionary<Floor, GameObject> startSigns, goalSigns;
public GameObject mapSizeSetter;
public GameObject mapEditorTiles;
public Material editWallMat; public Material editNormalMat, realNormalMat;
public Material realWallMat;
bool isEditorStarted; bool isEditorStarted;
bool isCreateMode; bool isCreateMode;
...@@ -45,16 +42,14 @@ public class MapEditor : SingletonBehaviour<MapEditor> ...@@ -45,16 +42,14 @@ public class MapEditor : SingletonBehaviour<MapEditor>
Debug.Log("There is no start floor."); Debug.Log("There is no start floor.");
else else
{ {
foreach(Transform child in currentMap.walls.transform) foreach (Transform child in currentMap.walls.transform)
{ if (child.GetComponent<Wall>() is NormalWall)
child.gameObject.GetComponent<MeshRenderer>().material = realWallMat; child.gameObject.GetComponent<MeshRenderer>().material = realNormalMat;
}
PrefabUtility.SaveAsPrefabAsset(_newMap.gameObject, localPath); PrefabUtility.SaveAsPrefabAsset(_newMap.gameObject, localPath);
Debug.Log("Map saved at " + localPath); Debug.Log("Map saved at " + localPath);
foreach (Transform child in currentMap.walls.transform) foreach (Transform child in currentMap.walls.transform)
{ if (child.GetComponent<Wall>() is NormalWall)
child.gameObject.GetComponent<MeshRenderer>().material = editWallMat; child.gameObject.GetComponent<MeshRenderer>().material = editNormalMat;
}
} }
} }
public void SaveCurrentMap() public void SaveCurrentMap()
...@@ -140,26 +135,14 @@ public class MapEditor : SingletonBehaviour<MapEditor> ...@@ -140,26 +135,14 @@ public class MapEditor : SingletonBehaviour<MapEditor>
else else
currentMap.RemoveFloor(clickedPos); currentMap.RemoveFloor(clickedPos);
} }
else if(currentMode == TileMode.NormalWall) else if(currentMode == TileMode.Normal || currentMode == TileMode.Mirror)
{
if (isCreateMode)
{
Debug.Log(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) if (isCreateMode)
{ {
Debug.Log(wallPos); Debug.Log(wallPos);
currentMap.CreateWall(wallPos, WallType.Mirror); currentMap.CreateWall(wallPos, (WallType)((int)currentMode - 1));
if (currentMap.GetWallAtPos(wallPos) != null) if (currentMap.GetWallAtPos(wallPos) != null && currentMap.GetWallAtPos(wallPos).GetComponent<Wall>() is NormalWall)
currentMap.GetWallAtPos(wallPos).gameObject.GetComponent<MeshRenderer>().material = editWallMat; currentMap.GetWallAtPos(wallPos).gameObject.GetComponent<MeshRenderer>().material = editNormalMat;
} }
else else
currentMap.RemoveWall(wallPos); currentMap.RemoveWall(wallPos);
...@@ -193,7 +176,32 @@ public class MapEditor : SingletonBehaviour<MapEditor> ...@@ -193,7 +176,32 @@ public class MapEditor : SingletonBehaviour<MapEditor>
} }
} }
} }
else if((int)currentMode >= 5) else if(currentMode == TileMode.goalFloor)
{
if (isCreateMode)
{
if (currentMap.GetFloorAtPos(clickedPos).isGoalFloor)
Debug.Log("Goal floor already exists at : (" + clickedPos.x + ", " + clickedPos.y + ")");
else
{
currentMap.GetFloorAtPos(clickedPos).isGoalFloor = true;
goalSigns.Add(currentMap.GetFloorAtPos(clickedPos), Instantiate(goalSign));
goalSigns[currentMap.GetFloorAtPos(clickedPos)].transform.position = new Vector3(clickedPos.x, 2, clickedPos.y);
}
}
else
{
if (!currentMap.GetFloorAtPos(clickedPos).isGoalFloor)
Debug.Log("Goal floor doesn't exist at : (" + clickedPos.x + ", " + clickedPos.y + ")");
else
{
currentMap.GetFloorAtPos(clickedPos).isGoalFloor = false;
Destroy(goalSigns[currentMap.GetFloorAtPos(clickedPos)].gameObject);
goalSigns.Remove(currentMap.GetFloorAtPos(clickedPos));
}
}
}
else if((int)currentMode >= 5 && (int)currentMode <= 8)
{ {
if (isCreateMode) if (isCreateMode)
{ {
......
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