Advertisement
evelynshilosky

EquipableItem - Part 14

Jun 6th, 2024
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.94 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. [RequireComponent(typeof(Animator))]
  6. public class EquipableItem : MonoBehaviour
  7. {
  8.  
  9.     public Animator animator;
  10.  
  11.  
  12.     // Start is called before the first frame update
  13.     void Start()
  14.     {
  15.         animator = GetComponent<Animator>();
  16.     }
  17.  
  18.     // Update is called once per frame
  19.     void Update()
  20.     {
  21.  
  22.         if (Input.GetMouseButtonDown(0) && // Left Mouse Button
  23.             InventorySystem.Instance.isOpen == false &&
  24.             CraftingSystem.Instance.isOpen == false &&
  25.             SelectionManager.Instance.handIsVisible == false
  26.             )
  27.         {
  28.  
  29.             GameObject selectedTree = SelectionManager.Instance.selectedTree;
  30.  
  31.             if (selectedTree != null)
  32.             {
  33.                 selectedTree.GetComponent<ChoppableTree>().GetHit();
  34.             }
  35.  
  36.             animator.SetTrigger("hit");
  37.         }
  38.  
  39.     }
  40. }
  41.  
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement