39 lines
745 B
C#
39 lines
745 B
C#
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;
|
|
}
|
|
}
|
|
}
|