If you want to be able to move to your pickup to pick it up instead of the click to acquire design @sampattuzzi implemented in the RPG course, make these changes…
frist make sure your prefab has a collider and it is set to trigger (you should already have the required Rigidbody on your player to make your weapon pickups work)
then make these changes to ClickablePickup.cs
using GameDevTV.Inventories;
using RPG.Movement;
using UnityEngine;
namespace RPG.Control
{
[RequireComponent(typeof(Pickup))]
public class ClickablePickup : MonoBehaviour, IRayCastable
{
Pickup pickup;
private void Awake()
{
pickup = GetComponent<Pickup>();
}
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Player"))
{
pickup.PickupItem();
}
}
public CursorType GetCursorType()
{
if (pickup.CanBePickedUp())
{
return CursorType.Pickup;
}
else
{
return CursorType.FullPickup;
}
}
public bool HandleRaycast(PlayerController callingController)
{
if (Input.GetMouseButtonDown(0))
{
callingController.GetComponent<Mover>().StartMovementAction(transform.position);
}
return true;
}
}
}