public override void OnEnter() { AnimatedChuzzles.Clear(); Chuzzle.DropEventHandlers(); Chuzzle.AnimationStarted += OnAnimationStarted; CreateNew(); }
private void OnAnimationFinished(Chuzzle chuzzle) { chuzzle.AnimationFinished -= OnAnimationFinished; AnimatedChuzzles.Remove(chuzzle); CheckAnimationCompleted(); }
public void CheckAnimationCompleted() { if (!AnimatedChuzzles.Any()) { CheckCombinations(); } }
public override void LateUpdateState() { if (!AnimatedChuzzles.Any()) { LateUpdateState(Gamefield.Level.ActiveCells); } }
public override void OnExit() { if (AnimatedChuzzles.Any()) { Debug.LogError("F**K YOU FROM WIN REMOVE: " + AnimatedChuzzles.Count); } }
public void OnAnimationFinished(Chuzzle chuzzle) { chuzzle.Real = chuzzle.Current = chuzzle.MoveTo; chuzzle.AnimationFinished -= OnAnimationFinished; AnimatedChuzzles.Remove(chuzzle); if (isAlreadyChangedState) { Debug.LogWarning("Finished in CRNC state "); } if (!AnimatedChuzzles.Any() && !isAlreadyChangedState) { Gamefield.Level.UpdateActive(); var combinations = GamefieldUtility.FindCombinations(Gamefield.Level.ActiveChuzzles); if (combinations.Count > 0) { Gamefield.SwitchStateTo(Gamefield.CheckSpecialState); } else { if (!Gamefield.GameMode.IsWin && !Gamefield.GameMode.IsGameOver) { Gamefield.SwitchStateTo(Gamefield.FieldState); } else { Gamefield.GameMode.Check(); } } isAlreadyChangedState = true; } }
public override void OnEnter() { isAlreadyChangedState = false; AnimatedChuzzles.Clear(); Chuzzle.DropEventHandlers(); Chuzzle.AnimationStarted += OnAnimationStarted; CreateNew(); }
private void OnAnimationStarted(Chuzzle chuzzle) { if (!AnimatedChuzzles.Contains(chuzzle)) { AnimatedChuzzles.Add(chuzzle); chuzzle.AnimationFinished += OnAnimationFinished; } }
public override void OnExit() { if (AnimatedChuzzles.Any()) { Debug.LogError("F**K YOU FROM CREATE NEW STATE: " + AnimatedChuzzles.Count); } Gamefield.NewTilesInColumns = new int[Gamefield.Level.Width]; }
public void OnAnimationFinished(Chuzzle chuzzle) { chuzzle.AnimationFinished -= OnAnimationFinished; AnimatedChuzzles.Remove(chuzzle); if (!AnimatedChuzzles.Any()) { Gamefield.SwitchStateTo(Gamefield.WinCreateNewChuzzlesState); } }
public override void OnExit() { if (AnimatedChuzzles.Any()) { Debug.LogError("F**K you in field state: " + AnimatedChuzzles.Count); } Gamefield.GameMode.HumanTurn(); Reset(); }
public override void OnExit() { if (AnimatedChuzzles.Any()) { Debug.LogError("F**K YOU FROM REMOVE COMBINATION: " + AnimatedChuzzles.Count); } PowerUpDestroyManager.Instance.IsInDestroyState = false; }
private void OnAnimationFinished(Chuzzle chuzzle) { chuzzle.AnimationFinished -= OnAnimationFinished; AnimatedChuzzles.Remove(chuzzle); chuzzle.Destroy(true, false); if (!AnimatedChuzzles.Any()) { Gamefield.SwitchStateTo(Gamefield.WinCreateNewChuzzlesState); } }
public override void OnEnter() { AnimatedChuzzles.Clear(); Chuzzle.DropEventHandlers(); Chuzzle.AnimationStarted += OnAnimationStarted; var combinations = GamefieldUtility.FindCombinations(Gamefield.Level.ActiveChuzzles); if (!CheckForSpecial(combinations)) { Gamefield.SwitchStateTo(Gamefield.WinRemoveCombinationState); } }
private void OnAnimationStarted(Chuzzle chuzzle) { if (isAlreadyChangedState) { Debug.LogWarning("Already changed state create new chuzzle"); return; } if (!AnimatedChuzzles.Contains(chuzzle)) { AnimatedChuzzles.Add(chuzzle); chuzzle.AnimationFinished += OnAnimationFinished; } }
public override void OnEnter() { AnimatedChuzzles.Clear(); Chuzzle.DropEventHandlers(); Chuzzle.AnimationStarted += OnAnimationStarted; var anyCombination = GamefieldUtility.FindOnlyOneCombination(Gamefield.Level.ActiveChuzzles); if (anyCombination.Any()) { StartCoroutine(RemoveCombinations()); } else { Gamefield.SwitchStateTo(Gamefield.FieldState); } }
public override void OnEnter() { AnimatedChuzzles.Clear(); Chuzzle.DropEventHandlers(); Chuzzle.AnimationStarted += OnAnimationStarted; if (!Tutorial.isActive) { CheckPossibleCombinations(); } if (!Gamefield.InvaderWasDestroyed) { InvaderChuzzle.Populate(Gamefield); } Gamefield.InvaderWasDestroyed = false; }
private IEnumerator RemoveCombinations() { var powerUpCombination = GamefieldUtility.FindOnlyOneCombinationWithCondition(Gamefield.Chuzzles, GamefieldUtility.IsPowerUp); //if has any powerups if (powerUpCombination.Any()) { //destroy step by step PowerUpDestroyManager.Instance.Destroy(powerUpCombination); if (!AnimatedChuzzles.Any()) { Gamefield.SwitchStateTo(Gamefield.CreateNewChuzzlesState); } } else { var combinations = GamefieldUtility.FindCombinations(Gamefield.Chuzzles); //remove combinations foreach (var combination in combinations) { Gamefield.InvokeCombinationDestroyed(combination); foreach (var chuzzle in combination) { chuzzle.Destroy(true); } if (!AnimatedChuzzles.Any()) { Gamefield.SwitchStateTo(Gamefield.CreateNewChuzzlesState); } yield return(new WaitForSeconds(0.05f)); } } yield return(new WaitForEndOfFrame()); }
public void OnAnimationFinished(Chuzzle chuzzle) { chuzzle.Real = chuzzle.Current = chuzzle.MoveTo; chuzzle.AnimationFinished -= OnAnimationFinished; AnimatedChuzzles.Remove(chuzzle); if (!AnimatedChuzzles.Any()) { Gamefield.Level.UpdateActive(); var combinations = GamefieldUtility.FindCombinations(Gamefield.Level.ActiveChuzzles); if (combinations.Count > 0) { Gamefield.SwitchStateTo(Gamefield.WinCheckSpecialState); } else { Gamefield.SwitchStateTo(Gamefield.WinRemoveCombinationState); } } }
public override void OnEnter() { AnimatedChuzzles.Clear(); Chuzzle.DropEventHandlers(); Chuzzle.AnimationStarted += OnAnimationStarted; var powerUpChuzzles = Gamefield.Level.Chuzzles.Where(GamefieldUtility.IsPowerUp).ToArray(); foreach (var ch in powerUpChuzzles) { ch.Destroy(true); } var combinations = GamefieldUtility.FindCombinations(Gamefield.Level.ActiveChuzzles); if (combinations.Any()) { RemoveCombinations(combinations); } else if (!powerUpChuzzles.Any()) { StartCoroutine(GameModeCheck()); } }