using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
///
/// 重点保护目标
///
public class HighPriorityTarget : MonoBehaviour
{
///
/// 重点保护目标集合
///
public static List HighPriorityTargets = new List();
///
/// 重点设备完整度
///
public static float EquipmentIntegrity = 1;
#region 单体保护目标属性
///
/// 单体保护目标属性血量
///
public float HP = 100;
#endregion
///
/// 重点目标UI看向摄像机
///
public Transform KeyObjectiveUI;
///
/// 爆炸预制体
///
public GameObject explodePrefab;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Camera.main)
KeyObjectiveUI.transform.LookAt(Camera.main.transform);
}
///
/// 被攻击
///
public void BeAssaulted()
{
HP -= 10;
if (HP <= 0)
{
GameObject Bao1 = Instantiate(explodePrefab, transform);
GameObject Bao2 = Instantiate(explodePrefab, transform);
GameObject Bao3 = Instantiate(explodePrefab, transform);
Vector3 v1 = new Vector3(Random.Range(0f, 1.5f), 0, Random.Range(0f, 1.5f));
Vector3 v2 = new Vector3(Random.Range(0f, 1.5f), 0, Random.Range(0f, 1.5f));
Vector3 v3 = new Vector3(Random.Range(0f, 1.5f), 0, Random.Range(0f, 1.5f));
Bao1.transform.localPosition = Vector3.zero + v1;
Bao2.transform.localPosition = Vector3.zero + v2;
Bao3.transform.localPosition = Vector3.zero + v3;
Bao1.transform.SetParent(null);
Bao2.transform.SetParent(null);
Bao3.transform.SetParent(null);
Bao1.SetActive(true);
Bao2.SetActive(true);
Bao3.SetActive(true);
Destroy(gameObject);
}
}
}