Beispiel #1
0
    void UpdateGame()
    {
        _puzzle.fallInterval = _InitialFallInterval;
        if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            _puzzle.MoveLeft();
        }
        else if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            _puzzle.MoveRight();
        }

        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            _puzzle.RotateClockwise();
        }

        if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            _puzzle.MoveDown();
        }
        else if (Input.GetKeyDown(KeyCode.Return))
        {
            _puzzle.Land();
        }
        _puzzle.Update(UnityEngine.Time.deltaTime);
        DrawGame();
        if (_puzzle.isGameOver)
        {
            StartGameOver();
        }

        var erasedLines = _puzzle.erasedYList.Count;

        if (erasedLines > 0)         // 消えた!
        {
            var charge = erasedLines * erasedLines * 100;
            StartCoroutine(_macopay.CoWalletCurrency(charge, OnMacopayApiComplete));
        }
    }
Beispiel #2
0
    void UpdateGame()
    {
        _puzzle.fallInterval = _InitialFallInterval;
        if (Input.GetKeyDown(KeyCode.LeftArrow) || _left)
        {
            _puzzle.MoveLeft();
        }
        else if (Input.GetKeyDown(KeyCode.RightArrow) || _right)
        {
            _puzzle.MoveRight();
        }

        if (Input.GetKeyDown(KeyCode.UpArrow) || _rotation)
        {
            _puzzle.RotateClockwise();
        }

        if (Input.GetKeyDown(KeyCode.DownArrow) || _down)
        {
            _puzzle.MoveDown();
        }
        else if (Input.GetKeyDown(KeyCode.Return) || _fall)
        {
            _puzzle.Land();
        }
        _puzzle.Update(Time.deltaTime);
        DrawGame();
        if (_puzzle.isGameOver)
        {
            StartGameOver();
        }
        var drag = _touchDetector.dragMilliMeter;

        _cameraRotationX += drag.x;
        _cameraRotationY += drag.y;
        _camera3d.transform.localRotation = Quaternion.Euler(_cameraRotationY, -_cameraRotationX, 0f);
        _touchDetector.ClearInput();
        _left = _right = _rotation = _down = _fall = false;
    }