#225 Customer DB
This commit is contained in:
parent
ca89b2d13b
commit
50e0487662
31
BlueWater/Assets/02.Scripts/Data/NpcDataSO.cs
Normal file
31
BlueWater/Assets/02.Scripts/Data/NpcDataSO.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace BlueWaterProject
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(fileName = "NpcDataSO", menuName = "ScriptableObjects/NpcDataSO", order = 0)]
|
||||||
|
public class NpcDataSO : ScriptableObject
|
||||||
|
{
|
||||||
|
public List<NpcData> npcDataList = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public class NpcData
|
||||||
|
{
|
||||||
|
public int idx;
|
||||||
|
public string name;
|
||||||
|
public int speed;
|
||||||
|
public int hurry;
|
||||||
|
public int wait;
|
||||||
|
public int baseHappyPoint;
|
||||||
|
public int taste1;
|
||||||
|
public int taste2;
|
||||||
|
public int taste3;
|
||||||
|
public int picky1;
|
||||||
|
public int picky2;
|
||||||
|
public int picky3;
|
||||||
|
public int bully;
|
||||||
|
public int tip;
|
||||||
|
public int dialogue;
|
||||||
|
}
|
||||||
|
}
|
3
BlueWater/Assets/02.Scripts/Data/NpcDataSO.cs.meta
Normal file
3
BlueWater/Assets/02.Scripts/Data/NpcDataSO.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 419bd52f1a204ecf8bc45c630f2a6666
|
||||||
|
timeCreated: 1712493590
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using Sirenix.OdinInspector;
|
using Sirenix.OdinInspector;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@ -36,6 +37,8 @@ namespace BlueWaterProject
|
|||||||
public Sprite kingCrabMeat;
|
public Sprite kingCrabMeat;
|
||||||
public Sprite beer;
|
public Sprite beer;
|
||||||
|
|
||||||
|
[field: SerializeField] public NpcDataSO NpcDataSo { get; private set; }
|
||||||
|
|
||||||
private void Init()
|
private void Init()
|
||||||
{
|
{
|
||||||
PlayerInventory = new PlayerInventory();
|
PlayerInventory = new PlayerInventory();
|
||||||
@ -50,6 +53,16 @@ namespace BlueWaterProject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public NpcData GetNpcData(int idx)
|
||||||
|
{
|
||||||
|
var data = NpcDataSo.npcDataList.FirstOrDefault(d => d.idx == idx);
|
||||||
|
if(data == null)
|
||||||
|
{
|
||||||
|
Debug.LogWarning($"NPC Data for index {idx} not found.");
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Dictionary 초기화 함수
|
/// Dictionary 초기화 함수
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 14f5489c7746e4d34a85a1fc995b6428
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,40 +0,0 @@
|
|||||||
namespace BlueWaterProject.Class
|
|
||||||
{
|
|
||||||
public class NpcData
|
|
||||||
{
|
|
||||||
public int Idx { get; set; }
|
|
||||||
public string Name { get; set; }
|
|
||||||
public int Speed { get; set; }
|
|
||||||
public int Hurry { get; set; }
|
|
||||||
public int Wait { get; set; }
|
|
||||||
public int BaseHappyPoint { get; set; }
|
|
||||||
public int Taste1 { get; set; }
|
|
||||||
public int Taste2 { get; set; }
|
|
||||||
public int Taste3 { get; set; }
|
|
||||||
public int Picky1 { get; set; }
|
|
||||||
public int Picky2 { get; set; }
|
|
||||||
public int Picky3 { get; set; }
|
|
||||||
public int Bully { get; set; }
|
|
||||||
public int Tip { get; set; }
|
|
||||||
public int Dialogue { get; set; }
|
|
||||||
|
|
||||||
public NpcData(NpcData other)
|
|
||||||
{
|
|
||||||
Idx = other.Idx;
|
|
||||||
Name = other.Name;
|
|
||||||
Speed = other.Speed;
|
|
||||||
Hurry = other.Hurry;
|
|
||||||
Wait = other.Wait;
|
|
||||||
BaseHappyPoint = other.BaseHappyPoint;
|
|
||||||
Taste1 = other.Taste1;
|
|
||||||
Taste2 = other.Taste2;
|
|
||||||
Taste3 = other.Taste3;
|
|
||||||
Picky1 = other.Picky1;
|
|
||||||
Picky2 = other.Picky2;
|
|
||||||
Picky3 = other.Picky3;
|
|
||||||
Bully = other.Bully;
|
|
||||||
Tip = other.Tip;
|
|
||||||
Dialogue = other.Dialogue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 4e8e322d862c4b7cbe26bf09e6dcbb2b
|
|
||||||
timeCreated: 1711598702
|
|
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using BlueWaterProject;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class Restaurant : MonoBehaviour
|
public class Restaurant : MonoBehaviour
|
||||||
@ -11,6 +12,9 @@ public class Restaurant : MonoBehaviour
|
|||||||
public Transform[] guestNpc;
|
public Transform[] guestNpc;
|
||||||
public GameObject[] mainLight;
|
public GameObject[] mainLight;
|
||||||
|
|
||||||
|
public GameObject npcPrefab;
|
||||||
|
public NpcDataSO npcDataSo;
|
||||||
|
|
||||||
public void RestaurantSwitchOnOff()
|
public void RestaurantSwitchOnOff()
|
||||||
{
|
{
|
||||||
isSwitchOn = !isSwitchOn;
|
isSwitchOn = !isSwitchOn;
|
||||||
@ -45,20 +49,26 @@ public class Restaurant : MonoBehaviour
|
|||||||
|
|
||||||
IEnumerator ActivateNPCs()
|
IEnumerator ActivateNPCs()
|
||||||
{
|
{
|
||||||
foreach (var npc in guestNpc)
|
foreach (var npcData in npcDataSo.npcDataList)
|
||||||
{
|
{
|
||||||
if (!isSwitchOn) // 스위치가 꺼지면 코루틴을 즉시 종료
|
if (!isSwitchOn) // 스위치가 꺼지면 코루틴을 즉시 종료
|
||||||
yield break;
|
yield break;
|
||||||
|
|
||||||
if (!npc.gameObject.activeInHierarchy) // NPC가 비활성화 상태인 경우만
|
var waitTime = UnityEngine.Random.Range(3, 11); // 3초에서 10초 사이의 랜덤 대기 시간
|
||||||
{
|
|
||||||
var waitTime = UnityEngine.Random.Range(3, 11); // 1초에서 10초 사이의 랜덤 대기 시간
|
|
||||||
yield return new WaitForSeconds(waitTime); // 랜덤 대기
|
yield return new WaitForSeconds(waitTime); // 랜덤 대기
|
||||||
|
|
||||||
if (!isSwitchOn) // 대기 후 스위치 상태 다시 확인
|
if (!isSwitchOn) // 대기 후 스위치 상태 다시 확인
|
||||||
yield break;
|
yield break;
|
||||||
|
|
||||||
npc.gameObject.SetActive(true); // NPC 활성화
|
// NPC 인스턴스화 및 데이터로 초기화
|
||||||
|
var npcInstance = Instantiate(npcPrefab, transform.position, Quaternion.identity, transform); // 원하는 위치와 회전 값으로 수정하세요
|
||||||
|
var tycoonNpc = npcInstance.GetComponent<TycoonNpc>();
|
||||||
|
|
||||||
|
if (tycoonNpc != null)
|
||||||
|
{
|
||||||
|
// 여기에서 TycoonNpc의 변수를 npcData를 사용하여 초기화합니다.
|
||||||
|
// 예시: tycoonNpc.speed = npcData.speed;
|
||||||
|
// 실제 필드명과 타입에 따라 초기화 코드를 작성하세요.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4155,7 +4155,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 0
|
||||||
--- !u!4 &2861009012256036238
|
--- !u!4 &2861009012256036238
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
Loading…
Reference in New Issue
Block a user