using System.Collections;
using System.Collections.Generic;
using UnityEngine;
///
/// 组任务目标点管理
///
public class TeamTargetManager : MonoBehaviour
{
public static TeamTargetManager instance;
private void Awake()
{
instance = this;
}
public static TeamTargetManager GetInstance
{
get
{
if (instance == null)
{
string path = "TeamTargetParent";
GameObject obj = Resources.Load(path);
GameObject clone = Instantiate(obj);
clone.name = "TeamTargetParent";
instance = clone.GetComponent();
}
return instance;
}
}
///
/// 罐区类组任务获取目标点
///
/// 任务名称
/// 罐区名称
///
public Vector3 GetTargetPos(string taskName, string tankName)
{
Vector3 pos = Vector3.zero;
foreach (Transform item in transform)
{
if (item.GetComponent().TaskNames.Contains(taskName) &&
item.GetComponent().TankName == tankName)
{
pos = item.position;
break;
}
}
return pos;
}
}