VanRtkDbg/Assets/Scripts/Camp.cs

39 lines
745 B
C#
Raw Normal View History

2022-03-15 23:50:58 -07:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class Camp : MonoBehaviour
{
public int currentDefense = 100;
public int maxDefense = 100;
public int fireRange = 3;
public int fireAttackDamage = 0;
public Side side;
public Transform defenseText;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
defenseText.GetComponent<TextMeshProUGUI>().text = currentDefense.ToString();
}
public void TakeDamage(int damage)
{
currentDefense -= damage;
if (currentDefense < 0)
{
currentDefense = 0;
}
}
}