예제 #1
0
    private void Update()
    {
        if (GameManager.Instance.gameState == GameState.READY && (InputManager.Instance.entry == Entry.SWIPE_LEFT || InputManager.Instance.entry == Entry.SWIPE_RIGHT))
        {
            StartRotation(InputManager.Instance.entry);
        }

        if (isSliding)
        {
            //sliding.Status();
            if (emptyGrids.Count > 0)
            {
                if (sliding.start)
                {
                    HexCoordinate[] arr = emptyGrids.ToArray();
                    Array.Sort(arr);
                    emptyGrids = new Stack <HexCoordinate>(arr);
                    sliding.Continue();
                }
                else if (sliding.continuing)
                {
                    Slide();
                }
            }
            else
            {
                if (sliding.end)
                {
                    bool explosion = ExplodeAll();
                    if (explosion)
                    {
                        sliding.Reset();
                    }
                }
                else
                {
                    if (startPhase)
                    {
                        startPhase = false;
                        ScoreManager.Instance.Enable();
                    }
                    isSliding = false;
                    sliding.Reset();
                    DisableIdentifiers();
                    GameManager.Instance.gameState = GameState.READY;
                }
            }
        }
    }