2026-07-16 21:49:59 +01:00
|
|
|
using UnityEngine;
|
2026-07-17 15:09:17 +01:00
|
|
|
using UnityEngine.InputSystem;
|
2026-07-16 21:49:59 +01:00
|
|
|
using EasyTalk.Controller;
|
|
|
|
|
|
|
|
|
|
public class GameManager : MonoBehaviour
|
|
|
|
|
{
|
2026-07-17 15:09:17 +01:00
|
|
|
private Player player;
|
2026-07-16 21:49:59 +01:00
|
|
|
private DialogueController dialogueController;
|
2026-07-17 15:09:17 +01:00
|
|
|
void Awake()
|
|
|
|
|
{
|
|
|
|
|
player = GetComponent<Player>();
|
|
|
|
|
}
|
2026-07-16 21:49:59 +01:00
|
|
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
|
|
|
|
void Start()
|
|
|
|
|
{
|
|
|
|
|
dialogueController = FindFirstObjectByType<DialogueController>();
|
2026-07-17 15:09:17 +01:00
|
|
|
if (dialogueController == null)
|
2026-07-16 21:49:59 +01:00
|
|
|
Debug.LogError("DialogueController not found in the scene.");
|
|
|
|
|
else
|
|
|
|
|
dialogueController.PlayDialogue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
|
void Update()
|
|
|
|
|
{
|
2026-07-17 15:09:17 +01:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public void ShowPlayerSkills(InputAction.CallbackContext ctx)
|
|
|
|
|
{
|
|
|
|
|
if (!ctx.performed) return;
|
|
|
|
|
player.GetSkills(out var skills);
|
|
|
|
|
foreach (var skill in skills)
|
|
|
|
|
{
|
|
|
|
|
Debug.Log($"Skill: {skill.Key}, Level: {skill.Value.level}, Description: {skill.Value.Description}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void SkillCheck(string skillName, int requiredLevel, out bool hasSkill)
|
|
|
|
|
{
|
|
|
|
|
if (player.skills.TryGetValue(skillName, out Skill skill))
|
|
|
|
|
{
|
|
|
|
|
hasSkill = skill.level >= requiredLevel;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
hasSkill = false;
|
|
|
|
|
}
|
2026-07-16 21:49:59 +01:00
|
|
|
}
|
|
|
|
|
}
|