Advertisement
evelynshilosky

StorageBox - Part 33

Mar 7th, 2024
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class StorageBox : MonoBehaviour
  6. {
  7.     public bool playerInRange;
  8.  
  9.     [SerializeField] public List<string> items;
  10.  
  11.     public enum BoxType
  12.     {
  13.         smallBox,
  14.         BigBox
  15.     }
  16.  
  17.     public BoxType thisBoxType;
  18.  
  19.  
  20.     private void Update()
  21.     {
  22.         float distance = Vector3.Distance(PlayerState.Instance.playerBody.transform.position, transform.position);
  23.  
  24.         if (distance < 10f)
  25.         {
  26.             playerInRange = true;
  27.         }
  28.         else
  29.         {
  30.             playerInRange = false;
  31.         }
  32.     }
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement