You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
388 B
18 lines
388 B
1 year ago
|
using System;
|
||
|
using Unity.Netcode;
|
||
|
using UnityEngine;
|
||
|
|
||
|
namespace Game {
|
||
|
public abstract class Collectable : NetworkBehaviour {
|
||
|
private void OnTriggerEnter2D(Collider2D other) {
|
||
|
Player player = other.GetComponent<Ball>().LastContactPlayer;
|
||
|
if (player != null) {
|
||
|
Destroy(gameObject);
|
||
|
OnCollect(player);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
protected abstract void OnCollect(Player collector);
|
||
|
}
|
||
|
}
|