示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (gameState == GameState.Playing)
        {
            InputDirection?value = inputDetector.DetectInputDirection();


            if (value.HasValue)
            {
                List <ItemMovementDetails> movementDetails = new List <ItemMovementDetails>();
                //Debug.Log(value);
                if (value == InputDirection.Left)
                {
                    movementDetails = matrix.MoveHorizontal(HorizontalMovement.Left);
                }
                else if (value == InputDirection.Right)
                {
                    movementDetails = matrix.MoveHorizontal(HorizontalMovement.Right);
                }
                else if (value == InputDirection.Top)
                {
                    movementDetails = matrix.MoveVertical(VerticalMovement.Top);
                }
                else if (value == InputDirection.Bottom)
                {
                    movementDetails = matrix.MoveVertical(VerticalMovement.Bottom);
                }


                if (movementDetails.Count > 0)
                {
                    StartCoroutine(AnimateItems(movementDetails));
                }
                string x = Utilities.ShowMatrixOnConsole(matrix);
                DebugDisplay(x);
            }
        }
    }