Commit 6f0aa517 authored by 18손재민's avatar 18손재민

Merge branch 'map'

parents b7acf6d1 fc955810
{"objects":[{"tag":0,"xPos":20.0,"yPos":0.0},{"tag":2,"xPos":-2.0,"yPos":0.5},{"tag":3,"xPos":-1.0,"yPos":0.5},{"tag":1,"xPos":-2.0,"yPos":1.0},{"tag":1,"xPos":-1.0,"yPos":1.0},{"tag":1,"xPos":0.0,"yPos":1.0},{"tag":1,"xPos":1.0,"yPos":1.0},{"tag":1,"xPos":1.0,"yPos":0.0},{"tag":1,"xPos":0.0,"yPos":0.0},{"tag":1,"xPos":-1.0,"yPos":0.0},{"tag":1,"xPos":-2.0,"yPos":0.0},{"tag":1,"xPos":-2.0,"yPos":-1.0},{"tag":1,"xPos":0.0,"yPos":-1.0},{"tag":9,"xPos":0.0,"yPos":-1.0},{"tag":1,"xPos":-1.0,"yPos":-1.0},{"tag":9,"xPos":-1.0,"yPos":-1.0},{"tag":1,"xPos":1.0,"yPos":-1.0},{"tag":1,"xPos":1.0,"yPos":-2.0},{"tag":1,"xPos":0.0,"yPos":-2.0},{"tag":1,"xPos":-1.0,"yPos":-2.0},{"tag":1,"xPos":-2.0,"yPos":-2.0},{"tag":4,"xPos":-2.0,"yPos":-2.0},{"tag":4,"xPos":-1.0,"yPos":-2.0},{"tag":5,"xPos":-2.0,"yPos":1.0},{"tag":6,"xPos":-1.0,"yPos":1.0},{"tag":7,"xPos":0.0,"yPos":1.0},{"tag":8,"xPos":1.0,"yPos":1.0}],"clears":[{"type":2,"goal":1},{"type":5,"goal":1}],"bullets":[0,1,2]}
\ No newline at end of file
fileFormatVersion: 2 fileFormatVersion: 2
guid: 936182e5c24ea3e4499b01d2029823eb guid: 801379ac94c79b24cb6c73e213b0854d
folderAsset: yes TextScriptImporter:
DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
......
fileFormatVersion: 2 fileFormatVersion: 2
guid: ef75a379c7ec93a4d85966c580bcc286 guid: 47baf9abe59c90a4d914127b0527c24f
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
......
fileFormatVersion: 2
guid: 2a181461c3622c14b804bb5eabec750c
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:
...@@ -1290,7 +1290,7 @@ Transform: ...@@ -1290,7 +1290,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1549724121} m_GameObject: {fileID: 1549724121}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 125, y: 995, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 1444571408780882984} m_Father: {fileID: 1444571408780882984}
...@@ -2668,9 +2668,8 @@ MonoBehaviour: ...@@ -2668,9 +2668,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 5ad2f39c48d82964f86cd2d6e1e94641, type: 3} m_Script: {fileID: 11500000, guid: 5ad2f39c48d82964f86cd2d6e1e94641, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
currentMap: {fileID: 0} currentMap: {fileID: 630498074781569474, guid: 759f352c81f1b5a40b2d8d241cdf273b,
stage: type: 3}
- {fileID: 630498074781569474, guid: 759f352c81f1b5a40b2d8d241cdf273b, type: 3}
tile: {fileID: 7449840556337937162, guid: 90d0ab9f40a0ddc4c871130319d86cd5, type: 3} tile: {fileID: 7449840556337937162, guid: 90d0ab9f40a0ddc4c871130319d86cd5, type: 3}
modeSign: {fileID: 153720729} modeSign: {fileID: 153720729}
startSign: {fileID: 1215997560627761150, guid: 106914c4661964b47ad09efcc4bfba69, startSign: {fileID: 1215997560627761150, guid: 106914c4661964b47ad09efcc4bfba69,
...@@ -2679,7 +2678,6 @@ MonoBehaviour: ...@@ -2679,7 +2678,6 @@ MonoBehaviour:
mapSizeSetter: {fileID: 8774990006778924709} mapSizeSetter: {fileID: 8774990006778924709}
mapEditorTiles: {fileID: 1549724121} mapEditorTiles: {fileID: 1549724121}
editNormalMat: {fileID: 2100000, guid: c741ce421701e7c43b7a48c4045a116b, type: 2} editNormalMat: {fileID: 2100000, guid: c741ce421701e7c43b7a48c4045a116b, type: 2}
realNormalMat: {fileID: 2100000, guid: 9274dfd686c38aa4f91d973c6de1c8e9, type: 2}
--- !u!1 &1444571408998523813 --- !u!1 &1444571408998523813
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
...@@ -45,7 +45,8 @@ MonoBehaviour: ...@@ -45,7 +45,8 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
isMapEditingOn: 0 isMapEditingOn: 0
surface: {fileID: 0} surface: {fileID: 0}
currentMap: {fileID: 0} currentMap: {fileID: 630498074781569474, guid: 759f352c81f1b5a40b2d8d241cdf273b,
type: 3}
floor: {fileID: 19711883686801522, guid: 71931eea896a59a4683986cfd369b8ee, type: 3} floor: {fileID: 19711883686801522, guid: 71931eea896a59a4683986cfd369b8ee, type: 3}
normalWall: {fileID: 2953616027608884528, guid: a4dcd71ec9f819f4e88c7b5ac24f4b0d, normalWall: {fileID: 2953616027608884528, guid: a4dcd71ec9f819f4e88c7b5ac24f4b0d,
type: 3} type: 3}
...@@ -66,7 +67,7 @@ MonoBehaviour: ...@@ -66,7 +67,7 @@ MonoBehaviour:
- {fileID: 6840018466224391531, guid: d7070c786deaa3a4082f9339da091b46, type: 3} - {fileID: 6840018466224391531, guid: d7070c786deaa3a4082f9339da091b46, type: 3}
- {fileID: 6169104080419908266, guid: 420a4f921e52a4141b80a3eefcd511e6, type: 3} - {fileID: 6169104080419908266, guid: 420a4f921e52a4141b80a3eefcd511e6, type: 3}
- {fileID: 87051754405567689, guid: 2a2831d520acdd3408d8a04673423e2a, type: 3} - {fileID: 87051754405567689, guid: 2a2831d520acdd3408d8a04673423e2a, type: 3}
players: []
player: {fileID: 494213313239918027, guid: 449b2ca4d925da541bb45c84b63aab98, type: 3} player: {fileID: 494213313239918027, guid: 449b2ca4d925da541bb45c84b63aab98, type: 3}
players: []
stage: stage:
- {fileID: 2496973653136699540, guid: dbb2e09c19fe5ad49b11a6b95e5ac9e8, type: 3} - {fileID: 4900000, guid: 801379ac94c79b24cb6c73e213b0854d, type: 3}
...@@ -1413,7 +1413,7 @@ CapsuleCollider: ...@@ -1413,7 +1413,7 @@ CapsuleCollider:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 494213313239918027} m_GameObject: {fileID: 494213313239918027}
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_IsTrigger: 0 m_IsTrigger: 1
m_Enabled: 1 m_Enabled: 1
m_Radius: 0.3 m_Radius: 0.3
m_Height: 2 m_Height: 2
...@@ -1435,6 +1435,7 @@ MonoBehaviour: ...@@ -1435,6 +1435,7 @@ MonoBehaviour:
shootingArm: {fileID: 7838800661811206189} shootingArm: {fileID: 7838800661811206189}
shootingFinger: {fileID: 494213313239918045} shootingFinger: {fileID: 494213313239918045}
armRotation: {x: 0, y: 0, z: 0, w: 0} armRotation: {x: 0, y: 0, z: 0, w: 0}
anim: {fileID: 0}
currentFloor: {fileID: 0} currentFloor: {fileID: 0}
--- !u!1 &494213313239918029 --- !u!1 &494213313239918029
GameObject: GameObject:
......
...@@ -11,6 +11,7 @@ GameObject: ...@@ -11,6 +11,7 @@ GameObject:
- component: {fileID: 2534561534465045041} - component: {fileID: 2534561534465045041}
- component: {fileID: 2534561534464242193} - component: {fileID: 2534561534464242193}
- component: {fileID: 2534561534463275217} - component: {fileID: 2534561534463275217}
- component: {fileID: -2850530927027858165}
- component: {fileID: -4559840392902712278} - component: {fileID: -4559840392902712278}
m_Layer: 0 m_Layer: 0
m_Name: case m_Name: case
...@@ -81,6 +82,19 @@ MeshRenderer: ...@@ -81,6 +82,19 @@ MeshRenderer:
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 0
--- !u!65 &-2850530927027858165
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2534561534465535505}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.52, y: 0.44944128, z: 0.1252539}
m_Center: {x: 0, y: 0.030357078, z: 0}
--- !u!114 &-4559840392902712278 --- !u!114 &-4559840392902712278
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
...@@ -346,18 +346,6 @@ Transform: ...@@ -346,18 +346,6 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 2 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!114 &950340631 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 7277015661519863741, guid: 20dee07e28273f049a9093ae4453912f,
type: 3}
m_PrefabInstance: {fileID: 1046587609}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7a5ac11cc976e418e8d13136b07e1f52, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &977620025 --- !u!1001 &977620025
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -429,7 +417,12 @@ PrefabInstance: ...@@ -429,7 +417,12 @@ PrefabInstance:
type: 3} type: 3}
propertyPath: surface propertyPath: surface
value: value:
objectReference: {fileID: 950340631} objectReference: {fileID: 1382512383}
- target: {fileID: 3268100033343711389, guid: 11285456de5f1854d947bea83275646f,
type: 3}
propertyPath: asd
value:
objectReference: {fileID: 4900000, guid: c4865e9602e96b54b89d9ecb0d3e6d1c, type: 3}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 11285456de5f1854d947bea83275646f, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 11285456de5f1854d947bea83275646f, type: 3}
--- !u!1001 &1046587609 --- !u!1001 &1046587609
...@@ -501,75 +494,6 @@ PrefabInstance: ...@@ -501,75 +494,6 @@ 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
...@@ -666,3 +590,15 @@ MonoBehaviour: ...@@ -666,3 +590,15 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 33643b4d19b5aba4294f4b5894d3404b, type: 3} m_Script: {fileID: 11500000, guid: 33643b4d19b5aba4294f4b5894d3404b, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
--- !u!114 &1382512383 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 7277015661519863741, guid: 20dee07e28273f049a9093ae4453912f,
type: 3}
m_PrefabInstance: {fileID: 1046587609}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7a5ac11cc976e418e8d13136b07e1f52, type: 3}
m_Name:
m_EditorClassIdentifier:
...@@ -1134,12 +1134,6 @@ PrefabInstance: ...@@ -1134,12 +1134,6 @@ PrefabInstance:
propertyPath: surface propertyPath: surface
value: value:
objectReference: {fileID: 2102809461} objectReference: {fileID: 2102809461}
- target: {fileID: 3268100033343711389, guid: 11285456de5f1854d947bea83275646f,
type: 3}
propertyPath: stage.Array.data[0]
value:
objectReference: {fileID: 3529117415661273963, guid: 3d35fd3e6a494bc42921ce1cd03fc637,
type: 3}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 11285456de5f1854d947bea83275646f, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 11285456de5f1854d947bea83275646f, type: 3}
--- !u!1001 &7277015660625800392 --- !u!1001 &7277015660625800392
...@@ -1149,11 +1143,6 @@ PrefabInstance: ...@@ -1149,11 +1143,6 @@ PrefabInstance:
m_Modification: m_Modification:
m_TransformParent: {fileID: 0} m_TransformParent: {fileID: 0}
m_Modifications: m_Modifications:
- target: {fileID: 7277015661519863741, guid: 20dee07e28273f049a9093ae4453912f,
type: 3}
propertyPath: m_NavMeshData
value:
objectReference: {fileID: 0}
- target: {fileID: 7277015661519863740, guid: 20dee07e28273f049a9093ae4453912f, - target: {fileID: 7277015661519863740, guid: 20dee07e28273f049a9093ae4453912f,
type: 3} type: 3}
propertyPath: m_Name propertyPath: m_Name
...@@ -1219,5 +1208,10 @@ PrefabInstance: ...@@ -1219,5 +1208,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 7277015661519863741, guid: 20dee07e28273f049a9093ae4453912f,
type: 3}
propertyPath: m_NavMeshData
value:
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 20dee07e28273f049a9093ae4453912f, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 20dee07e28273f049a9093ae4453912f, type: 3}
public enum TileMode
{
None, Floor, Normal, Mirror, StartFloor,
Briefcase, Camera, WMannequin, BMannequin, goalFloor
}
public enum ClearType
{
NFloor,
NTurret,
NCase,
NPlayer,
AllFloor,
AllTurret,
AllCase,
White,
Black
}
public enum WallType
{
NULL,
Normal,
Mirror
}
public enum ObjType
{
NULL,
Briefcase,
Camera,
Mannequin
}
\ No newline at end of file
fileFormatVersion: 2
guid: e65075a85c136f94082fa7468adae02f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
...@@ -2,14 +2,6 @@ ...@@ -2,14 +2,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public enum ObjType
{
NULL,
Briefcase,
Camera,
Mannequin
}
public interface IObject public interface IObject
{ {
void Init(Floor floor); void Init(Floor floor);
......
...@@ -12,9 +12,9 @@ public class GameManager : SingletonBehaviour<GameManager> ...@@ -12,9 +12,9 @@ public class GameManager : SingletonBehaviour<GameManager>
public int clearCounter = 0; public int clearCounter = 0;
public static int nFloor, nTurret, nCase, nPlayer, aFloor, aTurret, aCase, white, black; public static int nFloor, nTurret, nCase, nPlayer, aFloor, aTurret, aCase, white, black;
//Find and set the index of clear conditions of the map to clear type.
public void SetClearIndex(Map map) public void SetClearIndex(Map map)
{ {
for (int i = 0; i < 9; i++) clearIndex[i] = -1;
foreach (var child in map.clearConditions) foreach (var child in map.clearConditions)
{ {
clearIndex[(int)child.type] = map.clearConditions.IndexOf(child); clearIndex[(int)child.type] = map.clearConditions.IndexOf(child);
...@@ -36,23 +36,17 @@ public class GameManager : SingletonBehaviour<GameManager> ...@@ -36,23 +36,17 @@ public class GameManager : SingletonBehaviour<GameManager>
Debug.Log("Stage Clear!"); Debug.Log("Stage Clear!");
} }
void Awake()
{
//Reset clear index to -1.
for (int i = 0; i < clearIndex.Length; i++) clearIndex[i] = -1;
nFloor = nTurret = nCase = nPlayer = aFloor = aTurret = aCase = white = black = -1;
}
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
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];
}
} }
} }
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEditor;
using UnityEngine.AI; using UnityEngine.AI;
using Newtonsoft.Json;
public class MapManager : SingletonBehaviour<MapManager> public class MapManager : SingletonBehaviour<MapManager>
{ {
...@@ -14,28 +14,74 @@ public class MapManager : SingletonBehaviour<MapManager> ...@@ -14,28 +14,74 @@ public class MapManager : SingletonBehaviour<MapManager>
public NormalWall normalWall; public NormalWall normalWall;
public Mirror mirror; public Mirror mirror;
public GameObject truthBullet, fakeBullet, mirrorBullet; public GameObject truthBullet, fakeBullet, mirrorBullet;
[Tooltip("Objects without mannequin.")]
public GameObject briefCase; public GameObject briefCase;
public GameObject cameraTurret; public GameObject cameraTurret;
public GameObject[] mannequins; public GameObject[] mannequins;
public List<GameObject> players;
public GameObject player; public GameObject player;
public Map[] stage; [Header("All players")]
public List<GameObject> players;
[Header("All stages")]
public TextAsset[] stage;
public BulletFactory bulletFactory; public BulletFactory bulletFactory;
public void LoadMap(Map _newMap) /// <summary>
/// Load and make a map by map data json file.
/// </summary>
/// <param name="_newMap">The json file of the map data to be created.</param>
public void LoadMap(TextAsset _newMap)
{ {
if (currentMap != null) var loadedMapData = JsonConvert.DeserializeObject<MapEditor.MapSaveData>(_newMap.ToString());
Destroy(currentMap.gameObject); currentMap = Instantiate(currentMap, new Vector3(0, 0, 0), Quaternion.identity);
currentMap = Instantiate(_newMap); currentMap.InitiateMap();
currentMap.transform.position = new Vector3(0, 0, 0); currentMap.maxMapSize = (int)loadedMapData.objects[0].xPos;
surface.BuildNavMesh(); for(int i = 1; i < loadedMapData.objects.Count; i++)
{
var temp = loadedMapData.objects[i];
switch (temp.tag)
{
case TileMode.Floor:
currentMap.CreateFloor(new Vector2Int((int)temp.xPos, (int)temp.yPos));
break;
case TileMode.Normal:
currentMap.CreateWall(new Vector2(temp.xPos, temp.yPos), WallType.Normal);
break;
case TileMode.Mirror:
currentMap.CreateWall(new Vector2(temp.xPos, temp.yPos), WallType.Mirror);
break;
case TileMode.StartFloor:
currentMap.startFloors.Add(currentMap.GetFloorAtPos(new Vector2Int((int)temp.xPos, (int)temp.yPos)));
break;
case TileMode.Briefcase:
currentMap.CreateObject(new Vector2Int((int)temp.xPos, (int)temp.yPos), ObjType.Briefcase);
break;
case TileMode.Camera:
currentMap.CreateObject(new Vector2Int((int)temp.xPos, (int)temp.yPos), ObjType.Camera);
break;
case TileMode.WMannequin:
currentMap.CreateObject(new Vector2Int((int)temp.xPos, (int)temp.yPos), ObjType.Mannequin, true);
break;
case TileMode.BMannequin:
currentMap.CreateObject(new Vector2Int((int)temp.xPos, (int)temp.yPos), ObjType.Mannequin, false);
break;
case TileMode.goalFloor:
currentMap.GetFloorAtPos(new Vector2Int((int)temp.xPos, (int)temp.yPos)).isGoalFloor = true;
break;
default:
break;
}
}
for (int i = 0; i < loadedMapData.clears.Count; i++)
{
var temp = loadedMapData.clears[i];
currentMap.clearConditions.Add(new ClearCondition(temp.type, temp.goal));
}
GameManager.inst.SetClearIndex(currentMap); GameManager.inst.SetClearIndex(currentMap);
surface.BuildNavMesh();
GameManager.inst.uiGenerator.GenerateAllClearUI(); GameManager.inst.uiGenerator.GenerateAllClearUI();
for (int i = 0; i < currentMap.startFloors.Count; i++) for (int i = 0; i < currentMap.startFloors.Count; i++)
PlayerController.inst.CreatePlayer(currentMap.startFloors[i]); PlayerController.inst.CreatePlayer(currentMap.startFloors[i]);
for (int i = 0; i < currentMap.initialBullets.Count; i++) for (int i = 0; i < loadedMapData.bullets.Count; i++)
PlayerController.inst.bulletList.Add(currentMap.initialBullets[i]); PlayerController.inst.bulletList.Add(loadedMapData.bullets[i]);
} }
public IEnumerator Rebaker() public IEnumerator Rebaker()
{ {
......
...@@ -2,18 +2,6 @@ ...@@ -2,18 +2,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public enum ClearType
{
NFloor,
NTurret,
NCase,
NPlayer,
AllFloor,
AllTurret,
AllCase,
White,
Black
}
[System.Serializable] [System.Serializable]
public class ClearCondition public class ClearCondition
...@@ -24,12 +12,12 @@ public class ClearCondition ...@@ -24,12 +12,12 @@ public class ClearCondition
public bool isDone = false; public bool isDone = false;
public ClearStatusUI assignedClearUI; public ClearStatusUI assignedClearUI;
/*public ClearCondition(ClearType _type, int _goal) public ClearCondition(ClearType _type, int _goal)
{ {
type = _type; type = _type;
goal = _goal; goal = _goal;
count = 0; count = 0;
}*/ }
public void IsDone(int _count = 0, int _goal = 0) public void IsDone(int _count = 0, int _goal = 0)
{ {
......
...@@ -269,28 +269,6 @@ public class Map : MonoBehaviour ...@@ -269,28 +269,6 @@ public class Map : MonoBehaviour
Debug.Log("Object doesn't exists between : " + pos); Debug.Log("Object doesn't exists between : " + pos);
} }
private void LoadObjects()
{
floorGrid = new Dictionary<Vector2Int, Floor>();
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 < walls.transform.childCount; i++)
{
Wall wall = walls.transform.GetChild(i).GetComponent<Wall>();
wallGrid.Add(wall.mapPos, wall);
}
for (int i = 0; i < objects.transform.childCount; i++)
{
IObject iObject = objects.transform.GetChild(i).GetComponent<IObject>();
objectGrid.Add(iObject.GetPos(), iObject);
}
}
public void InitiateMap() public void InitiateMap()
{ {
floorGrid = new Dictionary<Vector2Int, Floor>(); floorGrid = new Dictionary<Vector2Int, Floor>();
...@@ -299,11 +277,6 @@ public class Map : MonoBehaviour ...@@ -299,11 +277,6 @@ public class Map : MonoBehaviour
startFloors = new List<Floor>(); startFloors = new List<Floor>();
} }
private void Awake()
{
LoadObjects();
}
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
......
...@@ -2,13 +2,6 @@ ...@@ -2,13 +2,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public enum WallType
{
NULL,
Normal,
Mirror
}
public class Wall : MonoBehaviour public class Wall : MonoBehaviour
{ {
/// <summary> /// <summary>
......
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEditor;
using UnityEngine.UI; using UnityEngine.UI;
using Newtonsoft.Json;
using System.IO;
public class MapEditor : SingletonBehaviour<MapEditor> public class MapEditor : SingletonBehaviour<MapEditor>
{ {
public class objectData
{
public TileMode tag;
public float xPos, yPos;
public objectData(TileMode _tag, Vector2 _pos)
{
tag = _tag; xPos = _pos.x; yPos = _pos.y;
}
}
public class clearData
{
public ClearType type;
public int goal;
public clearData(ClearType _type, int _goal)
{
type = _type; goal = _goal;
}
}
public class MapSaveData
{
public List<objectData> objects;
public List<clearData> clears;
public List<BulletCode> bullets;
public MapSaveData()
{
objects = new List<objectData>();
clears = new List<clearData>();
bullets = new List<BulletCode>();
}
public void AddObject(TileMode _tag, Vector2 _pos)
{
objects.Add(new objectData(_tag, _pos));
}
public void AddClears(ClearType _type, int _goal)
{
clears.Add(new clearData(_type, _goal));
}
}
public Map currentMap; public Map currentMap;
public Map[] stage;
public MapEditorTile tile; public MapEditorTile tile;
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, goalSign, mapSizeSetter, mapEditorTiles; public GameObject startSign, goalSign, mapSizeSetter, mapEditorTiles;
public Dictionary<Floor, GameObject> startSigns, goalSigns; public Dictionary<Floor, GameObject> startSigns, goalSigns;
public Material editNormalMat, realNormalMat; public Material editNormalMat;
bool isEditorStarted; bool isEditorStarted;
bool isCreateMode; bool isCreateMode;
public void StartMap(Map _newMap) public void StartMap(Map _newMap)
{ {
if (currentMap != null)
Destroy(currentMap.gameObject);
currentMap = Instantiate(_newMap); currentMap = Instantiate(_newMap);
currentMap.transform.position = new Vector3(0, 0, 0); currentMap.transform.position = new Vector3(0, 0, 0);
currentMap.InitiateMap(); currentMap.InitiateMap();
...@@ -35,22 +70,54 @@ public class MapEditor : SingletonBehaviour<MapEditor> ...@@ -35,22 +70,54 @@ public class MapEditor : SingletonBehaviour<MapEditor>
public void SaveMap(Map _newMap) public void SaveMap(Map _newMap)
{ {
System.DateTime time = System.DateTime.Now; System.DateTime time = System.DateTime.Now;
string localPath = "Assets/SavedMap_" + time.ToShortDateString() + "-" + time.Hour + "-" + time.Minute + "-" + time.Second + ".prefab"; string localPath = "Assets/" + time.ToShortDateString() + "-" + time.Hour + "-" + time.Minute + "-" + time.Second + ".json";
if (AssetDatabase.LoadAssetAtPath(localPath, typeof(GameObject))) if(currentMap.startFloors.Count == 0)
Debug.Log("Object with same name already exists.");
else if(currentMap.startFloors.Count == 0)
Debug.Log("There is no start floor."); Debug.Log("There is no start floor.");
else else
{ {
foreach (Transform child in currentMap.walls.transform) MapSaveData mapSaveData = new MapSaveData();
if (child.GetComponent<Wall>() is NormalWall) mapSaveData.AddObject(TileMode.None, new Vector2(currentMap.maxMapSize, 0));
child.gameObject.GetComponent<MeshRenderer>().material = realNormalMat; foreach(Transform child in currentMap.walls.transform)
PrefabUtility.SaveAsPrefabAsset(_newMap.gameObject, localPath); {
Debug.Log("Map saved at " + localPath); Wall temp = child.GetComponent<Wall>();
foreach (Transform child in currentMap.walls.transform) if (temp is NormalWall)
if (child.GetComponent<Wall>() is NormalWall) mapSaveData.AddObject(TileMode.Normal, temp.mapPos);
child.gameObject.GetComponent<MeshRenderer>().material = editNormalMat; else
mapSaveData.AddObject(TileMode.Mirror, temp.mapPos);
}
foreach(Transform child in currentMap.floors.transform)
{
Floor temp = child.GetComponent<Floor>();
mapSaveData.AddObject(TileMode.Floor, temp.mapPos);
if (child.GetComponent<Floor>().isGoalFloor)
mapSaveData.AddObject(TileMode.goalFloor, temp.mapPos);
}
foreach(Floor child in currentMap.startFloors)
{
Floor temp = child.GetComponent<Floor>();
mapSaveData.AddObject(TileMode.StartFloor, temp.mapPos);
}
foreach (Transform child in currentMap.objects.transform)
{
IObject temp = child.GetComponent<IObject>();
if (temp.GetType() == ObjType.Briefcase)
mapSaveData.AddObject(TileMode.Briefcase, temp.GetPos());
else if(temp.GetType() == ObjType.Camera)
mapSaveData.AddObject(TileMode.Camera, temp.GetPos());
else if (temp.GetType() == ObjType.Mannequin)
{
if (temp.GetObject().GetComponent<Mannequin>().isWhite)
mapSaveData.AddObject(TileMode.WMannequin, temp.GetPos());
else
mapSaveData.AddObject(TileMode.BMannequin, temp.GetPos());
}
} }
for(int i = 0; i < currentMap.clearConditions.Count; i++)
mapSaveData.AddClears(currentMap.clearConditions[i].type, currentMap.clearConditions[i].goal);
for (int i = 0; i < currentMap.initialBullets.Count; i++)
mapSaveData.bullets.Add(currentMap.initialBullets[i]);
File.WriteAllText(localPath, JsonConvert.SerializeObject(mapSaveData));
Debug.Log("Map saved at " + localPath);}
} }
public void SaveCurrentMap() public void SaveCurrentMap()
{ {
...@@ -114,7 +181,7 @@ public class MapEditor : SingletonBehaviour<MapEditor> ...@@ -114,7 +181,7 @@ public class MapEditor : SingletonBehaviour<MapEditor>
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
StartMap(stage[0]); StartMap(currentMap);
SwitchMode(0); SwitchMode(0);
} }
......
...@@ -108,6 +108,14 @@ public class Player : MonoBehaviour ...@@ -108,6 +108,14 @@ public class Player : MonoBehaviour
newBullet.Init(shootingArm.transform.forward); newBullet.Init(shootingArm.transform.forward);
} }
private void OnTriggerEnter(Collider other)
{
if (other.GetComponent<IPlayerInteractor>() != null)
{
other.GetComponent<IPlayerInteractor>().Interact(currentFloor.mapPos);
}
}
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
......
...@@ -33,7 +33,7 @@ public class PlayerController : SingletonBehaviour<PlayerController> ...@@ -33,7 +33,7 @@ public class PlayerController : SingletonBehaviour<PlayerController>
{ {
if (obj.GetComponent<Player>().currentFloor == floor) if (obj.GetComponent<Player>().currentFloor == floor)
{ {
Debug.Log("there are player on that floor."); Debug.Log("Player already exists on that floor.");
return; return;
} }
} }
...@@ -50,14 +50,10 @@ public class PlayerController : SingletonBehaviour<PlayerController> ...@@ -50,14 +50,10 @@ public class PlayerController : SingletonBehaviour<PlayerController>
public void CreatePlayer(Vector2Int floorPos) public void CreatePlayer(Vector2Int floorPos)
{ {
if (MapManager.inst.currentMap.floorGrid.TryGetValue(floorPos, out Floor floor)) if (MapManager.inst.currentMap.floorGrid.TryGetValue(floorPos, out Floor floor))
{
CreatePlayer(floor); CreatePlayer(floor);
}
else else
{
Debug.Log("there are no floor"); Debug.Log("there are no floor");
} }
}
public void RemovePlayer(Floor floor) public void RemovePlayer(Floor floor)
{ {
......
...@@ -44,10 +44,6 @@ public class TestTools : MonoBehaviour ...@@ -44,10 +44,6 @@ public class TestTools : MonoBehaviour
{ {
MapManager.inst.currentMap.RemoveObject(new Vector2Int(int.Parse(xInput.text), int.Parse(yInput.text))); MapManager.inst.currentMap.RemoveObject(new Vector2Int(int.Parse(xInput.text), int.Parse(yInput.text)));
} }
public void LoadMap()
{
MapManager.inst.LoadMap(MapManager.inst.stage[1]);
}
// Start is called before the first frame update // Start is called before the first frame update
void Start() 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