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