79 lines
2.5 KiB
C#
79 lines
2.5 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace DDD
|
|
{
|
|
[Flags]
|
|
public enum RestaurantOrderInteractionType : uint
|
|
{
|
|
// None = 0u,
|
|
WaitCustomer = 0,
|
|
// WaitCustomer = 1u << 0,
|
|
// WaitOrder = 1u << 1,
|
|
// WaitServe = 1u << 2,
|
|
// All = 0xFFFFFFFFu
|
|
}
|
|
public class RestaurantOrderInteraction : RestaurantInteractionComponent, IInteractionSubsystemObject<RestaurantOrderInteractionType>
|
|
{
|
|
[SerializeField] protected RestaurantOrderInteractionType _initialOrderInteractionType = RestaurantOrderInteractionType.WaitCustomer;
|
|
private RestaurantOrderInteractionType _currentRestaurantOrderInteractionType;
|
|
|
|
// EDITOR
|
|
private void Reset()
|
|
{
|
|
SetInteractionTypeToRestaurantOrder();
|
|
}
|
|
private void OnValidate()
|
|
{
|
|
SetInteractionTypeToRestaurantOrder();
|
|
}
|
|
// ~EDITOR
|
|
|
|
private void Start()
|
|
{
|
|
_currentRestaurantOrderInteractionType = _initialOrderInteractionType;
|
|
}
|
|
|
|
private void SetInteractionTypeToRestaurantOrder()
|
|
{
|
|
_interactionType = InteractionType.RestaurantOrder;
|
|
}
|
|
public override InteractionType GetInteractionType()
|
|
{
|
|
return InteractionType.RestaurantOrder;
|
|
}
|
|
public override bool CanInteract()
|
|
{
|
|
// 현재 RestaurantOrderInteractionType를 수행할 수 있는지?
|
|
if (GetInteractionSubsystemType() == RestaurantOrderInteractionType.WaitCustomer)
|
|
{
|
|
// Check WaitCustomer
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public override bool OnInteracted(IInteractor interactor, ScriptableObject payloadSo = null)
|
|
{
|
|
// _currentRestaurantOrderInteractionType에 따라 동작이 달라지겠지
|
|
if (GetInteractionSubsystemType() == RestaurantOrderInteractionType.WaitCustomer)
|
|
{
|
|
// DO WAIT CUSTOMER
|
|
}
|
|
return base.OnInteracted(interactor, payloadSo);
|
|
}
|
|
|
|
public override void InitializeInteraction(InteractionType interactionType)
|
|
{
|
|
// RestaurantOrderInteractionType에 따른 동작들을 초기화
|
|
// Initialize WaitCustomer actions
|
|
base.InitializeInteraction(interactionType);
|
|
}
|
|
|
|
public RestaurantOrderInteractionType GetInteractionSubsystemType()
|
|
{
|
|
return _currentRestaurantOrderInteractionType;
|
|
}
|
|
}
|
|
} |