CapersProject/Assets/02.Scripts/Prop/Tycoon/BartenderTable.cs

69 lines
2.1 KiB
C#
Raw Normal View History

2024-10-27 09:44:22 +00:00
using System;
2024-10-20 17:21:39 +00:00
using BlueWater.Interfaces;
2024-11-26 08:22:26 +00:00
using BlueWater.Items;
2024-10-27 09:44:22 +00:00
using BlueWater.Npcs.Crews;
using BlueWater.Npcs.Crews.Server;
2024-11-25 12:36:48 +00:00
using UnityEngine;
2024-10-20 17:21:39 +00:00
namespace BlueWater.Tycoons
{
public class BartenderTable : ServingTable
{
2024-11-25 12:36:48 +00:00
[SerializeField]
private Sprite _activeSprite;
[SerializeField]
private Sprite _inactiveSprite;
protected override void Awake()
{
base.Awake();
VisualLook.sprite = _inactiveSprite;
}
public void Active()
{
VisualLook.sprite = _activeSprite;
}
2024-10-22 12:41:31 +00:00
public override void Interaction()
{
// 테이블의 칵테일을 가져가는 경우
if (CurrentPickupItem != null)
{
2024-11-26 08:22:26 +00:00
CocktailData currentCocktailData = ItemManager.Instance.CocktailDataSo.GetDataByIdx(CurrentPickupItem.Idx);
EventManager.InvokePickupCocktail(currentCocktailData);
2024-11-25 12:36:48 +00:00
CocktailGlassImage.sprite = null;
2024-10-22 12:41:31 +00:00
CocktailGlassImage.enabled = false;
2024-11-25 12:36:48 +00:00
// InteractionCanvas.BalloonUi.DiscardItem();
2024-10-22 12:41:31 +00:00
CurrentPickupItem = null;
2024-10-27 09:44:22 +00:00
OrderedCustomer = null;
2024-10-22 12:41:31 +00:00
}
}
2024-10-20 17:21:39 +00:00
public override bool CanInteraction()
{
2024-11-04 12:22:07 +00:00
return CurrentPickupItem != null && !CurrentTycoonPlayer.TycoonPickupHandler.IsPickedUpAnything();
2024-10-22 12:41:31 +00:00
}
2024-10-27 09:44:22 +00:00
public override bool CanInteractionCrew(Crew crew = null)
2024-10-22 12:41:31 +00:00
{
2024-10-27 09:44:22 +00:00
var servingCrew = (ServerCrew)crew;
if (!servingCrew)
{
throw new Exception("상호작용 오브젝트 오류");
}
return servingCrew.CurrentActionType == ActionType.TakeCocktail && CurrentPickupItem != null && OrderedCustomer;
2024-10-20 17:21:39 +00:00
}
public void CompleteMakingCocktail(IPickup cocktailData)
{
CurrentPickupItem = cocktailData;
2024-11-25 12:36:48 +00:00
CocktailGlassImage.sprite = CurrentPickupItem.Sprite;
2024-10-20 17:21:39 +00:00
CocktailGlassImage.enabled = true;
2024-11-25 12:36:48 +00:00
// InteractionCanvas.BalloonUi.SetItemImage(CurrentPickupItem);
2024-10-20 17:21:39 +00:00
}
}
}