using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
public class TargetManager : MonoBehaviour
{
[SerializeField]
public List<Transform> targets = new List<Transform>();
private int randomIndex;
public float lifeTime = 0f;
private TPPController controller;
EnemyHealth enemyHealth;
//private Vector3 randPos;
private void Awake()
{
controller = GetComponent<TPPController>();
}
private void Update()
{
//Hit = controller.HitTarget;
lifeTime += Time.deltaTime;
//TargetLife();
}
public void TargetLife(GameObject targetPf,bool Hit, float damage)
{
if (Hit)
{
enemyHealth.Health -= damage;
Hit = false;
}
if (lifeTime >= 5 || enemyHealth.CurrentHealth <= 0)
{
randomIndex = Random.Range(0, 216);
for (int i = 0; i < targets.Count; i++)
{
//randPos = targets[randomIndex].position;
targetPf.SetActive(false);
targetPf.transform.position = targets[randomIndex].position;
targetPf.SetActive(true);
}
lifeTime = 0;
Debug.Log(controller.hitTarget);
}
}
}