타이쿤 업데이트

This commit is contained in:
NTG_Lenovo 2025-02-24 20:55:35 +09:00
parent 72b3db3d3e
commit 88987df67d
123 changed files with 5144 additions and 3060 deletions

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 ICrewInteraction CrewInteraction { get; protected set; }
public bool IsOnMission { 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 IAstarAI _astarAi;
private Transform _spawnTransform; private Transform _spawnTransform;
private Vector3 _bellPosition;
#endregion #endregion
@ -193,6 +196,29 @@ namespace DDD.Npcs.Crews
CrewInteraction.InteractionRadius; 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 #endregion
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -28,9 +28,9 @@ namespace DDD
_spineController = GetComponent<SpineController>(); _spineController = GetComponent<SpineController>();
} }
protected override void OnEnable() protected override void Start()
{ {
base.OnEnable(); base.Start();
_spineController.PlayAnimation(_idleAnimationName, true); _spineController.PlayAnimation(_idleAnimationName, true);
} }

View File

@ -33,6 +33,13 @@ namespace DDD.Tycoons
[SerializeField] [SerializeField]
private List<Transform> _bartenderCrewSpawnTransforms = new(5); private List<Transform> _bartenderCrewSpawnTransforms = new(5);
[Title("벨 연출")]
[SerializeField]
private float _randomRadius = 5f;
[SerializeField]
private float _crewMinDistance = 0.5f;
[field: Title("실시간 데이터")] [field: Title("실시간 데이터")]
[field: SerializeField] [field: SerializeField]
@ -47,12 +54,15 @@ namespace DDD.Tycoons
[field: SerializeField] [field: SerializeField]
public List<BartenderCrew> BartenderCrews { get; private set; } public List<BartenderCrew> BartenderCrews { get; private set; }
private Coroutine _ringedBellInstance;
private void Start() private void Start()
{ {
EventManager.OnCreateCleanerCrew += CreateCleanerCrew; EventManager.OnCreateCleanerCrew += CreateCleanerCrew;
EventManager.OnCreateServerCrew += CreateServerCrew; EventManager.OnCreateServerCrew += CreateServerCrew;
EventManager.OnCreateBartenderCrew += CreateBartenderCrew; EventManager.OnCreateBartenderCrew += CreateBartenderCrew;
EventManager.OnOrderedCocktail += FindBartenderCrew; EventManager.OnOrderedCocktail += FindBartenderCrew;
EventManager.OnRingedBell += RingedBell;
} }
private void OnDestroy() private void OnDestroy()
@ -61,6 +71,7 @@ namespace DDD.Tycoons
EventManager.OnCreateServerCrew -= CreateServerCrew; EventManager.OnCreateServerCrew -= CreateServerCrew;
EventManager.OnCreateBartenderCrew -= CreateBartenderCrew; EventManager.OnCreateBartenderCrew -= CreateBartenderCrew;
EventManager.OnOrderedCocktail -= FindBartenderCrew; EventManager.OnOrderedCocktail -= FindBartenderCrew;
EventManager.OnRingedBell -= RingedBell;
} }
public CleanerCrew CreateCleanerCrew() public CleanerCrew CreateCleanerCrew()
@ -71,11 +82,11 @@ namespace DDD.Tycoons
newCrew.Initialize(); newCrew.Initialize();
EventManager.InvokeUpdateCrewUi(BartenderCrews.Count, ServerCrews.Count, CleanerCrews.Count); EventManager.InvokeUpdateCrewUi(BartenderCrews.Count, ServerCrews.Count, CleanerCrews.Count);
if (!ES3.Load(SaveData.TutorialF, false)) // if (!ES3.Load(SaveData.TutorialF, false))
{ // {
EventManager.InvokeTutorial(TutorialName.TutorialF); // EventManager.InvokeTutorial(TutorialName.TutorialF);
ES3.Save(SaveData.TutorialF, true); // ES3.Save(SaveData.TutorialF, true);
} // }
return newCrew; return newCrew;
} }
@ -88,11 +99,11 @@ namespace DDD.Tycoons
newCrew.Initialize(); newCrew.Initialize();
EventManager.InvokeUpdateCrewUi(BartenderCrews.Count, ServerCrews.Count, CleanerCrews.Count); EventManager.InvokeUpdateCrewUi(BartenderCrews.Count, ServerCrews.Count, CleanerCrews.Count);
if (!ES3.Load(SaveData.TutorialD, false)) // if (!ES3.Load(SaveData.TutorialD, false))
{ // {
EventManager.InvokeTutorial(TutorialName.TutorialD); // EventManager.InvokeTutorial(TutorialName.TutorialD);
ES3.Save(SaveData.TutorialD, true); // ES3.Save(SaveData.TutorialD, true);
} // }
return newCrew; return newCrew;
} }
@ -110,11 +121,11 @@ namespace DDD.Tycoons
newCrew.Initialize(); newCrew.Initialize();
EventManager.InvokeUpdateCrewUi(BartenderCrews.Count, ServerCrews.Count, CleanerCrews.Count); EventManager.InvokeUpdateCrewUi(BartenderCrews.Count, ServerCrews.Count, CleanerCrews.Count);
if (!ES3.Load(SaveData.TutorialE, false)) // if (!ES3.Load(SaveData.TutorialE, false))
{ // {
EventManager.InvokeTutorial(TutorialName.TutorialE); // EventManager.InvokeTutorial(TutorialName.TutorialE);
ES3.Save(SaveData.TutorialE, true); // ES3.Save(SaveData.TutorialE, true);
} // }
return newCrew; return newCrew;
} }
@ -187,5 +198,64 @@ namespace DDD.Tycoons
yield return waitTime; 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.Audios;
using DDD.Interfaces; using DDD.Interfaces;
using DDD.Npcs.Customers; using DDD.Npcs.Customers;
using DDD.ScriptableObjects;
using DDD.Utility; using DDD.Utility;
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
using UnityEngine; using UnityEngine;
@ -142,13 +143,13 @@ namespace DDD.Tycoons
Utils.UnregisterList(InstanceCustomers, customer); Utils.UnregisterList(InstanceCustomers, customer);
} }
public Customer FindCustomerMatchingItem(IPickup servingTableItem) public Customer FindCustomerMatchingItem(CraftRecipeData servingTableItem)
{ {
foreach (var element in InstanceCustomers) foreach (var element in InstanceCustomers)
{ {
if (!element || element.IsReceivedItem || element.IsMatchedServer) continue; if (!element || element.IsReceivedItem || element.IsMatchedServer) continue;
if (servingTableItem.Idx != element.OrderedCocktailData.Idx) continue; if (servingTableItem.Idx != element.OrderedCraftRecipeData.Idx) continue;
return element; return element;
} }

View File

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

View File

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

View File

@ -26,12 +26,12 @@ namespace DDD.BehaviorTrees.Actions
return TaskStatus.Success; return TaskStatus.Success;
} }
// var emptyServingTable = tycoonManager.ServingTableController.FindEmptyServingTable(); var emptyServingTable = tycoonManager.ServingTableController.FindEmptyServingTable();
// if (emptyServingTable) if (emptyServingTable)
// { {
// _serverCrew.OnMission(emptyServingTable, null, ActionType.PlaceOnServingTable); _serverCrew.OnMission(emptyServingTable, null, ActionType.PlaceOnServingTable);
// return TaskStatus.Success; return TaskStatus.Success;
// } }
return TaskStatus.Running; 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 fileFormatVersion: 2
guid: 72098c548ee979a4db4104f58e9d9657 guid: c38d381ce35295242b2f6d22afe963b8
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 4d2cbbe89b1868d40a4a855db56f263b guid: 74b25efeacf2e3848aa1b38d2ca181f1
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} 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

@ -1,12 +1,18 @@
using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using DDD.Audios; using DDD.Audios;
using DDD.Interfaces;
using DDD.Npcs.Crews;
using DDD.Npcs.Crews.Server;
using DDD.Npcs.Customers;
using DDD.ScriptableObjects; using DDD.ScriptableObjects;
using DDD.Utility; using DDD.Utility;
using UnityEngine; using UnityEngine;
namespace DDD.Tycoons namespace DDD.Tycoons
{ {
public class ServingTable : InteractionFurniture public class ServingTable : InteractionFurniture, ICrewInteraction
{ {
[SerializeField] [SerializeField]
private SpriteRenderer _itemSpriteRenderer; private SpriteRenderer _itemSpriteRenderer;
@ -16,10 +22,41 @@ namespace DDD.Tycoons
[SerializeField] [SerializeField]
private string _putDownSfxName = "PutDownCocktail"; private string _putDownSfxName = "PutDownCocktail";
public CraftRecipeData CurrentCraftRecipeData { get; private set; }
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 List<Material> _originalMaterials;
private Coroutine _findCustomerMatchingItemInstance;
private Coroutine _findServerCrewInstance;
public event Action OnInteractionCompleted;
protected override void Awake() protected override void Awake()
{ {
@ -52,7 +89,7 @@ namespace DDD.Tycoons
CurrentCraftRecipeData = CurrentTycoonPlayer.TycoonPickupHandler.CurrentCraftRecipeData; CurrentCraftRecipeData = CurrentTycoonPlayer.TycoonPickupHandler.CurrentCraftRecipeData;
_itemSpriteRenderer.sprite = CurrentCraftRecipeData.Sprite; _itemSpriteRenderer.sprite = CurrentCraftRecipeData.Sprite;
_itemSpriteRenderer.enabled = true; _itemSpriteRenderer.enabled = true;
CurrentTycoonPlayer.ServedCook(); CurrentTycoonPlayer.ServedCook(true);
} }
} }
@ -92,5 +129,64 @@ namespace DDD.Tycoons
_outlineRenderers[i].material = _originalMaterials[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

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

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 #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 Action OnChangedDisplay;
public static void InvokeChangedDisplay() public static void InvokeChangedDisplay()
@ -466,10 +484,10 @@ public static class EventManager
} }
// 손님이 음식을 받을때 이벤트 // 손님이 음식을 받을때 이벤트
public static Action OnServedCookToCustomer; public static Action<bool> OnServedCookToCustomer;
public static void InvokeServedCookToCustomer() public static void InvokeServedCookToCustomer(bool isServedPlayer)
{ {
OnServedCookToCustomer?.Invoke(); OnServedCookToCustomer?.Invoke(isServedPlayer);
} }
// 손님이 음식을 받을때 결과 이벤트 // 손님이 음식을 받을때 결과 이벤트
@ -479,5 +497,19 @@ public static class EventManager
OnServedResult?.Invoke(orderedCustomer, orderedCorrected); 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 #endregion
} }

View File

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 91 KiB

View File

Before

Width:  |  Height:  |  Size: 154 KiB

After

Width:  |  Height:  |  Size: 154 KiB

View File

@ -48,7 +48,7 @@ TextureImporter:
spriteMeshType: 1 spriteMeshType: 1
alignment: 7 alignment: 7
spritePivot: {x: 0.5, y: 0.5} spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100 spritePixelsToUnits: 512
spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1 spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1 alphaUsage: 1

View File

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

View File

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View File

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

View File

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 78030ce63a622e44bb441527ede528a5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -46,8 +46,8 @@ TextureImporter:
spriteMode: 1 spriteMode: 1
spriteExtrude: 1 spriteExtrude: 1
spriteMeshType: 1 spriteMeshType: 1
alignment: 0 alignment: 9
spritePivot: {x: 0.5, y: 0.5} spritePivot: {x: 0.5, y: 0.3}
spritePixelsToUnits: 512 spritePixelsToUnits: 512
spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1 spriteGenerateFallbackPhysicsShape: 1
@ -140,7 +140,7 @@ TextureImporter:
physicsShape: [] physicsShape: []
bones: [] bones: []
spriteID: 5e97eb03825dee720800000000000000 spriteID: 5e97eb03825dee720800000000000000
internalID: 0 internalID: 1537655665
vertices: [] vertices: []
indices: indices:
edges: [] edges: []

View File

@ -488,6 +488,7 @@ MonoBehaviour:
persistentDataName: persistentDataName:
portrait: {fileID: 0} portrait: {fileID: 0}
spritePortrait: {fileID: 0} spritePortrait: {fileID: 0}
audioSource: {fileID: 0}
barkUISettings: barkUISettings:
barkUI: {fileID: 9027939020919762395} barkUI: {fileID: 9027939020919762395}
barkUIOffset: {x: 0, y: 0, z: 0} barkUIOffset: {x: 0, y: 0, z: 0}
@ -686,7 +687,6 @@ MonoBehaviour:
returnAfterBeingPushedAway: 0 returnAfterBeingPushedAway: 0
progressAverage: 0 progressAverage: 0
lastJobDensityResult: 0 lastJobDensityResult: 0
centerOffsetCompatibility: NaN
repathRateCompatibility: NaN repathRateCompatibility: NaN
canSearchCompability: 0 canSearchCompability: 0
orientation: 0 orientation: 0
@ -697,7 +697,6 @@ MonoBehaviour:
sensitivity: 10 sensitivity: 10
maximumPeriod: 2 maximumPeriod: 2
visualizeSensitivity: 0 visualizeSensitivity: 0
targetCompatibility: {fileID: 0}
maxAcceleration: -2.5 maxAcceleration: -2.5
rotationSpeed: 360 rotationSpeed: 360
slowdownDistance: 1 slowdownDistance: 1
@ -778,6 +777,7 @@ MonoBehaviour:
<SkeletonAnimation>k__BackingField: {fileID: 2961986041977982893} <SkeletonAnimation>k__BackingField: {fileID: 2961986041977982893}
_originalMaterial: {fileID: 2100000, guid: eaf5a1e524cd8ae439ec7b6036090474, type: 2} _originalMaterial: {fileID: 2100000, guid: eaf5a1e524cd8ae439ec7b6036090474, type: 2}
_replacementMaterial: {fileID: 2100000, guid: 288a49bf884b6fc4bbb57fe5d2f4da06, type: 2} _replacementMaterial: {fileID: 2100000, guid: 288a49bf884b6fc4bbb57fe5d2f4da06, type: 2}
_isSkinSet: 1
_initialSkinName: 01Maid _initialSkinName: 01Maid
_isRandomSkin: 1 _isRandomSkin: 1
_isRandomRange: 0 _isRandomRange: 0
@ -821,6 +821,7 @@ MonoBehaviour:
<BalloonUi>k__BackingField: {fileID: 1469338590548789471} <BalloonUi>k__BackingField: {fileID: 1469338590548789471}
<SpineController>k__BackingField: {fileID: 5279376384905517670} <SpineController>k__BackingField: {fileID: 5279376384905517670}
<AIMovement>k__BackingField: {fileID: 17978457728262906} <AIMovement>k__BackingField: {fileID: 17978457728262906}
_createCrewSfxName: CreateCrew
--- !u!1 &7812544424410854405 --- !u!1 &7812544424410854405
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -889,8 +890,8 @@ MonoBehaviour:
m_Calls: [] m_Calls: []
m_text: "\uBB50\uAC00 \uC88B\uC744\uAE4C.." m_text: "\uBB50\uAC00 \uC88B\uC744\uAE4C.."
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: dabfdeb80b25d44b4ace56414d0eb4ad, type: 2} m_fontAsset: {fileID: 11400000, guid: 2f35c40df3d2a1a41b57c8b9eca40913, type: 2}
m_sharedMaterial: {fileID: 2100000, guid: 0e5360dce269ccc42b822a424d66fbd4, type: 2} m_sharedMaterial: {fileID: 1328173432319114220, guid: 2f35c40df3d2a1a41b57c8b9eca40913, type: 2}
m_fontSharedMaterials: [] m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0} m_fontMaterial: {fileID: 0}
m_fontMaterials: [] m_fontMaterials: []
@ -1152,4 +1153,5 @@ MonoBehaviour:
waitUntilSequenceEnds: 0 waitUntilSequenceEnds: 0
cancelWaitUntilSequenceEndsIfReplacingBark: 0 cancelWaitUntilSequenceEndsIfReplacingBark: 0
waitForContinueButton: 0 waitForContinueButton: 0
hideOnConversationStart: 0
textDisplaySetting: 0 textDisplaySetting: 0

View File

@ -0,0 +1,87 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &129321299893172345
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 3580758810857167321, guid: 06b1e69255a5cf549a66772b84f05858, type: 3}
propertyPath: m_Sprite
value:
objectReference: {fileID: 21300000, guid: e741a81faa604f94f801232ceb8371e7, type: 3}
- target: {fileID: 3580758810857167321, guid: 06b1e69255a5cf549a66772b84f05858, type: 3}
propertyPath: m_WasSpriteAssigned
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3580758810857167321, guid: 06b1e69255a5cf549a66772b84f05858, type: 3}
propertyPath: 'm_Materials.Array.data[0]'
value:
objectReference: {fileID: 2100000, guid: 4c1b114fe5106bd4787ed86b5628170c, type: 2}
- target: {fileID: 3764902268943045601, guid: 06b1e69255a5cf549a66772b84f05858, type: 3}
propertyPath: m_Name
value: Book01
objectReference: {fileID: 0}
- target: {fileID: 7438534416270888028, guid: 06b1e69255a5cf549a66772b84f05858, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7438534416270888028, guid: 06b1e69255a5cf549a66772b84f05858, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7438534416270888028, guid: 06b1e69255a5cf549a66772b84f05858, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7986070582027999988, guid: 06b1e69255a5cf549a66772b84f05858, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7986070582027999988, guid: 06b1e69255a5cf549a66772b84f05858, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7986070582027999988, guid: 06b1e69255a5cf549a66772b84f05858, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8465497525880288504, guid: 06b1e69255a5cf549a66772b84f05858, type: 3}
propertyPath: m_Size.y
value: 0.4
objectReference: {fileID: 0}
- target: {fileID: 8465497525880288504, guid: 06b1e69255a5cf549a66772b84f05858, type: 3}
propertyPath: m_Size.z
value: 0.1
objectReference: {fileID: 0}
- target: {fileID: 8465497525880288504, guid: 06b1e69255a5cf549a66772b84f05858, type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8465497525880288504, guid: 06b1e69255a5cf549a66772b84f05858, type: 3}
propertyPath: m_Center.y
value: 0.2
objectReference: {fileID: 0}
- target: {fileID: 8465497525880288504, guid: 06b1e69255a5cf549a66772b84f05858, type: 3}
propertyPath: m_Center.z
value: 0.05
objectReference: {fileID: 0}
- target: {fileID: 8884531212319162473, guid: 06b1e69255a5cf549a66772b84f05858, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9047629830516719732, guid: 06b1e69255a5cf549a66772b84f05858, type: 3}
propertyPath: m_Sprite
value:
objectReference: {fileID: 21300000, guid: e741a81faa604f94f801232ceb8371e7, type: 3}
- target: {fileID: 9047629830516719732, guid: 06b1e69255a5cf549a66772b84f05858, type: 3}
propertyPath: m_WasSpriteAssigned
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 06b1e69255a5cf549a66772b84f05858, type: 3}

View File

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

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