|
|
@ -91,6 +91,7 @@ public class GamePlayManager : MonoBehaviour
|
|
|
|
private Vector3 _levelContainerPosition;
|
|
|
|
private Vector3 _levelContainerPosition;
|
|
|
|
|
|
|
|
|
|
|
|
private bool isRotating;
|
|
|
|
private bool isRotating;
|
|
|
|
|
|
|
|
public static bool isTimerLevel;
|
|
|
|
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
private void Awake()
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -179,7 +180,7 @@ public class GamePlayManager : MonoBehaviour
|
|
|
|
GameScene.instance.UpdateUI();
|
|
|
|
GameScene.instance.UpdateUI();
|
|
|
|
Timer.Schedule(this, 0.5f, ShowMessagePopup);
|
|
|
|
Timer.Schedule(this, 0.5f, ShowMessagePopup);
|
|
|
|
RecursivePipeColors();
|
|
|
|
RecursivePipeColors();
|
|
|
|
visibleCellList.ForEach(delegate(Cell obj)
|
|
|
|
visibleCellList.ForEach(delegate (Cell obj)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
obj.UpdatePipeColor();
|
|
|
|
obj.UpdatePipeColor();
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -217,7 +218,7 @@ public class GamePlayManager : MonoBehaviour
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RecursivePipeColors();
|
|
|
|
RecursivePipeColors();
|
|
|
|
yield return new WaitForSeconds(0.1f);
|
|
|
|
yield return new WaitForSeconds(0.1f);
|
|
|
|
visibleCellList.ForEach(delegate(Cell obj)
|
|
|
|
visibleCellList.ForEach(delegate (Cell obj)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
obj.UpdatePipeColor();
|
|
|
|
obj.UpdatePipeColor();
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -227,11 +228,11 @@ public class GamePlayManager : MonoBehaviour
|
|
|
|
|
|
|
|
|
|
|
|
private void RecursivePipeColors()
|
|
|
|
private void RecursivePipeColors()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
visibleCellList.ForEach(delegate(Cell obj)
|
|
|
|
visibleCellList.ForEach(delegate (Cell obj)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
obj.RemoveAllPipeColor();
|
|
|
|
obj.RemoveAllPipeColor();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
startCellList.ForEach(delegate(Cell cell)
|
|
|
|
startCellList.ForEach(delegate (Cell cell)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (cell.pipeCellType == CellType.Start)
|
|
|
|
if (cell.pipeCellType == CellType.Start)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -454,6 +455,8 @@ public class GamePlayManager : MonoBehaviour
|
|
|
|
gameOverPopup.Open();
|
|
|
|
gameOverPopup.Open();
|
|
|
|
confettiParticle.Play();
|
|
|
|
confettiParticle.Play();
|
|
|
|
yield return new WaitForSeconds(0.5f);
|
|
|
|
yield return new WaitForSeconds(0.5f);
|
|
|
|
|
|
|
|
if (!isTimerLevel)
|
|
|
|
|
|
|
|
{
|
|
|
|
if (GameManager.currentLevelGroup.CompletedLevel < GameManager.CurrentLevelNo)
|
|
|
|
if (GameManager.currentLevelGroup.CompletedLevel < GameManager.CurrentLevelNo)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int sl = GameManager.StarLevel;
|
|
|
|
int sl = GameManager.StarLevel;
|
|
|
@ -486,10 +489,46 @@ public class GamePlayManager : MonoBehaviour
|
|
|
|
GameScene.instance.UpdateUI();
|
|
|
|
GameScene.instance.UpdateUI();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (GameManager.currentLevelGroup.CompletedLevel_Timer < GameManager.CurrentLevelNo)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int sl = GameManager.StarLevel;
|
|
|
|
|
|
|
|
for (int i = 0; i < GameManager.currentLevelGroup.StarXPReward; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
GameManager.AddStar(1);
|
|
|
|
|
|
|
|
starLevel.text = GameManager.StarLevel + string.Empty;
|
|
|
|
|
|
|
|
nextStarLevel.text = (GameManager.StarLevel + 1).ToString();
|
|
|
|
|
|
|
|
if (fillBar.fillAmount > GameManager.StarLevelProgress)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
while (fillBar.fillAmount < 1f)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
fillBar.fillAmount += 0.01f;
|
|
|
|
|
|
|
|
yield return new WaitForSeconds(0.01f);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fillBar.fillAmount = 0f;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
while (fillBar.fillAmount < GameManager.StarLevelProgress)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
fillBar.fillAmount += 0.01f;
|
|
|
|
|
|
|
|
yield return new WaitForSeconds(0.01f);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sl < GameManager.StarLevel)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
RankedUpText.text = GameManager.StarLevel.ToString();
|
|
|
|
|
|
|
|
ShowRankedUpScreen();
|
|
|
|
|
|
|
|
confettiParticle.Play();
|
|
|
|
|
|
|
|
GameManager.Coin += UnityEngine.Random.Range(30, 45);
|
|
|
|
|
|
|
|
GameScene.instance.UpdateUI();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
nextBtn.interactable = true;
|
|
|
|
nextBtn.interactable = true;
|
|
|
|
// closeBtn.interactable = true;
|
|
|
|
// closeBtn.interactable = true;
|
|
|
|
GameManager.currentLevelGroup.SetLevelCompleted(GameManager.CurrentLevelNo, Time.time - startTime);
|
|
|
|
GameManager.currentLevelGroup.SetLevelCompleted(GameManager.CurrentLevelNo, Time.time - startTime);
|
|
|
|
if(AdmobController.isInterAdAvailable)
|
|
|
|
if (AdmobController.isInterAdAvailable)
|
|
|
|
IronSource.Agent.showInterstitial();
|
|
|
|
IronSource.Agent.showInterstitial();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -506,6 +545,9 @@ public class GamePlayManager : MonoBehaviour
|
|
|
|
|
|
|
|
|
|
|
|
public void NextGame()
|
|
|
|
public void NextGame()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!isTimerLevel)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if (GameManager.CurrentLevelNo > GameManager.currentLevelGroup.CompletedLevel)
|
|
|
|
if (GameManager.CurrentLevelNo > GameManager.currentLevelGroup.CompletedLevel)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (GameManager.Coin < GameConfig.instance.numCoinForSkipGame)
|
|
|
|
if (GameManager.Coin < GameConfig.instance.numCoinForSkipGame)
|
|
|
@ -516,6 +558,20 @@ public class GamePlayManager : MonoBehaviour
|
|
|
|
GameManager.Coin -= GameConfig.instance.numCoinForSkipGame;
|
|
|
|
GameManager.Coin -= GameConfig.instance.numCoinForSkipGame;
|
|
|
|
GameManager.currentLevelGroup.SetLevelCompleted(GameManager.CurrentLevelNo, Time.time - startTime);
|
|
|
|
GameManager.currentLevelGroup.SetLevelCompleted(GameManager.CurrentLevelNo, Time.time - startTime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (GameManager.CurrentLevelNo > GameManager.currentLevelGroup.CompletedLevel_Timer)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (GameManager.Coin < GameConfig.instance.numCoinForSkipGame)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Toast.instance.ShowMessage("You don't have enough coins");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
GameManager.Coin -= GameConfig.instance.numCoinForSkipGame;
|
|
|
|
|
|
|
|
GameManager.currentLevelGroup.SetLevelCompleted(GameManager.CurrentLevelNo, Time.time - startTime);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
menuPopup.Close();
|
|
|
|
menuPopup.Close();
|
|
|
|
Sound.instance.PlayButton();
|
|
|
|
Sound.instance.PlayButton();
|
|
|
|
if (GameManager.currentLevelGroup.TotalLevel > GameManager.CurrentLevelNo)
|
|
|
|
if (GameManager.currentLevelGroup.TotalLevel > GameManager.CurrentLevelNo)
|
|
|
|