Esempio n. 1
0
    private void UpdateBlockGroup(BlockGroup group)
    {
        #region Move
        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            group.MoveToLowest();
            group.Fix();
            return;
        }

        var direction = Vector3.zero;
        if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            direction += Vector3.left;
        }

        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            direction += Vector3.right;
        }

        if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            direction += Vector3.down;
        }

        direction.Normalize();

        if (direction != Vector3.zero)
        {
            currentDownTerm = 0.0f;
        }

        group.Move(direction);

        #endregion

        #region Rotation

        if (Input.GetKeyDown(KeyCode.Space))
        {
            group.Rotate();
        }

        #endregion
    }