20 lines
513 B
C#
Executable File
20 lines
513 B
C#
Executable File
using System;
|
|
using UnityEngine;
|
|
|
|
[RequireComponent(typeof(BoxCollider))]
|
|
public class AmmoPickUp : MonoBehaviour, IPickable
|
|
{
|
|
public PickUpType type => PickUpType.Ammunition;
|
|
|
|
public void OnTriggerEnter(Collider other)
|
|
{
|
|
PickObject(other.gameObject);
|
|
}
|
|
|
|
public void PickObject(GameObject obj)
|
|
{
|
|
obj.GetComponent<CharacterCondition>()?.TakeAmmo(SettingsReader.Instance.GetSettings.ammunitionPickupAmount);
|
|
gameObject.SetActive(false);
|
|
}
|
|
}
|