Exemplo n.º 1
0
 public override void OnExit()
 {
     if (AnimatedChuzzles.Any())
     {
         Debug.LogError("F**K YOU FROM WIN REMOVE: " + AnimatedChuzzles.Count);
     }
 }
Exemplo n.º 2
0
 public override void LateUpdateState()
 {
     if (!AnimatedChuzzles.Any())
     {
         LateUpdateState(Gamefield.Level.ActiveCells);
     }
 }
Exemplo n.º 3
0
    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;
        }
    }
Exemplo n.º 4
0
 public void CheckAnimationCompleted()
 {
     if (!AnimatedChuzzles.Any())
     {
         CheckCombinations();
     }
 }
Exemplo n.º 5
0
 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];
 }
Exemplo n.º 6
0
 public void OnAnimationFinished(Chuzzle chuzzle)
 {
     chuzzle.AnimationFinished -= OnAnimationFinished;
     AnimatedChuzzles.Remove(chuzzle);
     if (!AnimatedChuzzles.Any())
     {
         Gamefield.SwitchStateTo(Gamefield.WinCreateNewChuzzlesState);
     }
 }
Exemplo n.º 7
0
 public override void OnExit()
 {
     if (AnimatedChuzzles.Any())
     {
         Debug.LogError("F**K you in field state: " + AnimatedChuzzles.Count);
     }
     Gamefield.GameMode.HumanTurn();
     Reset();
 }
Exemplo n.º 8
0
    public override void OnExit()
    {
        if (AnimatedChuzzles.Any())
        {
            Debug.LogError("F**K YOU FROM REMOVE COMBINATION: " + AnimatedChuzzles.Count);
        }

        PowerUpDestroyManager.Instance.IsInDestroyState = false;
    }
Exemplo n.º 9
0
    private void OnAnimationFinished(Chuzzle chuzzle)
    {
        chuzzle.AnimationFinished -= OnAnimationFinished;
        AnimatedChuzzles.Remove(chuzzle);

        chuzzle.Destroy(true, false);

        if (!AnimatedChuzzles.Any())
        {
            Gamefield.SwitchStateTo(Gamefield.WinCreateNewChuzzlesState);
        }
    }
    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);
            }
        }
    }
Exemplo n.º 11
0
    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());
    }