27 lines
572 B
C#
27 lines
572 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
public class ItemPickup : MonoBehaviour
|
|
{
|
|
public bool inRange;
|
|
[Header("Movement")]
|
|
[SerializeField] private Rigidbody2D rb;
|
|
[SerializeField] private float speed;
|
|
|
|
private void FixedUpdate()
|
|
{
|
|
if (inRange)
|
|
{
|
|
rb.linearVelocity = (AbilityManager.instance.player.transform.position - transform.position).normalized * speed;
|
|
}
|
|
}
|
|
|
|
private void OnTriggerEnter2D(Collider2D other)
|
|
{
|
|
}
|
|
|
|
public virtual void PickupEffects()
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
}
|