Search Results for

    Show / Hide Table of Contents

    Class UseItem

    This class allows a player to pick up, hold, and drop items during the game. It is primarily used for managing interactions with the "hat" in "keep-away" mode.

    Inheritance
    object
    UseItem
    Namespace: Player
    Assembly: cs.temp.dll.dll
    Syntax
    public class UseItem : MonoBehaviour

    Fields

    head

    The position where the item will be held (e.g., above the player's head).

    Declaration
    public Transform head
    Field Value
    Type Description
    Transform

    holdTime

    The total time the player has held the item.

    Declaration
    public float holdTime
    Field Value
    Type Description
    float

    Methods

    DropItem()

    Allows the player to drop the item they are holding.

    Declaration
    public void DropItem()

    IsHoldingItem()

    Checks if the player is currently holding an item.

    Declaration
    public bool IsHoldingItem()
    Returns
    Type Description
    bool

    True if the player is holding an item, false otherwise.

    PickUpItem(GameObject)

    Allows the player to pick up an item and start the hold timer.

    Declaration
    public void PickUpItem(GameObject item)
    Parameters
    Type Name Description
    GameObject item

    The item to pick up.

    In This Article
    Back to top Example Unity documentation footer