initial commit
This commit is contained in:
23
Assets/Scripts/WeaponPickup.cs
Normal file
23
Assets/Scripts/WeaponPickup.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class WeaponPickup : PickupItem
|
||||
{
|
||||
[Header("Weapon Unlock Settings")]
|
||||
[SerializeField] private int weaponSlotIndex = 1;
|
||||
|
||||
protected override bool CanCollect(GameObject player)
|
||||
{
|
||||
var weaponsController = player.GetComponent<WeaponsController>() ?? player.GetComponentInChildren<WeaponsController>();
|
||||
return weaponsController != null;
|
||||
}
|
||||
|
||||
protected override void ApplyPickupEffect(GameObject player)
|
||||
{
|
||||
var weaponsController = player.GetComponent<WeaponsController>() ?? player.GetComponentInChildren<WeaponsController>();
|
||||
if (weaponsController != null)
|
||||
{
|
||||
weaponsController.EquipWeapon(weaponSlotIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user