Exemple #1
0
    //Movement

    /*
     * get the touch input
     * get the position in the array
     * use deltaposition to see which direction it went
     * to see which direction find the difference detween the start and stop of both x and y
     * see which number is larger(check if neg or pos)
     * then the difference also tells the direction(up down left right)
     * pass the information to the game logic class with the array posstion and which direction
     */

    void FixedUpdate()
    {
        if (!_paused)
        {
            //Debug.Log("can touch is: " + canTouch);
            //Debug.Log("moving is: " + moving);
            //Debug.Log("moveComplete is " + moveComplete);

            if (!_gameField.AreVisibleTilesMoving())
            {
                canTouch = true;
            }

            if (_gameField.AreVisibleTilesMoving() && !moving)
            {
                canTouch = false;
            }

            if (moving)
            {
                CheckMovementComplete();
            }

            if (Input.GetKeyDown("p") || Input.GetKeyDown(KeyCode.Escape))
            {
                CheckBoard();
                canTouch = false;
            }

            if (Input.GetKeyDown("l"))
            {
                canTouch = true;
            }


            if (canTouch && !_gameField.AreVisibleTilesMoving())
            {
                TrackMovement();
            }

            if (!_gameField.AreVisibleTilesMoving())
            {
                if (_boardCheckCounter >= 15)
                {
                    CheckBoard();
                    _boardCheckCounter = 0;
                }

                _boardCheckCounter++;
            }

            if (_noMatches)
            {
                if (_comboResetCounter >= 20)
                {
                    _feedback.CombatUI.GetComponentInChildren <ComboFeedback>().comboOver  = true;
                    _feedback.CombatUI.GetComponentInChildren <ComboFeedback>().comboCount = GameManager.comboCount;
                    GameManager.comboCount = 0;
                    _comboResetCounter     = 0;
                }

                _comboResetCounter++;
            }
            else
            {
                _comboResetCounter = 0;
            }
        }
    }