Commit 5796d2ec authored by 18손재민's avatar 18손재민

이제 체력이 0이 되면 게임 오버, 클리어하지 않은 방 들어갈 때 몹 스폰함

parent 958700b5
...@@ -1323,7 +1323,7 @@ RectTransform: ...@@ -1323,7 +1323,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5} m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5} m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 190, y: 140} m_AnchoredPosition: {x: -300, y: 140}
m_SizeDelta: {x: 200, y: 50} m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224363839195006936 --- !u!224 &224363839195006936
...@@ -1387,7 +1387,7 @@ RectTransform: ...@@ -1387,7 +1387,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5} m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5} m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 190, y: 0} m_AnchoredPosition: {x: -300, y: 0}
m_SizeDelta: {x: 200, y: 50} m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224527953610948652 --- !u!224 &224527953610948652
...@@ -1460,7 +1460,7 @@ RectTransform: ...@@ -1460,7 +1460,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5} m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5} m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 190, y: -70} m_AnchoredPosition: {x: -300, y: -70}
m_SizeDelta: {x: 200, y: 50} m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224658872540831358 --- !u!224 &224658872540831358
...@@ -1497,7 +1497,7 @@ RectTransform: ...@@ -1497,7 +1497,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5} m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5} m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 190, y: 280} m_AnchoredPosition: {x: -300, y: 280}
m_SizeDelta: {x: 200, y: 50} m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224718253185442684 --- !u!224 &224718253185442684
...@@ -1552,7 +1552,7 @@ RectTransform: ...@@ -1552,7 +1552,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5} m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5} m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 190, y: 210} m_AnchoredPosition: {x: -300, y: 210}
m_SizeDelta: {x: 200, y: 50} m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224851610276147026 --- !u!224 &224851610276147026
...@@ -1571,6 +1571,6 @@ RectTransform: ...@@ -1571,6 +1571,6 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5} m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5} m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 190, y: 70} m_AnchoredPosition: {x: -300, y: 70}
m_SizeDelta: {x: 200, y: 50} m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
...@@ -3,7 +3,7 @@ using System.Collections.Generic; ...@@ -3,7 +3,7 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public class Player : MonoBehaviour { public class Player : MonoBehaviour {
public LifeStoneManager LCUI; LifeStoneManager lifeStoneManager;
public static int tx, ty; public static int tx, ty;
public static float X=0.7f, Y=1.6f; public static float X=0.7f, Y=1.6f;
public int ttx; public int ttx;
...@@ -13,6 +13,7 @@ public class Player : MonoBehaviour { ...@@ -13,6 +13,7 @@ public class Player : MonoBehaviour {
void Start () { void Start () {
ttx = (int)(transform.position.x / 24f); ttx = (int)(transform.position.x / 24f);
tty = (int)(transform.position.y-0.9f / 24f); tty = (int)(transform.position.y-0.9f / 24f);
lifeStoneManager = GameObject.Find("LifeStoneUI").GetComponent<LifeStoneManager>();
} }
// Update is called once per frame // Update is called once per frame
...@@ -41,5 +42,7 @@ public class Player : MonoBehaviour { ...@@ -41,5 +42,7 @@ public class Player : MonoBehaviour {
} }
ttx = tx; ttx = tx;
tty = ty; tty = ty;
if (lifeStoneManager.CountType(LifeStoneType.Normal) == 0)
GameManager.gameState = GameState.GameOver;
} }
} }
...@@ -876,6 +876,10 @@ public class MapManager : MonoBehaviour { ...@@ -876,6 +876,10 @@ public class MapManager : MonoBehaviour {
room.leftTetrisDoor.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 0); room.leftTetrisDoor.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 0);
room.rightTetrisDoor.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 0); room.rightTetrisDoor.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 0);
room.fog.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 0); room.fog.GetComponent<SpriteRenderer>().color = new Color(1, 1, 1, 0);
if(!room.isRoomCleared)
{
GameObject.Find("EnemyManager").GetComponent<EnemyManager>().SpawnEnemy();
}
} }
/// <summary> /// <summary>
/// Make room fade out. /// Make room fade out.
......
...@@ -56,59 +56,6 @@ public class Test : MonoBehaviour { ...@@ -56,59 +56,6 @@ public class Test : MonoBehaviour {
enemyManager.SpawnEnemy(); enemyManager.SpawnEnemy();
} }
public GameObject upDoor;
public GameObject downDoor;
public GameObject leftDoor;
public GameObject rightDoor;
public void UpOpenTest()
{
Animator animator = upDoor.GetComponent<Animator>();
animator.SetBool("doorOpen", true);
animator.SetBool("doorClose", false);
}
public void UpCloseTest()
{
Animator animator = upDoor.GetComponent<Animator>();
animator.SetBool("doorOpen", false);
animator.SetBool("doorClose", true);
}
public void DownOpenTest()
{
Animator animator = downDoor.GetComponent<Animator>();
animator.SetBool("doorOpen", true);
animator.SetBool("doorClose", false);
}
public void DownCloseTest()
{
Animator animator = downDoor.GetComponent<Animator>();
animator.SetBool("doorOpen", false);
animator.SetBool("doorClose", true);
}
public void LeftOpenTest()
{
Animator animator = leftDoor.GetComponent<Animator>();
animator.SetBool("doorOpen", true);
animator.SetBool("doorClose", false);
}
public void LeftCloseTest()
{
Animator animator = leftDoor.GetComponent<Animator>();
animator.SetBool("doorOpen", false);
animator.SetBool("doorClose", true);
}
public void RightOpenTest()
{
Animator animator = rightDoor.GetComponent<Animator>();
animator.SetBool("doorOpen", true);
animator.SetBool("doorClose", false);
}
public void RightCloseTest()
{
Animator animator = rightDoor.GetComponent<Animator>();
animator.SetBool("doorOpen", false);
animator.SetBool("doorClose", true);
}
private void Awake() private void Awake()
{ {
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Tilemaps;
public class TileManager : MonoBehaviour
{
public TileBase[] tileFR;
public TileBase[] tileIT;
public TileBase[] tileWW;
public TileBase[] tileUT;
public Tilemap map;
public RoomInGame roomInGame;
public TileBase[] fillLeftDoor;
public TileBase[] fillRightDoor;
//기본 테마를 숲속 유적으로 하고 if(얼음신전)
public void Init()
{
for (int i = 0; i < tileFR.Length; i++)
map.SwapTile(tileFR[i], tileIT[i]);
}
/*
같은 방식으로
if(수로)
for(int i=0;i<tileFR.Length;i++)
map.SwapTile(tileFR[i], tileWW[i]);
if(나무아래)
for(int i=0;i<tileFR.Length;i++)
map.SwapTile(tileFR[i], tileUT[i]);
*/
public void FillEmptyDoor(int leftDoorLocation, int rightDoorLocation)
{
Tilemap outerWallMap = roomInGame.transform.GetChild(4).GetComponent<Tilemap>();
int[] doorLocations = { 1, 9, 17 };
for (int i = 0; i < 3; i++)
{
//경우를 따지자
/*
* 왼쪽의 경우
* 문 위 타일
* 1. 오른쪽에 타일이 없음 -> [| |] 모양 넣기 0
* 2. 오른쪽에만 타일이 있음 -> [| .] 모양 넣기 2
* 3. 오른쪽이랑 오른쪽 대각선 위에 타일이 있음 -> [| ] 모양 넣기 1
*
* 문 아래 타일
* 1. 오른쪽 타일 없음 -> 문 위랑 동일
* 2. 오른족에만 타일 -> [| '] 모양 넣기 3
* 3. 오른족이랑 오른쪽 대각선 아래에 타일 -> [| ] 모양
*
* 오른쪽의 경우
* 문 위 타일
* 1. 왼쪽에 X -> [| |]
* 2. 왼쪽에만 -> [. |]
* 3. 왼쪽이랑 왼쪽 대각선 아래 -> [ |]
*
* 문 아래
* 1. 왼쪽에 X -> [| |]
* 2. 왼쪽에만 -> [' |]
* 3. 왼쪽이랑 왼쪽 대각선 위 -> [ |]
*/
if (i != leftDoorLocation)
{
outerWallMap.SetTile(new Vector3Int(0, doorLocations[i] + 1, 0), fillLeftDoor[0]);
outerWallMap.SetTile(new Vector3Int(0, doorLocations[i], 0), fillLeftDoor[0]);
if (outerWallMap.HasTile(new Vector3Int(1, doorLocations[i] + 2, 0)) && outerWallMap.HasTile(new Vector3Int(1, doorLocations[i] + 3, 0)))
outerWallMap.SetTile(new Vector3Int(0, doorLocations[i] + 2, 0), fillLeftDoor[1]);
else if (outerWallMap.HasTile(new Vector3Int(1, doorLocations[i] + 2, 0)))
outerWallMap.SetTile(new Vector3Int(0, doorLocations[i] + 2, 0), fillLeftDoor[2]);
else
outerWallMap.SetTile(new Vector3Int(0, doorLocations[i] + 2, 0), fillLeftDoor[0]);
if (outerWallMap.HasTile(new Vector3Int(1, doorLocations[i] - 1, 0)) && outerWallMap.HasTile(new Vector3Int(1, doorLocations[i] - 2, 0)))
outerWallMap.SetTile(new Vector3Int(0, doorLocations[i] - 1, 0), fillLeftDoor[1]);
else if (outerWallMap.HasTile(new Vector3Int(1, doorLocations[i] - 1, 0)))
outerWallMap.SetTile(new Vector3Int(0, doorLocations[i] - 1, 0), fillLeftDoor[3]);
else
outerWallMap.SetTile(new Vector3Int(0, doorLocations[i] - 1, 0), fillLeftDoor[0]);
}
if (i != rightDoorLocation)
{
outerWallMap.SetTile(new Vector3Int(23, doorLocations[i] + 1, 0), fillRightDoor[0]);
outerWallMap.SetTile(new Vector3Int(23, doorLocations[i], 0), fillRightDoor[0]);
if (outerWallMap.HasTile(new Vector3Int(22, doorLocations[i] + 2, 0)) && outerWallMap.HasTile(new Vector3Int(22, doorLocations[i] + 3, 0)))
outerWallMap.SetTile(new Vector3Int(23, doorLocations[i] + 2, 0), fillRightDoor[1]);
else if (outerWallMap.HasTile(new Vector3Int(22, doorLocations[i] + 2, 0)))
outerWallMap.SetTile(new Vector3Int(23, doorLocations[i] + 2, 0), fillRightDoor[2]);
else
outerWallMap.SetTile(new Vector3Int(23, doorLocations[i] + 2, 0), fillRightDoor[0]);
if (outerWallMap.HasTile(new Vector3Int(22, doorLocations[i] - 1, 0)) && outerWallMap.HasTile(new Vector3Int(22, doorLocations[i] - 2, 0)))
outerWallMap.SetTile(new Vector3Int(23, doorLocations[i] - 1, 0), fillRightDoor[1]);
else if (outerWallMap.HasTile(new Vector3Int(22, doorLocations[i] - 1, 0)))
outerWallMap.SetTile(new Vector3Int(23, doorLocations[i] - 1, 0), fillRightDoor[3]);
else
outerWallMap.SetTile(new Vector3Int(23, doorLocations[i] - 1, 0), fillRightDoor[0]);
}
}
}
}
fileFormatVersion: 2
guid: adab373df646d5f4fb794a3b6ffdf2d7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
...@@ -63,8 +63,9 @@ public class LifeStoneManager : MonoBehaviour { ...@@ -63,8 +63,9 @@ public class LifeStoneManager : MonoBehaviour {
lifeStoneArray = new int[50, 3]; lifeStoneArray = new int[50, 3];
lifeStoneUnit = new GameObject[50, 3]; lifeStoneUnit = new GameObject[50, 3];
for (int i = 0; i < 50; i++) for (int j = 0; j < 3; j++) lifeStoneArray[i, j] = 0; for (int i = 0; i < 50; i++) for (int j = 0; j < 3; j++) lifeStoneArray[i, j] = 0;
StartCoroutine("TestEnumerator"); //StartCoroutine("TestEnumerator");
} PushLifeStone(new LifeStoneInfo(new Vector2Int(3, 8), "AAAAAAAAAAAAAAAAAAAAAAAA"));
}
IEnumerator TestEnumerator() IEnumerator TestEnumerator()
{ {
yield return null; yield return null;
......
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