Rename QuestlogInteractable

This commit is contained in:
2023-07-08 20:03:21 +02:00
parent 6b6c3cf49f
commit 34fb3715f3
4 changed files with 123 additions and 37 deletions

View File

@@ -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

59
Assets/Scripts/Journal.cs Normal file
View File

@@ -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<CharacterData> m_availableAdventurers = new List<CharacterData>();
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<TMP_Text>();
nameLabel.text = chara.m_name;
}
}

View File

@@ -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;
}
}