50 lines
1.2 KiB
C#
50 lines
1.2 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
public class Player : MonoBehaviour
|
|
{
|
|
[Header("Config")]
|
|
[SerializeField] private PlayerStats stats;
|
|
|
|
[Header("Test")]
|
|
public ItemHealthPotion HealthPotion;
|
|
public ItemManaPotion ManaPotion;
|
|
|
|
public PlayerStats Stats => stats;
|
|
public PlayerMana PlayerMana { get; private set; }
|
|
public PlayerHealth PlayerHealth { get; private set; }
|
|
public PlayerAttack PlayerAttack { get; private set; }
|
|
|
|
private PlayerAnimations animations;
|
|
|
|
private void Awake()
|
|
{
|
|
PlayerMana = GetComponent<PlayerMana>();
|
|
PlayerHealth = GetComponent<PlayerHealth>();
|
|
PlayerAttack = GetComponent<PlayerAttack>();
|
|
animations = GetComponent<PlayerAnimations>();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.T))
|
|
{
|
|
if (HealthPotion.UseItem())
|
|
{
|
|
Debug.Log("Using Health Potion");
|
|
}
|
|
|
|
if (ManaPotion.UseItem())
|
|
{
|
|
Debug.Log("Using Mana Potion");
|
|
}
|
|
}
|
|
}
|
|
|
|
public void ResetPlayer()
|
|
{
|
|
stats.ResetPlayer();
|
|
animations.ResetPlayer();
|
|
PlayerMana.ResetMana();
|
|
}
|
|
} |