Updated aim

This commit is contained in:
2023-04-03 20:02:28 -04:00
parent 9f71b56c94
commit 711778d91c
5 changed files with 557 additions and 177 deletions

View File

@ -53,36 +53,9 @@ public class PlayerInteractionHandler : MonoBehaviour
// Update is called once per frame
void Update()
{
if (itemSelector == null)
{
itemSelector = ItemSelector.instance;
}
if (useItemSelector)
{
InteractableItem item = this.itemSelector.Selected;
if(item != null)
{
if (item is HeavyInteractableItem)
{
heavyItemsInRange = new List<HeavyInteractableItem>() { (HeavyInteractableItem)item };
itemsInRange = new List<InteractableItem> { item };
print("Item:" + item.name);
}
else
{
itemsInRange = new List<InteractableItem> { item };
heavyItemsInRange = new List<HeavyInteractableItem>();
}
}
else
{
itemsInRange = new List<InteractableItem>();
heavyItemsInRange = new List<HeavyInteractableItem>();
}
}
if(Input.GetButtonDown("Fire1"))
{
if (this.GunEnabled)
@ -218,7 +191,7 @@ public class PlayerInteractionHandler : MonoBehaviour
private void OnTriggerEnter(Collider other)
{
/* if(other.gameObject.GetComponent<InteractableItem>() != null)
if(other.gameObject.GetComponent<InteractableItem>() != null)
{
InteractableItem item = other.gameObject.GetComponent<InteractableItem>();
if(item is InteractableItem && item is not HeavyInteractableItem)
@ -231,11 +204,11 @@ public class PlayerInteractionHandler : MonoBehaviour
heavyItemsInRange.Add((HeavyInteractableItem)item);
}
}*/
}
}
private void OnTriggerExit(Collider other)
{
/*if (other.gameObject.GetComponent<InteractableItem>() != null)
if (other.gameObject.GetComponent<InteractableItem>() != null)
{
InteractableItem item = other.gameObject.GetComponent<InteractableItem>();
if (item is InteractableItem && item is not HeavyInteractableItem)
@ -250,6 +223,6 @@ public class PlayerInteractionHandler : MonoBehaviour
//itemsInRange.Remove((HeavyInteractableItem)(item));
heavyItemsInRange.Remove((HeavyInteractableItem)item);
}
}*/
}
}
}