Download Assets/Scripts/InteractablePickup.cs from AliAch/my-unity-assets: direct link, hf CLI and curl.
- Browser
- Download file 635 Bytes
-
https://huggingface.co/datasets/AliAch/my-unity-assets/resolve/main/Assets/Scripts/InteractablePickup.cs
- Command line
-
hf download hf://datasets/AliAch/my-unity-assets/Assets/Scripts/InteractablePickup.cs
-
curl -L -o InteractablePickup.cs https://huggingface.co/datasets/AliAch/my-unity-assets/resolve/main/Assets/Scripts/InteractablePickup.cs
635 Bytes
| using UnityEngine; | |
| public class InteractablePickup : MonoBehaviour, IInteractable | |
| { | |
| [] | |
| public Sprite itemSprite; | |
| public Transform handle; | |
| public KeyCode keyCode = KeyCode.E; | |
| public Sprite GetSprite() | |
| { | |
| return itemSprite; | |
| } | |
| public Transform GetHandle() | |
| { | |
| return handle != null ? handle : transform; | |
| } | |
| public bool CanInteract() | |
| { | |
| return Input.GetKeyDown(keyCode); | |
| } | |
| public void interact() | |
| { | |
| if (PickUpScript.instance != null) | |
| { | |
| PickUpScript.instance.PickUpObject(this.gameObject); | |
| } | |
| } | |
| } |