CapersProject/Assets/02.Scripts/Prop/Tycoon/BartenderTable.cs
2024-11-25 21:36:48 +09:00

68 lines
2.1 KiB
C#

using System;
using BlueWater.Interfaces;
using BlueWater.Npcs.Crews;
using BlueWater.Npcs.Crews.Server;
using UnityEngine;
namespace BlueWater.Tycoons
{
public class BartenderTable : ServingTable
{
[SerializeField]
private Sprite _activeSprite;
[SerializeField]
private Sprite _inactiveSprite;
protected override void Awake()
{
base.Awake();
VisualLook.sprite = _inactiveSprite;
}
public void Active()
{
VisualLook.sprite = _activeSprite;
}
public override void Interaction()
{
// 테이블의 칵테일을 가져가는 경우
if (CurrentPickupItem != null)
{
CurrentTycoonPlayer.TycoonPickupHandler.PickupItem(CurrentPickupItem, true);
CurrentTycoonPlayer.InteractionCanvas.BalloonUi.SetItemImage(CurrentPickupItem);
CocktailGlassImage.sprite = null;
CocktailGlassImage.enabled = false;
// InteractionCanvas.BalloonUi.DiscardItem();
CurrentPickupItem = null;
OrderedCustomer = null;
}
}
public override bool CanInteraction()
{
return CurrentPickupItem != null && !CurrentTycoonPlayer.TycoonPickupHandler.IsPickedUpAnything();
}
public override bool CanInteractionCrew(Crew crew = null)
{
var servingCrew = (ServerCrew)crew;
if (!servingCrew)
{
throw new Exception("상호작용 오브젝트 오류");
}
return servingCrew.CurrentActionType == ActionType.TakeCocktail && CurrentPickupItem != null && OrderedCustomer;
}
public void CompleteMakingCocktail(IPickup cocktailData)
{
CurrentPickupItem = cocktailData;
CocktailGlassImage.sprite = CurrentPickupItem.Sprite;
CocktailGlassImage.enabled = true;
// InteractionCanvas.BalloonUi.SetItemImage(CurrentPickupItem);
}
}
}