25 lines
719 B
C#
25 lines
719 B
C#
using System;
|
|
using Unity.Netcode;
|
|
using UnityEngine;
|
|
|
|
public class ContainerCounter : BaseCounter {
|
|
[SerializeField] private KitchenObjectSO kitchenObjectSO;
|
|
public event EventHandler OnPlayerGrabbedObject;
|
|
|
|
public override void Interact(Player player) {
|
|
if (kitchenObjectSO != null && player.KitchenObject == null) {
|
|
KitchenObject.SpawnKitchenObject(kitchenObjectSO, player);
|
|
InteractLogicServerRpc();
|
|
}
|
|
}
|
|
|
|
[ServerRpc(RequireOwnership = false)]
|
|
public void InteractLogicServerRpc() {
|
|
InteractLogicClientRpc();
|
|
}
|
|
|
|
[ClientRpc]
|
|
public void InteractLogicClientRpc() {
|
|
OnPlayerGrabbedObject?.Invoke(this, EventArgs.Empty);
|
|
}
|
|
} |