Popcorning Guinea Pig
Search Results for

    Show / Hide Table of Contents

    Class Card3D

    Represents a card in 3D space with enhanced 2.5D rendering. Supports nine-slice textures, animations, and interactive elements.

    Inheritance
    object
    Card3D
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: PopcorningGuineaPig.Engine.UI
    Assembly: PopcorningGuineaPig.Engine.dll
    Syntax
    public class Card3D

    Constructors

    | Edit this page View Source

    Card3D(Texture2D, Texture2D, Vector3, Vector2, float)

    Creates a new card with the specified textures and size.

    Declaration
    public Card3D(Texture2D frontTexture, Texture2D backTexture, Vector3 position, Vector2 size, float thickness = 0.1)
    Parameters
    Type Name Description
    Texture2D frontTexture

    The texture for the front of the card

    Texture2D backTexture

    The texture for the back of the card

    Vector3 position

    The initial position of the card in 3D space

    Vector2 size

    The size of the card (width, height)

    float thickness

    The visual thickness of the card

    Methods

    | Edit this page View Source

    AddSection(string, Rectangle)

    Adds an interactive section to the card.

    Declaration
    public void AddSection(string name, Rectangle rect)
    Parameters
    Type Name Description
    string name

    The name of the section

    Rectangle rect

    The rectangle defining the section (normalized 0-1 coordinates)

    | Edit this page View Source

    Draw(Camera3D)

    Draws the card.

    Declaration
    public void Draw(Camera3D camera)
    Parameters
    Type Name Description
    Camera3D camera

    The camera to use for rendering

    | Edit this page View Source

    DrawHighlight(Matrix4x4)

    Draws a highlight effect around the card.

    Declaration
    protected virtual void DrawHighlight(Matrix4x4 transform)
    Parameters
    Type Name Description
    Matrix4x4 transform

    The transformation matrix

    | Edit this page View Source

    Flip(float)

    Flips the card.

    Declaration
    public void Flip(float duration = 0.5)
    Parameters
    Type Name Description
    float duration

    The duration of the flip animation in seconds

    | Edit this page View Source

    GetPosition()

    Gets the position of the card.

    Declaration
    public Vector3 GetPosition()
    Returns
    Type Description
    Vector3

    The position of the card

    | Edit this page View Source

    GetRotation()

    Gets the rotation of the card.

    Declaration
    public Vector3 GetRotation()
    Returns
    Type Description
    Vector3

    The rotation of the card

    | Edit this page View Source

    GetSection(string)

    Gets a section by name.

    Declaration
    public Rectangle GetSection(string name)
    Parameters
    Type Name Description
    string name

    The name of the section

    Returns
    Type Description
    Rectangle

    The rectangle defining the section, or an empty rectangle if not found

    | Edit this page View Source

    GetSize()

    Gets the size of the card.

    Declaration
    public Vector2 GetSize()
    Returns
    Type Description
    Vector2

    The size of the card

    | Edit this page View Source

    IsAnimating()

    Gets whether the card is currently animating.

    Declaration
    public bool IsAnimating()
    Returns
    Type Description
    bool

    True if the card is animating, false otherwise

    | Edit this page View Source

    IsFaceUp()

    Gets whether the card is face up.

    Declaration
    public bool IsFaceUp()
    Returns
    Type Description
    bool

    True if the card is face up, false otherwise

    | Edit this page View Source

    IsPointOver(Vector2, Camera3D, out string)

    Checks if a point in screen space is over the card.

    Declaration
    public bool IsPointOver(Vector2 screenPoint, Camera3D camera, out string sectionName)
    Parameters
    Type Name Description
    Vector2 screenPoint

    The point in screen space

    Camera3D camera

    The camera used for rendering

    string sectionName

    The name of the section that was hit, if any

    Returns
    Type Description
    bool

    True if the point is over the card, false otherwise

    | Edit this page View Source

    MoveTo(Vector3, float)

    Moves the card to a new position.

    Declaration
    public void MoveTo(Vector3 target, float duration = 0.5)
    Parameters
    Type Name Description
    Vector3 target

    The target position

    float duration

    The duration of the movement animation in seconds

    | Edit this page View Source

    RotateTo(Vector3, float)

    Rotates the card to a new orientation.

    Declaration
    public void RotateTo(Vector3 targetRot, float duration = 0.5)
    Parameters
    Type Name Description
    Vector3 targetRot

    The target rotation

    float duration

    The duration of the rotation animation in seconds

    | Edit this page View Source

    SetBackNineSlice(int)

    Sets the nine-slice information for the back texture.

    Declaration
    public void SetBackNineSlice(int cornerSize)
    Parameters
    Type Name Description
    int cornerSize

    The size of the corners in pixels

    | Edit this page View Source

    SetEdgeTexture(Texture2D)

    Sets the edge texture for the card.

    Declaration
    public void SetEdgeTexture(Texture2D texture)
    Parameters
    Type Name Description
    Texture2D texture

    The texture to use for the card edges

    | Edit this page View Source

    SetFaceUp(bool)

    Sets whether the card is face up.

    Declaration
    public void SetFaceUp(bool faceUp)
    Parameters
    Type Name Description
    bool faceUp

    Whether the card should be face up

    | Edit this page View Source

    SetFrontNineSlice(int)

    Sets the nine-slice information for the front texture.

    Declaration
    public void SetFrontNineSlice(int cornerSize)
    Parameters
    Type Name Description
    int cornerSize

    The size of the corners in pixels

    | Edit this page View Source

    SetHighlight(bool, Color, float)

    Sets the highlight state of the card.

    Declaration
    public void SetHighlight(bool highlighted, Color color, float intensity = 1)
    Parameters
    Type Name Description
    bool highlighted

    Whether the card should be highlighted

    Color color

    The color of the highlight

    float intensity

    The intensity of the highlight

    | Edit this page View Source

    SetPosition(Vector3)

    Sets the position of the card.

    Declaration
    public void SetPosition(Vector3 position)
    Parameters
    Type Name Description
    Vector3 position

    The new position

    | Edit this page View Source

    SetRotation(Vector3)

    Sets the rotation of the card.

    Declaration
    public void SetRotation(Vector3 rotation)
    Parameters
    Type Name Description
    Vector3 rotation

    The new rotation

    | Edit this page View Source

    SetSize(Vector2)

    Sets the size of the card.

    Declaration
    public void SetSize(Vector2 size)
    Parameters
    Type Name Description
    Vector2 size

    The new size

    | Edit this page View Source

    Unload()

    Easing function for smooth animations.

    Declaration
    public void Unload()
    | Edit this page View Source

    Update(float)

    Updates the card's state.

    Declaration
    public void Update(float deltaTime)
    Parameters
    Type Name Description
    float deltaTime

    The time elapsed since the last update

    Events

    | Edit this page View Source

    OnClick

    Declaration
    public event Action<Card3D>? OnClick
    Event Type
    Type Description
    Action<Card3D>
    | Edit this page View Source

    OnDragEnd

    Declaration
    public event Action<Card3D, Vector3>? OnDragEnd
    Event Type
    Type Description
    Action<Card3D, Vector3>
    | Edit this page View Source

    OnDragStart

    Declaration
    public event Action<Card3D>? OnDragStart
    Event Type
    Type Description
    Action<Card3D>
    | Edit this page View Source

    OnSectionHover

    Declaration
    public event Action<Card3D, string>? OnSectionHover
    Event Type
    Type Description
    Action<Card3D, string>
    • Edit this page
    • View Source
    In this article
    Back to top © 2024 Popcorning Guinea Pig Game Engine. A custom C# game engine for indie developers.