Closes #82 Building List Up
This commit is contained in:
parent
962ccfbfe7
commit
fc2f9bc913
File diff suppressed because it is too large
Load Diff
@ -138,65 +138,65 @@ namespace BlueWaterProject
|
|||||||
|
|
||||||
public void StartInteraction(Transform target)
|
public void StartInteraction(Transform target)
|
||||||
{
|
{
|
||||||
ProximitySelector.enabled = false;
|
// ProximitySelector.enabled = false;
|
||||||
interactionTarget = target;
|
// interactionTarget = target;
|
||||||
interactionTarget.GetComponent<InShipNpc>()?.ChangeStateToInteraction();
|
// interactionTarget.GetComponent<InShipNpc>()?.ChangeStateToInteraction();
|
||||||
|
//
|
||||||
var targetPosition = interactionTarget.position;
|
// var targetPosition = interactionTarget.position;
|
||||||
var playerPosition = transform.position;
|
// var playerPosition = transform.position;
|
||||||
|
//
|
||||||
var directionToTarget = (targetPosition - playerPosition).normalized;
|
// var directionToTarget = (targetPosition - playerPosition).normalized;
|
||||||
|
//
|
||||||
// 캐릭터가 NPC의 왼쪽 또는 오른쪽에 있는지 확인
|
// // 캐릭터가 NPC의 왼쪽 또는 오른쪽에 있는지 확인
|
||||||
var crossProduct = Vector3.Cross(directionToTarget, transform.forward).y;
|
// var crossProduct = Vector3.Cross(directionToTarget, transform.forward).y;
|
||||||
|
//
|
||||||
Vector3 desiredPosition;
|
// Vector3 desiredPosition;
|
||||||
float desiredScaleX; // 캐릭터의 방
|
// float desiredScaleX; // 캐릭터의 방
|
||||||
|
//
|
||||||
if (crossProduct > 0) // 캐릭터가 NPC의 왼쪽에 있는 경우
|
// if (crossProduct > 0) // 캐릭터가 NPC의 왼쪽에 있는 경우
|
||||||
{
|
// {
|
||||||
desiredPosition = targetPosition + interactionTarget.right * 2f;
|
// desiredPosition = targetPosition + interactionTarget.right * 2f;
|
||||||
desiredScaleX = 1f; // 오른쪽을 바라봄
|
// desiredScaleX = 1f; // 오른쪽을 바라봄
|
||||||
}
|
// }
|
||||||
else // 캐릭터가 NPC의 오른쪽에 있는 경우
|
// else // 캐릭터가 NPC의 오른쪽에 있는 경우
|
||||||
{
|
// {
|
||||||
desiredPosition = targetPosition + interactionTarget.right * -2f;
|
// desiredPosition = targetPosition + interactionTarget.right * -2f;
|
||||||
desiredScaleX = -1f; // 왼쪽을 바라봄
|
// desiredScaleX = -1f; // 왼쪽을 바라봄
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// 장애물 감지
|
// // 장애물 감지
|
||||||
if (Physics.Raycast(playerPosition, (desiredPosition - playerPosition).normalized, Vector3.Distance(playerPosition, desiredPosition), LayerMask.GetMask("Obstacle")))
|
// if (Physics.Raycast(playerPosition, (desiredPosition - playerPosition).normalized, Vector3.Distance(playerPosition, desiredPosition), LayerMask.GetMask("Obstacle")))
|
||||||
{
|
// {
|
||||||
// 장애물이 감지되면, 반대쪽으로 이동
|
// // 장애물이 감지되면, 반대쪽으로 이동
|
||||||
desiredPosition = crossProduct > 0 ? targetPosition + interactionTarget.right * -2f : targetPosition + interactionTarget.right * 2f;
|
// desiredPosition = crossProduct > 0 ? targetPosition + interactionTarget.right * -2f : targetPosition + interactionTarget.right * 2f;
|
||||||
desiredScaleX = -desiredScaleX; // 방향을 반전
|
// desiredScaleX = -desiredScaleX; // 방향을 반전
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// 캐릭터를 원하는 위치와 방향으로 부드럽게 이동 및 회전
|
// // 캐릭터를 원하는 위치와 방향으로 부드럽게 이동 및 회전
|
||||||
StartCoroutine(MoveCharacterToPosition(desiredPosition, desiredScaleX));
|
// StartCoroutine(MoveCharacterToPosition(desiredPosition, desiredScaleX));
|
||||||
UiManager.Inst.InShipInteraction.gameObject.SetActive(true);
|
// UiManager.Inst.InShipInteraction.gameObject.SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartConversation()
|
public void StartConversation()
|
||||||
{
|
{
|
||||||
if (interactionTarget != null)
|
// if (interactionTarget != null)
|
||||||
{
|
// {
|
||||||
interactionTarget.GetComponent<DialogueSystemTrigger>().OnConversationStart(interactionTarget);
|
// interactionTarget.GetComponent<DialogueSystemTrigger>().OnConversationStart(interactionTarget);
|
||||||
UiManager.Inst.InShipInteraction.gameObject.SetActive(false);
|
// UiManager.Inst.InShipInteraction.gameObject.SetActive(false);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EndInteraction()
|
public void EndInteraction()
|
||||||
{
|
{
|
||||||
ProximitySelector.enabled = true;
|
// ProximitySelector.enabled = true;
|
||||||
|
//
|
||||||
|
//
|
||||||
interactionTarget.GetComponent<InShipNpc>()?.RestoreState();
|
// interactionTarget.GetComponent<InShipNpc>()?.RestoreState();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EndConversation()
|
public void EndConversation()
|
||||||
{
|
{
|
||||||
UiManager.Inst.InShipInteraction.gameObject.SetActive(true);
|
// UiManager.Inst.InShipInteraction.gameObject.SetActive(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,9 @@ namespace BlueWaterProject
|
|||||||
[field: Title("Player")]
|
[field: Title("Player")]
|
||||||
[field: SerializeField] public ShipPlayer ShipPlayer { get; private set; }
|
[field: SerializeField] public ShipPlayer ShipPlayer { get; private set; }
|
||||||
[field: SerializeField] public InShipPlayer InShipPlayer { get; private set; }
|
[field: SerializeField] public InShipPlayer InShipPlayer { get; private set; }
|
||||||
|
|
||||||
|
[Title("Tycoon")]
|
||||||
|
public bool IsBuildMode { get; set; }
|
||||||
|
|
||||||
// Game Data
|
// Game Data
|
||||||
[Title("Game Data")]
|
[Title("Game Data")]
|
||||||
|
@ -64,20 +64,31 @@ namespace BlueWaterProject
|
|||||||
|
|
||||||
private void OnInteraction(InputValue value)
|
private void OnInteraction(InputValue value)
|
||||||
{
|
{
|
||||||
|
if (GameManager.Inst.IsBuildMode)
|
||||||
|
{
|
||||||
|
var buildListPopup = UiManager.Inst.TycoonUi.BuildListPopup;
|
||||||
|
|
||||||
|
//TODO 선택했는지 판단해야함
|
||||||
|
//Assets/EasyGridBuilder Pro/Misc Assets/Prefabs/UI Prefabs/PlaceHolderBuildable.prefab
|
||||||
|
buildListPopup.Hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnBuildMode(InputValue value)
|
private void OnBuildMode(InputValue value)
|
||||||
{
|
{
|
||||||
var buildListPopup = UiManager.Inst.TycoonUi.BuildListPopup;
|
var buildListPopup = UiManager.Inst.TycoonUi.BuildListPopup;
|
||||||
|
|
||||||
if (buildListPopup.gameObject.activeSelf)
|
if (buildListPopup.isVisible || GameManager.Inst.IsBuildMode)
|
||||||
{
|
{
|
||||||
buildListPopup.Hide();
|
buildListPopup.Hide();
|
||||||
|
EasyGridBuilderPro.Instance.SetGridModeBuilding();
|
||||||
|
GameManager.Inst.IsBuildMode = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buildListPopup.Show();
|
buildListPopup.Show();
|
||||||
|
EasyGridBuilderPro.Instance.SetGridModeBuilding();
|
||||||
|
GameManager.Inst.IsBuildMode = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,12 +7,12 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class TycoonUi : MonoBehaviour
|
public class TycoonUi : MonoBehaviour
|
||||||
{
|
{
|
||||||
public UIPopup BuildListPopup { get; set; }
|
public UIView BuildListPopup { get; set; }
|
||||||
|
|
||||||
private void Init()
|
private void Init()
|
||||||
{
|
{
|
||||||
UiManager.Inst.TycoonUi = this;
|
UiManager.Inst.TycoonUi = this;
|
||||||
BuildListPopup = transform.Find("BuildListPopup").GetComponent<UIPopup>();
|
BuildListPopup = transform.Find("BuildListView").GetComponent<UIView>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
|
@ -31,7 +31,6 @@ RectTransform:
|
|||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 7301794625148554701}
|
m_Father: {fileID: 7301794625148554701}
|
||||||
m_RootOrder: 0
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
@ -111,7 +110,6 @@ RectTransform:
|
|||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 7301794624532857029}
|
- {fileID: 7301794624532857029}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 0}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
@ -177,7 +175,7 @@ MonoBehaviour:
|
|||||||
m_CallState: 2
|
m_CallState: 2
|
||||||
--- !u!95 &7301794625148554699
|
--- !u!95 &7301794625148554699
|
||||||
Animator:
|
Animator:
|
||||||
serializedVersion: 4
|
serializedVersion: 7
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
@ -191,10 +189,12 @@ Animator:
|
|||||||
m_ApplyRootMotion: 0
|
m_ApplyRootMotion: 0
|
||||||
m_LinearVelocityBlending: 0
|
m_LinearVelocityBlending: 0
|
||||||
m_StabilizeFeet: 0
|
m_StabilizeFeet: 0
|
||||||
|
m_AnimatePhysics: 0
|
||||||
m_WarningMessage:
|
m_WarningMessage:
|
||||||
m_HasTransformHierarchy: 1
|
m_HasTransformHierarchy: 1
|
||||||
m_AllowConstantClipSamplingOptimization: 1
|
m_AllowConstantClipSamplingOptimization: 1
|
||||||
m_KeepAnimatorControllerStateOnDisable: 0
|
m_KeepAnimatorStateOnDisable: 0
|
||||||
|
m_WriteDefaultValuesOnDisable: 0
|
||||||
--- !u!114 &7301794625148554698
|
--- !u!114 &7301794625148554698
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -19,15 +19,7 @@ MonoBehaviour:
|
|||||||
m_Id: 1ffcd137-ef1f-4ebd-b2eb-45d7974bacab
|
m_Id: 1ffcd137-ef1f-4ebd-b2eb-45d7974bacab
|
||||||
m_Processors:
|
m_Processors:
|
||||||
m_Interactions:
|
m_Interactions:
|
||||||
m_SingletonActionBindings:
|
m_SingletonActionBindings: []
|
||||||
- m_Name:
|
|
||||||
m_Id: a70ee01a-c940-4f92-ae7a-5e6928f96980
|
|
||||||
m_Path: <Mouse>/rightButton
|
|
||||||
m_Interactions:
|
|
||||||
m_Processors:
|
|
||||||
m_Groups:
|
|
||||||
m_Action: Grid Mode Reset Key
|
|
||||||
m_Flags: 0
|
|
||||||
m_Flags: 0
|
m_Flags: 0
|
||||||
gridHeightChangeKey:
|
gridHeightChangeKey:
|
||||||
m_Name: Grid Height Change Key
|
m_Name: Grid Height Change Key
|
||||||
@ -54,15 +46,7 @@ MonoBehaviour:
|
|||||||
m_Id: 29f9c6e2-ab3f-483c-976a-5692a7022c3c
|
m_Id: 29f9c6e2-ab3f-483c-976a-5692a7022c3c
|
||||||
m_Processors:
|
m_Processors:
|
||||||
m_Interactions:
|
m_Interactions:
|
||||||
m_SingletonActionBindings:
|
m_SingletonActionBindings: []
|
||||||
- m_Name:
|
|
||||||
m_Id: 114b32b9-5c98-4850-8d1c-f714200756e8
|
|
||||||
m_Path: <Keyboard>/r
|
|
||||||
m_Interactions:
|
|
||||||
m_Processors:
|
|
||||||
m_Groups:
|
|
||||||
m_Action: Build Mode Activation Key
|
|
||||||
m_Flags: 0
|
|
||||||
m_Flags: 0
|
m_Flags: 0
|
||||||
buildablePlacementKey:
|
buildablePlacementKey:
|
||||||
m_Name: Buildable Placement Key
|
m_Name: Buildable Placement Key
|
||||||
@ -202,41 +186,6 @@ MonoBehaviour:
|
|||||||
m_Action: Buildable Selection Key
|
m_Action: Buildable Selection Key
|
||||||
m_Flags: 0
|
m_Flags: 0
|
||||||
m_Flags: 0
|
m_Flags: 0
|
||||||
useMoveModeActivationKey: 1
|
|
||||||
moveModeActivationKey:
|
|
||||||
m_Name: Move Mode Activation Key
|
|
||||||
m_Type: 0
|
|
||||||
m_ExpectedControlType:
|
|
||||||
m_Id: b572a271-87fb-429c-b8f7-98a1dbe55229
|
|
||||||
m_Processors:
|
|
||||||
m_Interactions:
|
|
||||||
m_SingletonActionBindings:
|
|
||||||
- m_Name:
|
|
||||||
m_Id: b38cc68f-0c89-487c-be7b-aeea44d53e09
|
|
||||||
m_Path: <Keyboard>/u
|
|
||||||
m_Interactions:
|
|
||||||
m_Processors:
|
|
||||||
m_Groups:
|
|
||||||
m_Action: Move Mode Activation Key
|
|
||||||
m_Flags: 0
|
|
||||||
m_Flags: 0
|
|
||||||
buildableMoveKey:
|
|
||||||
m_Name: Buildable Move Key
|
|
||||||
m_Type: 0
|
|
||||||
m_ExpectedControlType:
|
|
||||||
m_Id: c7949b7a-f44f-4b53-9f2d-82deae062c13
|
|
||||||
m_Processors:
|
|
||||||
m_Interactions:
|
|
||||||
m_SingletonActionBindings:
|
|
||||||
- m_Name:
|
|
||||||
m_Id: a4c62cd0-ef5c-425f-80fb-487b146d0967
|
|
||||||
m_Path: <Mouse>/leftButton
|
|
||||||
m_Interactions:
|
|
||||||
m_Processors:
|
|
||||||
m_Groups:
|
|
||||||
m_Action: Buildable Move Key
|
|
||||||
m_Flags: 0
|
|
||||||
m_Flags: 0
|
|
||||||
gridSaveKey:
|
gridSaveKey:
|
||||||
m_Name: Grid Save Key
|
m_Name: Grid Save Key
|
||||||
m_Type: 0
|
m_Type: 0
|
||||||
|
@ -1174,8 +1174,8 @@ namespace SoulGames.EasyGridBuilderPro
|
|||||||
|
|
||||||
public void SetGridModeBuilding()
|
public void SetGridModeBuilding()
|
||||||
{
|
{
|
||||||
if (useBuildModeActivationKey)
|
//if (useBuildModeActivationKey)
|
||||||
{
|
//{
|
||||||
if (GetGridMode() != GridMode.Build)
|
if (GetGridMode() != GridMode.Build)
|
||||||
{
|
{
|
||||||
isBuildableBuildActive = true;
|
isBuildableBuildActive = true;
|
||||||
@ -1186,7 +1186,7 @@ namespace SoulGames.EasyGridBuilderPro
|
|||||||
isBuildableBuildActive = false;
|
isBuildableBuildActive = false;
|
||||||
SetGridMode(GridMode.None);
|
SetGridMode(GridMode.None);
|
||||||
}
|
}
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TriggerBuildablePlacement() //This function handles 'buildableGridObjectTypeSO' object placement
|
public void TriggerBuildablePlacement() //This function handles 'buildableGridObjectTypeSO' object placement
|
||||||
|
Loading…
Reference in New Issue
Block a user