diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index e449a03..c40d31a 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -702,6 +702,67 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 139192508} m_CullTransparentMesh: 1 +--- !u!1001 &206138178 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 3948773691345320346, guid: cdba23405af5bfc41aae17526e8cb01e, type: 3} + propertyPath: m_Name + value: CharacterManager + objectReference: {fileID: 0} + - target: {fileID: 6462895877521634942, guid: cdba23405af5bfc41aae17526e8cb01e, type: 3} + propertyPath: m_RootOrder + value: 14 + objectReference: {fileID: 0} + - target: {fileID: 6462895877521634942, guid: cdba23405af5bfc41aae17526e8cb01e, type: 3} + propertyPath: m_LocalPosition.x + value: -2.9167504 + objectReference: {fileID: 0} + - target: {fileID: 6462895877521634942, guid: cdba23405af5bfc41aae17526e8cb01e, type: 3} + propertyPath: m_LocalPosition.y + value: 0.39033175 + objectReference: {fileID: 0} + - target: {fileID: 6462895877521634942, guid: cdba23405af5bfc41aae17526e8cb01e, type: 3} + propertyPath: m_LocalPosition.z + value: -3.2620392 + objectReference: {fileID: 0} + - target: {fileID: 6462895877521634942, guid: cdba23405af5bfc41aae17526e8cb01e, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6462895877521634942, guid: cdba23405af5bfc41aae17526e8cb01e, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6462895877521634942, guid: cdba23405af5bfc41aae17526e8cb01e, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6462895877521634942, guid: cdba23405af5bfc41aae17526e8cb01e, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6462895877521634942, guid: cdba23405af5bfc41aae17526e8cb01e, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6462895877521634942, guid: cdba23405af5bfc41aae17526e8cb01e, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6462895877521634942, guid: cdba23405af5bfc41aae17526e8cb01e, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: cdba23405af5bfc41aae17526e8cb01e, type: 3} --- !u!1 &219076561 GameObject: m_ObjectHideFlags: 0 @@ -719,7 +780,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &219076562 RectTransform: m_ObjectHideFlags: 0 @@ -903,7 +964,7 @@ GameObject: - component: {fileID: 243041994} - component: {fileID: 243041993} m_Layer: 0 - m_Name: QuestLog + m_Name: Journal m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -923,6 +984,7 @@ MonoBehaviour: m_EditorClassIdentifier: journal: {fileID: 22208185} playerController: {fileID: 1676075841} + adventurerPage: {fileID: 219076562} --- !u!65 &243041994 BoxCollider: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Journal.cs b/Assets/Scripts/Journal.cs new file mode 100644 index 0000000..2acec77 --- /dev/null +++ b/Assets/Scripts/Journal.cs @@ -0,0 +1,59 @@ +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using TMPro; +using UnityEngine; + +public class QuestLogInteractable : MonoBehaviour +{ + public GameObject journal; + public PlayerController playerController; + + private List m_availableAdventurers = new List(); + + public Transform adventurerPage; + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } + + private void OnMouseDown() + { + Debug.Log("MOUSE DOWN ON INVENTORY"); + foreach (var character in CharacterManager.Instance.CharacterDatas) + { + if (CharacterManager.Instance.CharacterInterviewed(character.name)) { + m_availableAdventurers.Append(character); + } + } + + journal.SetActive(true); + if (m_availableAdventurers.Count > 0) + { + SetJournalAdventurerPage(0); + adventurerPage.gameObject.SetActive(true); + } + playerController.cameraMovement = false; + } + + public void CloseJournal() + { + journal.SetActive(false); + adventurerPage.gameObject.SetActive(false); + playerController.cameraMovement = true; + } + + public void SetJournalAdventurerPage(int id) + { + CharacterData chara = m_availableAdventurers[id]; + TMP_Text nameLabel = adventurerPage.Find("AdventurerName").gameObject.GetComponent(); + nameLabel.text = chara.m_name; + } +} diff --git a/Assets/Scripts/QuestLogInteractable.cs.meta b/Assets/Scripts/Journal.cs.meta similarity index 100% rename from Assets/Scripts/QuestLogInteractable.cs.meta rename to Assets/Scripts/Journal.cs.meta diff --git a/Assets/Scripts/QuestLogInteractable.cs b/Assets/Scripts/QuestLogInteractable.cs deleted file mode 100644 index 68fc72b..0000000 --- a/Assets/Scripts/QuestLogInteractable.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class QuestLogInteractable : MonoBehaviour -{ - - public GameObject journal; - public PlayerController playerController; - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } - - private void OnMouseDown() - { - Debug.Log("MOUSE DOWN ON INVENTORY"); - journal.SetActive(true); - playerController.cameraMovement = false; - } - - public void CloseJournal() - { - Cursor.lockState = CursorLockMode.Locked; - journal.SetActive(false); - playerController.cameraMovement = true; - } -}