Ejemplo n.º 1
0
    void Update()
    {
        //Ativa e desativa a rotação das pernas quando o jogador está ou não se movendo
        if (Run)
        {
            LeftL.GetComponent <Rotation>().Rotate  = true;
            RightL.GetComponent <Rotation>().Rotate = true;
        }
        else
        {
            LeftL.GetComponent <Rotation>().Rotate  = false;
            RightL.GetComponent <Rotation>().Rotate = false;
        }

        //Permite ao jogador desenhar na tela e cirar as pernas
        if (Input.GetMouseButtonDown(0))
        {
            if (EventSystem.current.IsPointerOverGameObject())
            {
                StartCoroutine(draw());
            }
        }

        //Verifica se o jogador está no chão;
        CheckGround();

        //O jogador volta ao inicio caso ele caia
        if (transform.position.y < 0f)
        {
            transform.position = new Vector3(0, 3f, 0);
        }
    }
Ejemplo n.º 2
0
        private BaseTetromino GeneratePiece(int i)
        {
            var           pieceTypeToCreate = (PieceTypes)Game1.Random.Next(0, 7);
            var           startPoint        = new Point(-4, i * 4);
            BaseTetromino newPiece          = null;


            switch (pieceTypeToCreate)
            {
            case PieceTypes.LL:
                newPiece = new LeftL(Content.Load <Texture2D>("NewPieces/LPiece"), startPoint, Color.Orange, Vector2.One, RotationOptions.NoRotation);
                break;

            case PieceTypes.RL:
                newPiece = new RightL(Content.Load <Texture2D>("NewPieces/RPiece"), startPoint, Color.Blue, Vector2.One, RotationOptions.NoRotation);
                break;

            case PieceTypes.T:
                newPiece = new TPiece(Content.Load <Texture2D>("NewPieces/TPiece"), startPoint, Color.Purple, Vector2.One, RotationOptions.NoRotation);
                break;

            case PieceTypes.LZZ:
                newPiece = new LeftZigZag(Content.Load <Texture2D>("NewPieces/LeftZigZag"), startPoint, Color.Green, Vector2.One, RotationOptions.NoRotation);
                break;

            case PieceTypes.RZZ:
                newPiece = new RightZigZag(Content.Load <Texture2D>("NewPieces/RightZigZag"), startPoint, Color.Red, Vector2.One, RotationOptions.NoRotation);
                break;

            case PieceTypes.Square:
                newPiece = new Square(Content.Load <Texture2D>("NewPieces/Square"), startPoint, Color.Yellow, Vector2.One, RotationOptions.NoRotation);
                break;

            case PieceTypes.Straight:
                newPiece = new StraightPiece(Content.Load <Texture2D>("NewPieces/StraightPiece"), startPoint, Color.LightBlue, Vector2.One, RotationOptions.NoRotation);
                break;
            }


            return(newPiece);
        }