Files
2025TapTapGameJam/Assets/Script/Gameplay/Player/PlayerController.cs

56 lines
1.3 KiB
C#
Raw Normal View History

2025-10-15 21:31:13 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using Gameplay;
using Interface;
2025-10-15 21:31:13 +08:00
using UnityEngine;
using Core;
namespace Gameplay.Player
{
public class PlayerController : MonoBehaviour
2025-10-15 21:31:13 +08:00
{
public int MaxHealth { get; set; } = 100;
public int CurrentHealth { get; private set; }
private int currentCardIndex = 0;
public bool IsFlight { get; private set; }
public bool IsDead { get; private set; }
private PlayerMoveController playerMoveController;
private PlayerCameraController playerCameraController;
2025-10-15 21:31:13 +08:00
private void Awake()
{
playerMoveController = GetComponent<PlayerMoveController>();
playerCameraController = GetComponent<PlayerCameraController>();
CurrentHealth = MaxHealth;
2025-10-15 21:31:13 +08:00
ControllerLocator.Instance.Register(this);
2025-10-15 21:31:13 +08:00
}
private void Start()
{
2025-10-15 21:31:13 +08:00
}
public void TakeDamage(int damage)
{
CurrentHealth -= damage;
}
public void Heal(int heal)
{
CurrentHealth += heal;
if (CurrentHealth > MaxHealth)
{
CurrentHealth = MaxHealth;
}
}
}
}