Commit 839efcac authored by 18김민수's avatar 18김민수

Ending game bug fix

parent e98949e1
......@@ -54,6 +54,8 @@ public class EndingGameManager : MonoBehaviour
public Image[] productionQueueImage;
public Button nextWave;
public Text currentProductionText;
public int riflemanCount = 3;
public int currentWaveNumber = 0;
......@@ -381,15 +383,17 @@ public class EndingGameManager : MonoBehaviour
string unitName = productionQueue.Dequeue();
_UpdateProductionQueue();
float productionTime = _GetProductionTime(unitName);
yield return (_bar = StartCoroutine(_ProgressBarHandler(productionTime)));
yield return (_bar = StartCoroutine(_ProgressBarHandler(unitName)));
MakeAllyUnit(unitName);
}
}
}
private IEnumerator _ProgressBarHandler(float unitTime)
private IEnumerator _ProgressBarHandler(string unitName)
{
currentProductionText.text = unitName + " 생산중";
float unitTime = _GetProductionTime(unitName);
float progress = 0;
while(progressBar.maxValue > progress)
{
......@@ -398,6 +402,7 @@ public class EndingGameManager : MonoBehaviour
yield return null;
}
progressBar.value = progressBar.minValue;
currentProductionText.text = "";
}
public void TurnOnAndOffNextWaveButton()
......@@ -417,6 +422,7 @@ public class EndingGameManager : MonoBehaviour
StopCoroutine(_production);
StopCoroutine(_bar);
progressBar.value = progressBar.minValue;
currentProductionText.text = "";
_UpdateProductionQueue();
UpdateWaveNumber();
}
......
......@@ -61,12 +61,31 @@ public abstract class EndingGameUnit : MonoBehaviour
int moveSpeed;
if (isAllyUnit)
{
moveSpeed = speed;
if (endingGame.deployedEnemyUnits.FirstOrDefault() != null)
{
if (endingGame.deployedEnemyUnits.First().transform.position.x - transform.position.x
>= (unitSize + endingGame.deployedEnemyUnits.First().GetComponent<EndingGameUnit>().unitSize) / 2)
transform.Translate(moveSpeed * Time.deltaTime, 0, 0);
}
else
transform.Translate(moveSpeed * Time.deltaTime, 0, 0);
}
else
{
moveSpeed = -speed;
if (!isInBattleState && !isTooCloseFrontUnit)
transform.Translate(moveSpeed * Time.deltaTime, 0, 0);
if (endingGame.deployedAllyUnits.FirstOrDefault() != null)
{
if (-endingGame.deployedAllyUnits.First().transform.position.x + transform.position.x
>= unitSize + endingGame.deployedAllyUnits.First().GetComponent<EndingGameUnit>().unitSize)
transform.Translate(moveSpeed * Time.deltaTime, 0, 0);
}
else
transform.Translate(moveSpeed * Time.deltaTime, 0, 0);
}
}
public void Attack()
......
......@@ -26,15 +26,17 @@ public class NKSoldier : EndingGameUnit
int moveSpeed;
if (isAllyUnit)
moveSpeed = speed;
moveSpeed = -speed;
if (endingGame.deployedAllyUnits.FirstOrDefault() != null)
{
if (-endingGame.deployedAllyUnits.First().transform.position.x + transform.position.x
>= unitSize + endingGame.deployedAllyUnits.First().GetComponent<EndingGameUnit>().unitSize)
transform.Translate(moveSpeed * Time.deltaTime, 0, 0);
}
else
moveSpeed = -speed;
if (!isInBattleState && !isTooCloseFrontUnit)
transform.Translate(moveSpeed * Time.deltaTime, 0, 0);
if (endingGame.deployedAllyUnits.Count > 0)
if (endingGame.deployedAllyUnits.Peek()?.GetComponent<EndingGameUnit>().unitNumber == 8
&& !endingGame.deployedEnemyUnits.Any(u => u.GetComponent<EndingGameUnit>().unitNumber == 10))
......
......@@ -1366,8 +1366,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 17.15, y: 272}
m_SizeDelta: {x: -34.3, y: -34.3}
m_AnchoredPosition: {x: 175.3, y: 313.4}
m_SizeDelta: {x: 201.22, y: -76.61}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &895975665
MonoBehaviour:
......@@ -1378,7 +1378,7 @@ MonoBehaviour:
m_GameObject: {fileID: 895975663}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
......@@ -1389,15 +1389,20 @@ MonoBehaviour:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10907, 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
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 21
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text:
--- !u!222 &895975666
CanvasRenderer:
m_ObjectHideFlags: 0
......@@ -2758,6 +2763,7 @@ MonoBehaviour:
- {fileID: 1383618688}
- {fileID: 217557721}
nextWave: {fileID: 247065147}
currentProductionText: {fileID: 895975665}
riflemanCount: 3
currentWaveNumber: 0
food: {fileID: 1686207435}
......
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