Commit bf23684a authored by 18손재민's avatar 18손재민

이제 스테이지는 Resources에서 로드함. 스테이지 선택 씬 별도로 만들었고 이에 따라 MapManager는 더 이상 stage들을 로드하지 않음

parent 5414358c
fileFormatVersion: 2
guid: 47baf9abe59c90a4d914127b0527c24f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
...@@ -46,5 +46,4 @@ MonoBehaviour: ...@@ -46,5 +46,4 @@ MonoBehaviour:
uiGenerator: {fileID: 0} uiGenerator: {fileID: 0}
clearIndex: 000000000000000000000000000000000000000000000000000000000000000000000000 clearIndex: 000000000000000000000000000000000000000000000000000000000000000000000000
clearCounter: 0 clearCounter: 0
currentStage: 0 currentStage: {fileID: 0}
totalStageCount: 3
...@@ -69,7 +69,3 @@ MonoBehaviour: ...@@ -69,7 +69,3 @@ MonoBehaviour:
- {fileID: 87051754405567689, guid: 2a2831d520acdd3408d8a04673423e2a, type: 3} - {fileID: 87051754405567689, guid: 2a2831d520acdd3408d8a04673423e2a, type: 3}
player: {fileID: 494213313239918027, guid: 449b2ca4d925da541bb45c84b63aab98, type: 3} player: {fileID: 494213313239918027, guid: 449b2ca4d925da541bb45c84b63aab98, type: 3}
players: [] players: []
stage:
- {fileID: 4900000, guid: e4921fa87e2b8fe44b2246f2b275c88a, type: 3}
- {fileID: 4900000, guid: e4921fa87e2b8fe44b2246f2b275c88a, type: 3}
- {fileID: 4900000, guid: e4921fa87e2b8fe44b2246f2b275c88a, type: 3}
...@@ -538,6 +538,7 @@ MonoBehaviour: ...@@ -538,6 +538,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
stageIndex: {fileID: 6319119020849879011} stageIndex: {fileID: 6319119020849879011}
stage: []
--- !u!1 &6319119020285146382 --- !u!1 &6319119020285146382
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
...@@ -827,4 +828,4 @@ MonoBehaviour: ...@@ -827,4 +828,4 @@ MonoBehaviour:
m_HorizontalOverflow: 0 m_HorizontalOverflow: 0
m_VerticalOverflow: 0 m_VerticalOverflow: 0
m_LineSpacing: 1 m_LineSpacing: 1
m_Text: 'Stage : ' m_Text: 'Stage : 0'
fileFormatVersion: 2
guid: 9c461e467311d5b44adb80593e57c448
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2 fileFormatVersion: 2
guid: e4921fa87e2b8fe44b2246f2b275c88a guid: 882d04a3f25e01644b2a1385ad0b2a9b
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:
......
{"objects":[{"tag":0,"xPos":25.0,"yPos":0.0},{"tag":2,"xPos":-2.0,"yPos":1.5},{"tag":2,"xPos":-1.0,"yPos":1.5},{"tag":3,"xPos":0.0,"yPos":1.5},{"tag":3,"xPos":1.0,"yPos":1.5},{"tag":1,"xPos":0.0,"yPos":0.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":-2.0,"yPos":2.0},{"tag":1,"xPos":-2.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":0.0,"yPos":1.0},{"tag":1,"xPos":1.0,"yPos":1.0},{"tag":1,"xPos":1.0,"yPos":2.0},{"tag":1,"xPos":2.0,"yPos":2.0},{"tag":1,"xPos":2.0,"yPos":1.0},{"tag":1,"xPos":2.0,"yPos":0.0},{"tag":1,"xPos":2.0,"yPos":-1.0},{"tag":1,"xPos":2.0,"yPos":-2.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":-1.0,"yPos":-1.0},{"tag":1,"xPos":-2.0,"yPos":-1.0},{"tag":9,"xPos":-2.0,"yPos":-1.0},{"tag":1,"xPos":-2.0,"yPos":-2.0},{"tag":1,"xPos":-2.0,"yPos":0.0},{"tag":9,"xPos":-2.0,"yPos":0.0},{"tag":1,"xPos":-1.0,"yPos":0.0},{"tag":4,"xPos":-2.0,"yPos":-2.0},{"tag":4,"xPos":-1.0,"yPos":-2.0},{"tag":6,"xPos":2.0,"yPos":2.0},{"tag":7,"xPos":2.0,"yPos":1.0},{"tag":8,"xPos":2.0,"yPos":0.0},{"tag":5,"xPos":1.0,"yPos":1.0},{"tag":5,"xPos":1.0,"yPos":0.0},{"tag":5,"xPos":1.0,"yPos":-1.0},{"tag":5,"xPos":1.0,"yPos":-2.0}],"clears":[],"cases":[3,0,1,2],"bullets":[0,1,2]}
\ No newline at end of file
fileFormatVersion: 2
guid: b65159d8e62109d4990676399736ddbf
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
{"objects":[{"tag":0,"xPos":25.0,"yPos":0.0},{"tag":2,"xPos":-2.0,"yPos":1.5},{"tag":2,"xPos":-1.0,"yPos":1.5},{"tag":3,"xPos":0.0,"yPos":1.5},{"tag":3,"xPos":1.0,"yPos":1.5},{"tag":1,"xPos":0.0,"yPos":0.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":-2.0,"yPos":2.0},{"tag":1,"xPos":-2.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":0.0,"yPos":1.0},{"tag":1,"xPos":1.0,"yPos":1.0},{"tag":1,"xPos":1.0,"yPos":2.0},{"tag":1,"xPos":2.0,"yPos":2.0},{"tag":1,"xPos":2.0,"yPos":1.0},{"tag":1,"xPos":2.0,"yPos":0.0},{"tag":1,"xPos":2.0,"yPos":-1.0},{"tag":1,"xPos":2.0,"yPos":-2.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":-1.0,"yPos":-1.0},{"tag":1,"xPos":-2.0,"yPos":-1.0},{"tag":9,"xPos":-2.0,"yPos":-1.0},{"tag":1,"xPos":-2.0,"yPos":-2.0},{"tag":1,"xPos":-2.0,"yPos":0.0},{"tag":9,"xPos":-2.0,"yPos":0.0},{"tag":1,"xPos":-1.0,"yPos":0.0},{"tag":4,"xPos":-2.0,"yPos":-2.0},{"tag":4,"xPos":-1.0,"yPos":-2.0},{"tag":6,"xPos":2.0,"yPos":2.0},{"tag":7,"xPos":2.0,"yPos":1.0},{"tag":8,"xPos":2.0,"yPos":0.0},{"tag":5,"xPos":1.0,"yPos":1.0},{"tag":5,"xPos":1.0,"yPos":0.0},{"tag":5,"xPos":1.0,"yPos":-1.0},{"tag":5,"xPos":1.0,"yPos":-2.0}],"clears":[],"cases":[3,0,1,2],"bullets":[0,1,2]}
\ No newline at end of file
fileFormatVersion: 2
guid: a0bbdbca5d3d3904b8af6f4f7266190d
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
...@@ -622,7 +622,7 @@ PrefabInstance: ...@@ -622,7 +622,7 @@ PrefabInstance:
- target: {fileID: 52444459818764334, guid: 42247a938bb6e554eb00dc08303a72d6, - target: {fileID: 52444459818764334, guid: 42247a938bb6e554eb00dc08303a72d6,
type: 3} type: 3}
propertyPath: m_IsActive propertyPath: m_IsActive
value: 0 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 52444459818764335, guid: 42247a938bb6e554eb00dc08303a72d6, - target: {fileID: 52444459818764335, guid: 42247a938bb6e554eb00dc08303a72d6,
type: 3} type: 3}
......
...@@ -211,75 +211,6 @@ Transform: ...@@ -211,75 +211,6 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1001 &704223974
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: 4
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 &1484773285 --- !u!1 &1484773285
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
...@@ -69,4 +69,9 @@ public class Briefcase : MonoBehaviour, IObject, IPlayerInteractor ...@@ -69,4 +69,9 @@ public class Briefcase : MonoBehaviour, IObject, IPlayerInteractor
{ {
return ObjType.Briefcase; return ObjType.Briefcase;
} }
private void OnDestroy()
{
if (PlayerController.inst != null) PlayerController.inst.OnPlayerMove -= Interact;
}
} }
...@@ -48,4 +48,9 @@ public class CameraTurret : MonoBehaviour, IObject, IBreakable, IPlayerInteracto ...@@ -48,4 +48,9 @@ public class CameraTurret : MonoBehaviour, IObject, IBreakable, IPlayerInteracto
{ {
return ObjType.Camera; return ObjType.Camera;
} }
private void OnDestroy()
{
if(PlayerController.inst != null) PlayerController.inst.OnPlayerMove -= Interact;
}
} }
...@@ -14,11 +14,7 @@ public class GameManager : SingletonBehaviour<GameManager> ...@@ -14,11 +14,7 @@ public class GameManager : SingletonBehaviour<GameManager>
/// <summary> /// <summary>
/// The index of the current stage. /// The index of the current stage.
/// </summary> /// </summary>
public int currentStage; public TextAsset currentStage;
/// <summary>
/// Max number of stages.
/// </summary>
public int totalStageCount;
public void ResetClearIndex() public void ResetClearIndex()
{ {
...@@ -46,11 +42,9 @@ public class GameManager : SingletonBehaviour<GameManager> ...@@ -46,11 +42,9 @@ public class GameManager : SingletonBehaviour<GameManager>
black = clearIndex[(int)ClearType.Black]; black = clearIndex[(int)ClearType.Black];
} }
public void StartStage(int _stageIndex) public void StartStage()
{ {
currentStage = _stageIndex; MapManager.inst.LoadMap(currentStage);
SceneManager.LoadScene("PlayStage");
MapManager.inst.LoadMap(MapManager.inst.stage[currentStage]);
} }
public void ClearStage() public void ClearStage()
...@@ -72,22 +66,14 @@ public class GameManager : SingletonBehaviour<GameManager> ...@@ -72,22 +66,14 @@ public class GameManager : SingletonBehaviour<GameManager>
Debug.Log("Game Restart!"); Debug.Log("Game Restart!");
yield return new WaitForSeconds(0.5f); yield return new WaitForSeconds(0.5f);
GameOver(); GameOver();
MapManager.inst.LoadMap(MapManager.inst.stage[currentStage]); StartStage();
}
void Awake()
{
} }
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
SetStatic(); currentStage = Resources.Load<TextAsset>("Stages/" + "stage" + (StageSelector.selectedStage + 1));
/*if (MapManager.inst.isMapEditingOn) StartStage();
{ Destroy(FindObjectOfType<StageSelector>().gameObject);
//Reset clear index to -1.
ResetClearIndex();
}*/
} }
} }
...@@ -21,8 +21,6 @@ public class MapManager : SingletonBehaviour<MapManager> ...@@ -21,8 +21,6 @@ public class MapManager : SingletonBehaviour<MapManager>
public GameObject player; public GameObject player;
[Header("All players")] [Header("All players")]
public List<GameObject> players; public List<GameObject> players;
[Header("All stages")]
public TextAsset[] stage;
public BulletFactory bulletFactory; public BulletFactory bulletFactory;
/// <summary> /// <summary>
......
...@@ -192,6 +192,7 @@ public class MapEditor : SingletonBehaviour<MapEditor> ...@@ -192,6 +192,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()
{ {
GameManager.inst.ResetClearIndex();
StartMap(currentMap); StartMap(currentMap);
SwitchMode(0); SwitchMode(0);
SwitchBulletMode((int)BulletCode.None); SwitchBulletMode((int)BulletCode.None);
......
...@@ -2,27 +2,38 @@ ...@@ -2,27 +2,38 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class StageSelector : MonoBehaviour public class StageSelector : MonoBehaviour
{ {
public Text stageIndex; public Text stageIndex;
public static int selectedStage;
public TextAsset[] stage;
int totalStageCount;
public void ChangeStage(int i) public void ChangeStage(int i)
{ {
if(i < 0 && GameManager.inst.currentStage == 0) GameManager.inst.currentStage = GameManager.inst.totalStageCount - 1; if(i < 0 && selectedStage == 0) selectedStage = totalStageCount - 1;
else GameManager.inst.currentStage = (GameManager.inst.currentStage + i) % GameManager.inst.totalStageCount; else selectedStage = (selectedStage + i) % totalStageCount;
stageIndex.text = "Stage : " + GameManager.inst.currentStage; stageIndex.text = "Stage : " + selectedStage;
} }
public void StartSelectedStage() public void StartSelectedStage()
{ {
GameManager.inst.StartStage(GameManager.inst.currentStage); SceneManager.LoadScene("PlayStage");
}
void Awake()
{
DontDestroyOnLoad(this);
stage = Resources.LoadAll<TextAsset>("Stages");
} }
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
selectedStage = 0;
totalStageCount = stage.Length;
} }
// Update is called once per frame // Update is called once per frame
......
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