Advertisement
evelynshilosky

EquipableItem - Part 15

Jun 11th, 2024
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.98 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.             animator.SetTrigger("hit");
  30.  
  31.         }
  32.  
  33.     }
  34.  
  35.     public void GetHit()
  36.     {
  37.         GameObject selectedTree = SelectionManager.Instance.selectedTree;
  38.  
  39.         if (selectedTree != null)
  40.         {
  41.             selectedTree.GetComponent<ChoppableTree>().GetHit();
  42.         }
  43.     }
  44.    
  45.    
  46.  
  47. }
  48.  
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement