never let me cook again
This commit is contained in:
parent
63e5e950de
commit
13bb58ea03
6 changed files with 56 additions and 4 deletions
24
Assets/Scripts/ItemPickup.cs
Normal file
24
Assets/Scripts/ItemPickup.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
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 = (transform.position - AbilityManager.instance.player.transform.position).normalized * speed;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerEnter2D(Collider2D other)
|
||||
{
|
||||
//pick up
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue