Files
BookRPG/Assets/Scripts/GameManager.cs

49 lines
1.3 KiB
C#
Raw Permalink Normal View History

2026-07-16 21:49:59 +01:00
using UnityEngine;
using UnityEngine.InputSystem;
2026-07-16 21:49:59 +01:00
using EasyTalk.Controller;
public class GameManager : MonoBehaviour
{
private Player player;
2026-07-16 21:49:59 +01:00
private DialogueController dialogueController;
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>();
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()
{
}
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
}
}