Add SFX and SFX logic

This commit is contained in:
BuyMyMojo 2023-03-03 05:10:23 +11:00
parent f0e4f6c9ba
commit 1aa97baff4
19 changed files with 504 additions and 8 deletions

View file

@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -5,6 +6,8 @@ using UnityEngine;
public class BaseCounter : MonoBehaviour, IKitchenObjectParent
{
public static event EventHandler OnAnyObjectPlaced;
[SerializeField] private Transform counterTopPoint;
private KitchenObject kitchenObject;
@ -28,6 +31,11 @@ public class BaseCounter : MonoBehaviour, IKitchenObjectParent
public void SetKitchenObject(KitchenObject kitchenObject)
{
this.kitchenObject = kitchenObject;
if (kitchenObject != null )
{
OnAnyObjectPlaced?.Invoke(this, EventArgs.Empty);
}
}
public KitchenObject GetKitchenObject()

View file

@ -6,6 +6,8 @@ using UnityEngine;
public class CuttingCounter : BaseCounter, IHasProgress
{
public static event EventHandler OnAnyCut;
public event EventHandler<IHasProgress.OnProgressChangeEventsArgs> OnProgressChange;
public event EventHandler OnCut;
@ -72,6 +74,7 @@ public class CuttingCounter : BaseCounter, IHasProgress
cuttingProgress++;
OnCut?.Invoke(this, EventArgs.Empty);
OnAnyCut?.Invoke(this, EventArgs.Empty);
CuttingRecipeSO cuttingRecipeSO = GetCuttingRecipeSOWithInput(GetKitchenObject().GetKitchenObjectSO());

View file

@ -1,9 +1,18 @@
using ERP.Discord;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DeliveryCounter : BaseCounter
{
public static DeliveryCounter Instance { get; private set; }
private void Awake()
{
Instance = this;
}
public override void Interact(Player player)
{
if (player.HasKitchenObject())

View file

@ -1,14 +1,20 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TrashCounter : BaseCounter
{
public static event EventHandler OnAnyObjectTrashed;
public override void Interact(Player player)
{
if (player.HasKitchenObject())
{
player.GetKitchenObject().DestroySelf();
OnAnyObjectTrashed?.Invoke(this, EventArgs.Empty);
}
}
}