# Conflicts:
#	Assets/01.Scenes/Old/0599.DialogueTest2.unity
#	Assets/Toon Water URP/Curved Toon Water Material 1.mat
This commit is contained in:
SweetJJuya 2025-02-27 13:28:04 +09:00
commit 3ad7edb46a
691 changed files with 612229 additions and 18363 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2dc0597c8a0581b4fbfde8a7754802ea
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 96874bff56e82ae499844bdd30a88fd0
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c6a240246856f7244b26d568219d213d
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -83,9 +83,12 @@ namespace DDD.Npcs.Crews
public ICrewInteraction CrewInteraction { get; protected set; }
public bool IsOnMission { get; protected set; }
public bool IsRingedBell { get; protected set; }
public bool HasReachedBell { get; protected set; }
private IAstarAI _astarAi;
private Transform _spawnTransform;
private Vector3 _bellPosition;
#endregion
@ -193,6 +196,29 @@ namespace DDD.Npcs.Crews
CrewInteraction.InteractionRadius;
}
public void RingedBell(Vector3 bellPosition)
{
HasReachedBell = false;
IsRingedBell = true;
_bellPosition = bellPosition;
}
public void MoveBell()
{
AIMovement.Move(_bellPosition);
}
public void ReachedBell()
{
HasReachedBell = true;
AIMovement.StopMove();
}
public void EndBell()
{
IsRingedBell = false;
}
#endregion
}
}

View File

@ -1,5 +1,6 @@
using DDD.Interfaces;
using DDD.Npcs.Customers;
using DDD.ScriptableObjects;
namespace DDD.Npcs.Crews.Server
{
@ -15,7 +16,7 @@ namespace DDD.Npcs.Crews.Server
public class ServerCrew : Crew
{
public Customer OrderedCustomer { get; private set; }
public IPickup CurrentPickupItem { get; private set; }
public CraftRecipeData CurrentPickupItem { get; private set; }
public bool IsServing { get; private set; }
public ActionType CurrentActionType { get; private set; }
@ -73,12 +74,12 @@ namespace DDD.Npcs.Crews.Server
CurrentActionType = actionType;
}
public void TakeFromServingTable(IPickup pickupItem, Customer orderedCustomer)
public void TakeFromServingTable(CraftRecipeData pickupItem, Customer orderedCustomer)
{
CurrentPickupItem = pickupItem;
OrderedCustomer = orderedCustomer;
CrewInteraction = OrderedCustomer;
BalloonUi.SetItemImage(CurrentPickupItem);
BalloonUi.SetItemImage(CurrentPickupItem.Sprite);
IsServing = true;
}
}

View File

@ -391,11 +391,10 @@ namespace DDD.Npcs.Customers
{
var serverCrew = (ServerCrew)crew;
var currentPickupItem = serverCrew.CurrentPickupItem;
//var servedCocktailData = ItemManager.Instance.CocktailDataSo.GetDataByIdx(currentPickupItem.Idx);
IsOrderedCorrected = currentPickupItem.Idx == OrderedCocktailData.Idx;
IsOrderedCorrected = currentPickupItem.Idx == OrderedCraftRecipeData.Idx;
IsReceivedItem = true;
IsServedPlayer = false;
//ServedItem(servedCocktailData);
ServedItem(currentPickupItem);
serverCrew.BalloonUi.DiscardItem();
serverCrew.ResetMission();
}
@ -514,7 +513,7 @@ namespace DDD.Npcs.Customers
{
StateMachineController.TransitionToState(UpsetState, this);
}
EventManager.InvokeServedCookToCustomer();
EventManager.InvokeServedCookToCustomer(IsServedPlayer);
EventManager.InvokeServedResult(this, IsOrderedCorrected);
//EventManager.InvokeSucceedServing(IsOrderedCorrected);
//EventManager.InvokeCheckedSkin(CustomerSkin);

View File

@ -79,9 +79,10 @@ namespace DDD.Players.Tycoons
public void OnDevelopKey01(InputAction.CallbackContext context)
{
#if UNITY_EDITOR
EventManager.InvokeCreateServerCrew();
EventManager.InvokeCreateCleanerCrew();
EventManager.InvokeCreateBartenderCrew();
EventManager.InvokeDevelopKey01();
// EventManager.InvokeCreateServerCrew();
// EventManager.InvokeCreateCleanerCrew();
// EventManager.InvokeCreateBartenderCrew();
#endif
}

View File

@ -68,6 +68,13 @@ namespace DDD.Players.Tycoons
[SerializeField]
private Vector3 _offset = new(0f, 1.5f, 0f);
[Title("연출")]
[SerializeField]
private Transform _restaurantSpawnLocation;
[SerializeField]
private Transform _favorabilitySpawnLocation;
public Material MaterialInstance { get; protected set; }
@ -116,6 +123,8 @@ namespace DDD.Players.Tycoons
// 밀키트 이벤트
EventManager.OnPickupMealKit += PickupCook;
EventManager.OnServedCookToCustomer += ServedCook;
EventManager.OnMoveRestaurant += MoveRestaurant;
EventManager.OnMoveFavorability += MoveFavorability;
TycoonMovement.OnSucceedDash += DashSucceed;
@ -151,6 +160,8 @@ namespace DDD.Players.Tycoons
// 밀키트 이벤트
EventManager.OnPickupMealKit -= PickupCook;
EventManager.OnServedCookToCustomer -= ServedCook;
EventManager.OnMoveRestaurant -= MoveRestaurant;
EventManager.OnMoveFavorability -= MoveFavorability;
TycoonMovement.OnSucceedDash -= DashSucceed;
}
@ -223,8 +234,10 @@ namespace DDD.Players.Tycoons
}
}
public void ServedCook()
public void ServedCook(bool isServedPlayer)
{
if (!isServedPlayer) return;
TycoonPickupHandler.DiscardCook();
InteractionCanvas.BalloonUi.DiscardItem();
}
@ -268,6 +281,20 @@ namespace DDD.Players.Tycoons
IsInteractedSlimeGarnish || IsInteractedLimeTreeGarnish || IsCookingFried || IsCookingStew;
}
public void Teleport(Vector3 position) => transform.position = position;
public void MoveRestaurant()
{
VisualLook.rotation = Quaternion.Euler(new Vector3(40f, 0f, 0f));
Teleport(_restaurantSpawnLocation.position);
}
public void MoveFavorability()
{
VisualLook.rotation = Quaternion.Euler(new Vector3(0f, 0f, 0f));
Teleport(_favorabilitySpawnLocation.position);
}
#endregion
}
}

View File

@ -34,7 +34,7 @@ namespace DDD
[SerializeField]
protected Transform SpawnLocation;
protected virtual void OnEnable()
protected virtual void Start()
{
SetCurrentHealthPoint(MaxHealthPoint);
}

View File

@ -28,15 +28,15 @@ namespace DDD
_spineController = GetComponent<SpineController>();
}
protected override void OnEnable()
protected override void Start()
{
base.OnEnable();
base.Start();
_spineController.PlayAnimation(_idleAnimationName, true);
}
private void OnTriggerEnter(Collider other)
{
if (!other.CompareTag("Player") || CurrentHealthPoint <= 0) return;
if (!other.CompareTag("Player") || CurrentHealthPoint <= 0 || string.IsNullOrEmpty(_touchAnimationName)) return;
Utils.StartUniqueCoroutine(this, ref _touchCoroutineInstance, TouchCoroutine());
}

View File

@ -33,6 +33,13 @@ namespace DDD.Tycoons
[SerializeField]
private List<Transform> _bartenderCrewSpawnTransforms = new(5);
[Title("벨 연출")]
[SerializeField]
private float _randomRadius = 5f;
[SerializeField]
private float _crewMinDistance = 0.5f;
[field: Title("실시간 데이터")]
[field: SerializeField]
@ -47,12 +54,15 @@ namespace DDD.Tycoons
[field: SerializeField]
public List<BartenderCrew> BartenderCrews { get; private set; }
private Coroutine _ringedBellInstance;
private void Start()
{
EventManager.OnCreateCleanerCrew += CreateCleanerCrew;
EventManager.OnCreateServerCrew += CreateServerCrew;
EventManager.OnCreateBartenderCrew += CreateBartenderCrew;
EventManager.OnOrderedCocktail += FindBartenderCrew;
EventManager.OnRingedBell += RingedBell;
}
private void OnDestroy()
@ -61,6 +71,7 @@ namespace DDD.Tycoons
EventManager.OnCreateServerCrew -= CreateServerCrew;
EventManager.OnCreateBartenderCrew -= CreateBartenderCrew;
EventManager.OnOrderedCocktail -= FindBartenderCrew;
EventManager.OnRingedBell -= RingedBell;
}
public CleanerCrew CreateCleanerCrew()
@ -71,11 +82,11 @@ namespace DDD.Tycoons
newCrew.Initialize();
EventManager.InvokeUpdateCrewUi(BartenderCrews.Count, ServerCrews.Count, CleanerCrews.Count);
if (!ES3.Load(SaveData.TutorialF, false))
{
EventManager.InvokeTutorial(TutorialName.TutorialF);
ES3.Save(SaveData.TutorialF, true);
}
// if (!ES3.Load(SaveData.TutorialF, false))
// {
// EventManager.InvokeTutorial(TutorialName.TutorialF);
// ES3.Save(SaveData.TutorialF, true);
// }
return newCrew;
}
@ -88,11 +99,11 @@ namespace DDD.Tycoons
newCrew.Initialize();
EventManager.InvokeUpdateCrewUi(BartenderCrews.Count, ServerCrews.Count, CleanerCrews.Count);
if (!ES3.Load(SaveData.TutorialD, false))
{
EventManager.InvokeTutorial(TutorialName.TutorialD);
ES3.Save(SaveData.TutorialD, true);
}
// if (!ES3.Load(SaveData.TutorialD, false))
// {
// EventManager.InvokeTutorial(TutorialName.TutorialD);
// ES3.Save(SaveData.TutorialD, true);
// }
return newCrew;
}
@ -110,11 +121,11 @@ namespace DDD.Tycoons
newCrew.Initialize();
EventManager.InvokeUpdateCrewUi(BartenderCrews.Count, ServerCrews.Count, CleanerCrews.Count);
if (!ES3.Load(SaveData.TutorialE, false))
{
EventManager.InvokeTutorial(TutorialName.TutorialE);
ES3.Save(SaveData.TutorialE, true);
}
// if (!ES3.Load(SaveData.TutorialE, false))
// {
// EventManager.InvokeTutorial(TutorialName.TutorialE);
// ES3.Save(SaveData.TutorialE, true);
// }
return newCrew;
}
@ -187,5 +198,64 @@ namespace DDD.Tycoons
yield return waitTime;
}
}
private void RingedBell(Vector3 bellPosition)
{
// bellPosition : 중심 위치
// randomRadius : 중심 위치로부터 최대 반지름
// crew 끼리 서로 겹치지 않는 거리를 나타내는 변수명 필요
List<Vector3> assignedPositions = new List<Vector3>();
foreach (Crew crew in Crews)
{
Vector3 movePosition = bellPosition;
bool validPositionFound = false;
int attempt = 0;
while (!validPositionFound && attempt < 1000)
{
// XZ 평면에서 랜덤한 점 생성 (Y는 고정)
Vector2 randomPoint = Random.insideUnitCircle * _randomRadius;
movePosition = bellPosition + new Vector3(randomPoint.x, 0, randomPoint.y);
if (!crew.AIMovement.IsPositionMovable(movePosition)) continue;
// 이전에 할당된 모든 위치와의 거리를 검사
validPositionFound = true;
foreach (Vector3 pos in assignedPositions)
{
if (Vector3.Distance(pos, movePosition) < _crewMinDistance)
{
validPositionFound = false;
break;
}
}
attempt++;
}
assignedPositions.Add(movePosition);
crew.RingedBell(movePosition);
}
Utils.StartUniqueCoroutine(this, ref _ringedBellInstance, RingedBellCoroutine());
}
private IEnumerator RingedBellCoroutine()
{
WaitForSeconds waitTime = new WaitForSeconds(1f);
while (Crews.Any(crew => !crew.HasReachedBell))
{
yield return waitTime;
}
yield return new WaitForSeconds(10f);
foreach (Crew crew in Crews)
{
crew.EndBell();
}
EventManager.InvokeEndedBell();
}
}
}

View File

@ -5,6 +5,7 @@ using System.Linq;
using DDD.Audios;
using DDD.Interfaces;
using DDD.Npcs.Customers;
using DDD.ScriptableObjects;
using DDD.Utility;
using Sirenix.OdinInspector;
using UnityEngine;
@ -142,13 +143,13 @@ namespace DDD.Tycoons
Utils.UnregisterList(InstanceCustomers, customer);
}
public Customer FindCustomerMatchingItem(IPickup servingTableItem)
public Customer FindCustomerMatchingItem(CraftRecipeData servingTableItem)
{
foreach (var element in InstanceCustomers)
{
if (!element || element.IsReceivedItem || element.IsMatchedServer) continue;
if (servingTableItem.Idx != element.OrderedCocktailData.Idx) continue;
if (servingTableItem.Idx != element.OrderedCraftRecipeData.Idx) continue;
return element;
}

View File

@ -14,12 +14,12 @@ namespace DDD.Tycoons
private void Awake()
{
//_servingTables = _servingTableRoot.GetComponentsInChildren<ServingTable>().ToList();
_servingTables = _servingTableRoot.GetComponentsInChildren<ServingTable>().ToList();
}
// public ServingTable FindEmptyServingTable()
// {
// return _servingTables.FirstOrDefault(element => element.CurrentPickupItem == null);
// }
public ServingTable FindEmptyServingTable()
{
return _servingTables.FirstOrDefault(element => element.CurrentCraftRecipeData == null);
}
}
}

View File

@ -10,7 +10,7 @@ namespace DDD
public enum TycoonCameraType
{
Base = 0,
Storage
Favorability
}
public class TycoonCameraManager : Singleton<TycoonCameraManager>
@ -35,7 +35,7 @@ namespace DDD
public CinemachineCamera BaseCamera { get; private set; }
[field: SerializeField]
public CinemachineCamera StorageCamera { get; private set; }
public CinemachineCamera FavorabilityCamera { get; private set; }
[SerializeField]
private Transform _confinerCollider;
@ -61,6 +61,8 @@ namespace DDD
[SerializeField]
private Vector3 _zoomInConfinerScale = new(10f, 10f, 10f);
private TycoonCameraType _currentTycoonCameraType;
// Variables
private CinemachineBrain _cinemachineBrain;
@ -88,6 +90,9 @@ namespace DDD
private void Start()
{
EventManager.OnMoveRestaurant += MoveRestaurant;
EventManager.OnMoveFavorability += MoveFavorability;
_zoomInAction = PlayerInputKeyManager.Instance.GetAction(InputActionMaps.Tycoon, TycoonActions.ZoomIn);
_zoomOutAction = PlayerInputKeyManager.Instance.GetAction(InputActionMaps.Tycoon, TycoonActions.ZoomOut);
@ -102,6 +107,8 @@ namespace DDD
private void LateUpdate()
{
if (_currentTycoonCameraType != TycoonCameraType.Base) return;
var lerpTime = Time.deltaTime * _zoomLerpSpeed;
_baseCameraComposer.CameraDistance = Mathf.Lerp(
_baseCameraComposer.CameraDistance,
@ -119,6 +126,9 @@ namespace DDD
private void OnDestroy()
{
EventManager.OnMoveRestaurant -= MoveRestaurant;
EventManager.OnMoveFavorability -= MoveFavorability;
_zoomInAction.performed -= OnZoomChanged;
_zoomOutAction.performed -= OnZoomChanged;
_zoomInAction.canceled -= OnZoomChanged;
@ -137,16 +147,12 @@ namespace DDD
MainCamera = GetComponent<Camera>();
UiCamera = MainCamera.transform.Find("UiCamera").GetComponent<Camera>();
LiquidOverlayCamera = GameObject.Find("LiquidOverlayCamera").GetComponent<Camera>();
_cinemachineBrain = GetComponent<CinemachineBrain>();
BaseCamera = cameraLocation.Find("BaseCamera").GetComponent<CinemachineCamera>();
StorageCamera = cameraLocation.Find("StorageCamera").GetComponent<CinemachineCamera>();
_cinemachineBrain = GetComponent<CinemachineBrain>();
_baseCameraComposer = BaseCamera.GetComponent<CinemachinePositionComposer>();
_cinemachineCameras.Add(BaseCamera);
_cinemachineCameras.Add(StorageCamera);
_cinemachineCameras.Add(FavorabilityCamera);
SetMainCamera(TycoonCameraType.Base);
}
@ -166,7 +172,7 @@ namespace DDD
var newMainCamera = tycoonCameraType switch
{
TycoonCameraType.Base => BaseCamera,
TycoonCameraType.Storage => StorageCamera,
TycoonCameraType.Favorability => FavorabilityCamera,
_ => throw new ArgumentOutOfRangeException(nameof(tycoonCameraType), tycoonCameraType, null)
};
@ -174,7 +180,8 @@ namespace DDD
{
element.Priority = 0;
}
_currentTycoonCameraType = tycoonCameraType;
newMainCamera.Priority = 1;
SetTransparencySortAxis();
}
@ -188,6 +195,8 @@ namespace DDD
private void OnZoomChanged(InputAction.CallbackContext context)
{
if (_currentTycoonCameraType != TycoonCameraType.Base) return;
var zoomDirection = _zoomOutAction.ReadValue<float>() - _zoomInAction.ReadValue<float>();
_targetCameraDistance = Mathf.Clamp(
_targetCameraDistance + zoomDirection * _zoomPower,
@ -200,6 +209,18 @@ namespace DDD
{
return _baseCameraComposer.CameraDistance;
}
public void MoveRestaurant()
{
_cinemachineBrain.DefaultBlend = new CinemachineBlendDefinition(CinemachineBlendDefinition.Styles.Cut, 0f);
SetMainCamera(TycoonCameraType.Base);
}
public void MoveFavorability()
{
_cinemachineBrain.DefaultBlend = new CinemachineBlendDefinition(CinemachineBlendDefinition.Styles.Cut, 0f);
SetMainCamera(TycoonCameraType.Favorability);
}
#endregion
}

View File

@ -26,12 +26,12 @@ namespace DDD.BehaviorTrees.Actions
return TaskStatus.Success;
}
// var emptyServingTable = tycoonManager.ServingTableController.FindEmptyServingTable();
// if (emptyServingTable)
// {
// _serverCrew.OnMission(emptyServingTable, null, ActionType.PlaceOnServingTable);
// return TaskStatus.Success;
// }
var emptyServingTable = tycoonManager.ServingTableController.FindEmptyServingTable();
if (emptyServingTable)
{
_serverCrew.OnMission(emptyServingTable, null, ActionType.PlaceOnServingTable);
return TaskStatus.Success;
}
return TaskStatus.Running;
}

View File

@ -0,0 +1,34 @@
using BehaviorDesigner.Runtime.Tasks;
using DDD.Npcs.Crews;
namespace DDD.BehaviorTrees.Actions
{
[TaskCategory("Custom/Npc/Crew")]
public class RingedBell : Action
{
private Crew _crew;
public override void OnAwake()
{
_crew = GetComponent<Crew>();
}
public override void OnStart()
{
_crew.MoveBell();
}
public override TaskStatus OnUpdate()
{
if (!_crew.AIMovement.HasReachedDestination()) return TaskStatus.Running;
if (!_crew.HasReachedBell)
{
_crew.ReachedBell();
return TaskStatus.Running;
}
return !_crew.IsRingedBell ? TaskStatus.Success : TaskStatus.Running;
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 400da2b4dbc83e0408113be34920ac9e

View File

@ -0,0 +1,21 @@
using BehaviorDesigner.Runtime.Tasks;
using DDD.Npcs.Crews;
namespace DDD.BehaviorTrees.Actions
{
[TaskCategory("Custom/Npc/Crew")]
public class CheckIsRingedBell : Conditional
{
private Crew _crew;
public override void OnAwake()
{
_crew = GetComponent<Crew>();
}
public override TaskStatus OnUpdate()
{
return _crew.IsRingedBell ? TaskStatus.Success : TaskStatus.Failure;
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d1db7f6bfbf4b9d4ca6fa7ddf0a2c9a1

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 1902cfa1c13c67143acedbd6e44d193d
guid: c38d381ce35295242b2f6d22afe963b8
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 4d2cbbe89b1868d40a4a855db56f263b
guid: b74661fe4b394c24c88964d7302b5967
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -0,0 +1,42 @@
using System;
namespace DDD.Tycoons
{
[Serializable]
public class Bell : InteractionFurniture
{
private bool _activatedBell;
protected override void Start()
{
base.Start();
EventManager.OnEndedBell += EndBell;
HoldingAction = RingedBell;
}
protected override void OnDestroy()
{
base.OnDestroy();
EventManager.OnEndedBell -= EndBell;
}
public override bool CanInteraction()
{
return !_activatedBell;
}
public void RingedBell()
{
_activatedBell = true;
EventManager.InvokeRingedBell(transform.position);
}
private void EndBell()
{
_activatedBell = false;
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 7524809488195db4bbfb7973c4ed5193

View File

@ -0,0 +1,83 @@
using System;
using System.Threading.Tasks;
using DDD.ScriptableObjects;
using Sirenix.OdinInspector;
using UnityEngine;
namespace DDD.Tycoons
{
[Serializable]
public class Cutter : InteractionFurniture
{
[Title("연출")]
[SerializeField]
private Color _enableColor = Color.white;
[SerializeField]
private Color _disableColor = Color.gray;
private Material _instanceMaterial;
private CraftingTool _craftingTool = CraftingTool.Cutter;
protected override void Start()
{
base.Start();
HoldingAction = SuccessHoldingAction;
_instanceMaterial = VisualLook.material;
VisualLook.material = Instantiate(_instanceMaterial);
EventManager.OnChangedCraftingTool += ChangeColor;
}
protected override void OnDestroy()
{
base.OnDestroy();
EventManager.OnChangedCraftingTool -= ChangeColor;
}
public override void Interaction()
{
base.Interaction();
// GameManager.Instance.CurrentTycoonPlayer.IsCookingStew = true;
}
public override void CancelInteraction()
{
base.CancelInteraction();
// GameManager.Instance.CurrentTycoonPlayer.IsCookingStew = false;
}
public override bool CanInteraction()
{
CraftRecipeData playerCraftRecipeData = CurrentTycoonPlayer.TycoonPickupHandler.CurrentCraftRecipeData;
if (playerCraftRecipeData == null || playerCraftRecipeData.CraftingToolQueue.Count <= 0) return false;
CraftingTool playerCraftingTool = playerCraftRecipeData.CraftingToolQueue.Peek();
return IsOpened && playerCraftingTool == _craftingTool;
}
private void SuccessHoldingAction()
{
CurrentTycoonPlayer.TycoonPickupHandler.InteractionCraftingTool();
CancelInteraction();
}
private async void ChangeColor(CraftingTool? playerCraftingTool)
{
await Task.Delay(100);
if (playerCraftingTool == null)
{
VisualLook.material.color = _enableColor;
}
else
{
VisualLook.material.color = (CraftingTool)playerCraftingTool == _craftingTool ? _enableColor : _disableColor;
}
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: b0cbf7831b99a2f4da423c0a7e5cd7fa

View File

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Threading.Tasks;
using DDD.ScriptableObjects;
using Sirenix.OdinInspector;
@ -8,7 +7,7 @@ using UnityEngine;
namespace DDD.Tycoons
{
[Serializable]
public class Frying : InteractionFurniture
public class Fryer : InteractionFurniture
{
[SerializeField]
private AnimationController _animationController;
@ -21,7 +20,7 @@ namespace DDD.Tycoons
private Color _disableColor = Color.gray;
private Material _instanceMaterial;
private CraftingTool _craftingTool = CraftingTool.Frying;
private CraftingTool _craftingTool = CraftingTool.Fryer;
private const string IsEnabledHash = "isEnabled";
@ -48,7 +47,7 @@ namespace DDD.Tycoons
base.Interaction();
GameManager.Instance.CurrentTycoonPlayer.IsCookingFried = true;
//_animationController.SetAnimationParameter(IsEnabledHash, true);
_animationController.SetAnimationParameter(IsEnabledHash, true);
}
public override void CancelInteraction()
@ -56,7 +55,7 @@ namespace DDD.Tycoons
base.CancelInteraction();
GameManager.Instance.CurrentTycoonPlayer.IsCookingFried = false;
//_animationController.SetAnimationParameter(IsEnabledHash, false);
_animationController.SetAnimationParameter(IsEnabledHash, false);
}
public override bool CanInteraction()

View File

@ -0,0 +1,83 @@
using System;
using System.Threading.Tasks;
using DDD.ScriptableObjects;
using Sirenix.OdinInspector;
using UnityEngine;
namespace DDD.Tycoons
{
[Serializable]
public class Plater : InteractionFurniture
{
[Title("연출")]
[SerializeField]
private Color _enableColor = Color.white;
[SerializeField]
private Color _disableColor = Color.gray;
private Material _instanceMaterial;
private CraftingTool _craftingTool = CraftingTool.Plater;
protected override void Start()
{
base.Start();
HoldingAction = SuccessHoldingAction;
_instanceMaterial = VisualLook.material;
VisualLook.material = Instantiate(_instanceMaterial);
EventManager.OnChangedCraftingTool += ChangeColor;
}
protected override void OnDestroy()
{
base.OnDestroy();
EventManager.OnChangedCraftingTool -= ChangeColor;
}
public override void Interaction()
{
base.Interaction();
// GameManager.Instance.CurrentTycoonPlayer.IsCookingStew = true;
}
public override void CancelInteraction()
{
base.CancelInteraction();
// GameManager.Instance.CurrentTycoonPlayer.IsCookingStew = false;
}
public override bool CanInteraction()
{
CraftRecipeData playerCraftRecipeData = CurrentTycoonPlayer.TycoonPickupHandler.CurrentCraftRecipeData;
if (playerCraftRecipeData == null || playerCraftRecipeData.CraftingToolQueue.Count <= 0) return false;
CraftingTool playerCraftingTool = playerCraftRecipeData.CraftingToolQueue.Peek();
return IsOpened && playerCraftingTool == _craftingTool;
}
private void SuccessHoldingAction()
{
CurrentTycoonPlayer.TycoonPickupHandler.InteractionCraftingTool();
CancelInteraction();
}
private async void ChangeColor(CraftingTool? playerCraftingTool)
{
await Task.Delay(100);
if (playerCraftingTool == null)
{
VisualLook.material.color = _enableColor;
}
else
{
VisualLook.material.color = (CraftingTool)playerCraftingTool == _craftingTool ? _enableColor : _disableColor;
}
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 6632535b88c8c634e891af877547eaf7

View File

@ -1,11 +1,192 @@
using System;
using System.Collections;
using System.Collections.Generic;
using DDD.Audios;
using DDD.Interfaces;
using DDD.Npcs.Crews;
using DDD.Npcs.Crews.Server;
using DDD.Npcs.Customers;
using DDD.ScriptableObjects;
using DDD.Utility;
using UnityEngine;
namespace DDD.Tycoons
{
public class ServingTable : MonoBehaviour
public class ServingTable : InteractionFurniture, ICrewInteraction
{
[field: SerializeField]
public List<ServingTableSeat> ServingTableSeats { get; private set; } = new(2);
[SerializeField]
private SpriteRenderer _itemSpriteRenderer;
[SerializeField]
private List<SpriteRenderer> _outlineRenderers = new();
[SerializeField]
private string _putDownSfxName = "PutDownCocktail";
private CraftRecipeData _currentCraftRecipeData;
public CraftRecipeData CurrentCraftRecipeData
{
get => _currentCraftRecipeData;
private set
{
_currentCraftRecipeData = value;
if (_currentCraftRecipeData != null)
{
Utils.StartUniqueCoroutine(this, ref _findCustomerMatchingItemInstance, FindCustomerMatchingItem());
}
else
{
if (_findCustomerMatchingItemInstance != null)
{
StopCoroutine(_findCustomerMatchingItemInstance);
_findCustomerMatchingItemInstance = null;
}
if (_findServerCrewInstance != null)
{
StopCoroutine(_findServerCrewInstance);
_findServerCrewInstance = null;
}
}
}
}
private Customer _orderedCustomer;
private List<Material> _originalMaterials;
private Coroutine _findCustomerMatchingItemInstance;
private Coroutine _findServerCrewInstance;
public event Action OnInteractionCompleted;
protected override void Awake()
{
base.Awake();
_itemSpriteRenderer.sprite = null;
_itemSpriteRenderer.enabled = false;
_originalMaterials = new List<Material>(_outlineRenderers.Count);
for (int i = 0; i < _outlineRenderers.Count; i++)
{
_originalMaterials.Add(_outlineRenderers[i].material);
}
}
public override void Interaction()
{
// 테이블의 칵테일을 가져가는 경우
if (CurrentCraftRecipeData != null)
{
CurrentTycoonPlayer.PickupCook(CurrentCraftRecipeData);
_itemSpriteRenderer.sprite = null;
_itemSpriteRenderer.enabled = false;
CurrentCraftRecipeData = null;
}
// 테이블에 칵테일을 놓는 경우
else
{
AudioManager.Instance.PlaySfx(_putDownSfxName);
CurrentCraftRecipeData = CurrentTycoonPlayer.TycoonPickupHandler.CurrentCraftRecipeData;
_itemSpriteRenderer.sprite = CurrentCraftRecipeData.Sprite;
_itemSpriteRenderer.enabled = true;
CurrentTycoonPlayer.ServedCook(true);
}
}
public override bool CanInteraction()
{
// 1. 테이블에 음식이 있고, 플레이어가 음식을 들고 있지 않은 경우
// 2. 테이블에 음식이 없고, 플레이어가 음식을 들고 있는 경우
return (CurrentCraftRecipeData != null && !CurrentTycoonPlayer.TycoonPickupHandler.IsPickedUpCook) ||
(CurrentCraftRecipeData == null && CurrentTycoonPlayer.TycoonPickupHandler.IsPickedUpCook);
}
public override void ShowInteractionUi()
{
if (CurrentCraftRecipeData != null)
{
InteractionMessage = Utils.GetLocalizedString("Action002");
}
else
{
InteractionMessage = Utils.GetLocalizedString("Action003");
}
base.ShowInteractionUi();
for (int i = 0; i < _outlineRenderers.Count; i++)
{
_outlineRenderers[i].material = OutlineMaterial;
}
}
public override void HideInteractionUi()
{
base.HideInteractionUi();
for (int i = 0; i < _outlineRenderers.Count; i++)
{
_outlineRenderers[i].material = _originalMaterials[i];
}
}
public void InteractionCrew(Crew crew)
{
// 종업원이 테이블의 칵테일을 가져가는 경우
if (CurrentCraftRecipeData != null)
{
var serverCrew = (ServerCrew)crew;
serverCrew.TakeFromServingTable(CurrentCraftRecipeData, _orderedCustomer);
_itemSpriteRenderer.enabled = false;
// InteractionCanvas.BalloonUi.DiscardItem();
CurrentCraftRecipeData = null;
_orderedCustomer = null;
}
// 종업원이 테이블에 칵테일을 놓는 경우
else
{
var serverCrew = (ServerCrew)crew;
CurrentCraftRecipeData = serverCrew.CurrentPickupItem;
_itemSpriteRenderer.sprite = CurrentCraftRecipeData.Sprite;
_itemSpriteRenderer.enabled = true;
// InteractionCanvas.BalloonUi.SetItemImage(CurrentPickupItem);
serverCrew.ResetMission();
}
}
public void CancelInteractionCrew()
{
throw new NotImplementedException();
}
public bool CanInteractionCrew(Crew crew = null)
{
var servingCrew = (ServerCrew)crew;
if (!servingCrew)
{
throw new Exception("상호작용 오브젝트 오류");
}
return (servingCrew.CurrentActionType == ActionType.TakeCocktail && CurrentCraftRecipeData != null && _orderedCustomer) ||
servingCrew.CurrentActionType == ActionType.PlaceOnServingTable && CurrentCraftRecipeData == null;
}
private IEnumerator FindCustomerMatchingItem()
{
var waitTime = new WaitForSeconds(2f);
while (true)
{
_orderedCustomer = TycoonManager.Instance.CustomerController.FindCustomerMatchingItem(CurrentCraftRecipeData);
if (_orderedCustomer && _orderedCustomer.CanInteractionCrew())
{
var crewController = TycoonManager.Instance.CrewController;
Utils.StartUniqueCoroutine(this, ref _findServerCrewInstance,
crewController.FindClosestCrewCoroutine(CenterTransform.position, crewController.ServerCrews,
crew => crew.OnMission(this, _orderedCustomer, ActionType.TakeCocktail)));
}
yield return waitTime;
}
}
}
}

View File

@ -1,2 +1,2 @@
fileFormatVersion: 2
guid: 2260638226a46a7449ce75e44fbc33f0
guid: d627e8f515556f74eb5297b0bec9819c

View File

@ -1,93 +0,0 @@
using System.Collections.Generic;
using DDD.Audios;
using DDD.ScriptableObjects;
using DDD.Utility;
using UnityEngine;
namespace DDD.Tycoons
{
public class ServingTableSeat : InteractionFurniture
{
[SerializeField]
private List<SpriteRenderer> _outlineRenderers = new();
[SerializeField]
private string _putDownSfxName = "PutDownCocktail";
public CraftRecipeData CurrentCraftRecipeData { get; private set; }
private List<Material> _originalMaterials;
protected override void Awake()
{
base.Awake();
VisualLook.sprite = null;
VisualLook.enabled = false;
_originalMaterials = new List<Material>(_outlineRenderers.Count);
for (int i = 0; i < _outlineRenderers.Count; i++)
{
_originalMaterials.Add(_outlineRenderers[i].material);
}
}
public override void Interaction()
{
// 테이블의 칵테일을 가져가는 경우
if (CurrentCraftRecipeData != null)
{
CurrentTycoonPlayer.PickupCook(CurrentCraftRecipeData);
VisualLook.sprite = null;
VisualLook.enabled = false;
CurrentCraftRecipeData = null;
}
// 테이블에 칵테일을 놓는 경우
else
{
AudioManager.Instance.PlaySfx(_putDownSfxName);
CurrentCraftRecipeData = CurrentTycoonPlayer.TycoonPickupHandler.CurrentCraftRecipeData;
VisualLook.sprite = CurrentCraftRecipeData.Sprite;
VisualLook.enabled = true;
CurrentTycoonPlayer.ServedCook();
}
}
public override bool CanInteraction()
{
// 1. 테이블에 음식이 있고, 플레이어가 음식을 들고 있지 않은 경우
// 2. 테이블에 음식이 없고, 플레이어가 음식을 들고 있는 경우
return (CurrentCraftRecipeData != null && !CurrentTycoonPlayer.TycoonPickupHandler.IsPickedUpCook) ||
(CurrentCraftRecipeData == null && CurrentTycoonPlayer.TycoonPickupHandler.IsPickedUpCook);
}
public override void ShowInteractionUi()
{
if (CurrentCraftRecipeData != null)
{
InteractionMessage = Utils.GetLocalizedString("InteractionServingTablePickUp");
}
else
{
InteractionMessage = Utils.GetLocalizedString("InteractionServingTablePutDown");
}
base.ShowInteractionUi();
for (int i = 0; i < _outlineRenderers.Count; i++)
{
_outlineRenderers[i].material = OutlineMaterial;
}
}
public override void HideInteractionUi()
{
base.HideInteractionUi();
for (int i = 0; i < _outlineRenderers.Count; i++)
{
_outlineRenderers[i].material = _originalMaterials[i];
}
}
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: d627e8f515556f74eb5297b0bec9819c

View File

@ -225,9 +225,9 @@ namespace DDD.Tycoons
InteractionCanvas.BalloonUi.OrderItem(0, TycoonManager.Instance.TycoonStageController.StageDataSo.DirtyTableWaitTime);
IsCleaned = false;
// var crewController = TycoonManager.Instance.CrewController;
// Utils.StartUniqueCoroutine(this, ref _findCleanerCrewInstance,
// crewController.FindClosestCrewCoroutine(CenterTransform.position, crewController.CleanerCrews, crew => crew.OnMission(this)));
var crewController = TycoonManager.Instance.CrewController;
Utils.StartUniqueCoroutine(this, ref _findCleanerCrewInstance,
crewController.FindClosestCrewCoroutine(CenterTransform.position, crewController.CleanerCrews, crew => crew.OnMission(this)));
}
public void Purify()

View File

@ -15,10 +15,10 @@ namespace DDD.ScriptableObjects
/// </summary>
public enum CraftingTool
{
Cutting = 1,
Cutter = 1,
Pot = 2,
Frying = 3,
Plating = 4
Fryer = 3,
Plater = 4
}
[Serializable]

View File

@ -0,0 +1,57 @@
using UnityEngine;
public class DevelopmentUi : MonoBehaviour
{
[SerializeField]
private GameObject _panel;
private void Awake()
{
HideUi();
}
private void Start()
{
EventManager.OnDevelopKey01 += SwitchSetActive;
}
private void OnDestroy()
{
EventManager.OnDevelopKey01 -= SwitchSetActive;
}
public void MoveRestaurant()
{
EventManager.InvokeMoveRestaurant();
}
public void MoveFavorability()
{
EventManager.InvokeMoveFavorability();
}
public void CreateServer()
{
EventManager.InvokeCreateServerCrew();
}
public void CreateCleaner()
{
EventManager.InvokeCreateCleanerCrew();
}
public void SwitchSetActive()
{
if (_panel.activeInHierarchy)
{
HideUi();
}
else
{
ShowUi();
}
}
public void ShowUi() => _panel.SetActive(true);
public void HideUi() => _panel.SetActive(false);
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: df04175693fb68d41868138b3ba186e2

View File

@ -16,6 +16,24 @@ public static class EventManager
#region Global events
public static Action OnDevelopKey01;
public static void InvokeDevelopKey01()
{
OnDevelopKey01?.Invoke();
}
public static Action OnMoveRestaurant;
public static void InvokeMoveRestaurant()
{
OnMoveRestaurant?.Invoke();
}
public static Action OnMoveFavorability;
public static void InvokeMoveFavorability()
{
OnMoveFavorability?.Invoke();
}
public static Action OnChangedDisplay;
public static void InvokeChangedDisplay()
@ -466,10 +484,10 @@ public static class EventManager
}
// 손님이 음식을 받을때 이벤트
public static Action OnServedCookToCustomer;
public static void InvokeServedCookToCustomer()
public static Action<bool> OnServedCookToCustomer;
public static void InvokeServedCookToCustomer(bool isServedPlayer)
{
OnServedCookToCustomer?.Invoke();
OnServedCookToCustomer?.Invoke(isServedPlayer);
}
// 손님이 음식을 받을때 결과 이벤트
@ -479,5 +497,19 @@ public static class EventManager
OnServedResult?.Invoke(orderedCustomer, orderedCorrected);
}
// 벨을 상호작용 할 때 이벤트
public static Action<Vector3> OnRingedBell;
public static void InvokeRingedBell(Vector3 bellPosition)
{
OnRingedBell?.Invoke(bellPosition);
}
// 벨 이벤트가 끝날 때 이벤트
public static Action OnEndedBell;
public static void InvokeEndedBell()
{
OnEndedBell?.Invoke();
}
#endregion
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: ef3a3e26179735a43b88e2db390073df
guid: 696bf3142b2f2ab40a694fad42e4d5bc
TextureImporter:
internalIDToNameTable: []
externalObjects: {}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: d469e97b670e5c24088dc6a602f1cad6
guid: 53b9d7844b0954947a820907737fc799
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Some files were not shown because too many files have changed in this diff Show More