镇海乙烯
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

52 lines
1.4 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 组任务目标点管理
/// </summary>
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<GameObject>(path);
GameObject clone = Instantiate(obj);
clone.name = "TeamTargetParent";
instance = clone.GetComponent<TeamTargetManager>();
}
return instance;
}
}
/// <summary>
/// 罐区类组任务获取目标点
/// </summary>
/// <param name="taskName">任务名称</param>
/// <param name="tankName">罐区名称</param>
/// <returns></returns>
public Vector3 GetTargetPos(string taskName, string tankName)
{
Vector3 pos = Vector3.zero;
foreach (Transform item in transform)
{
if (item.GetComponent<TeamTargetItem>().TaskNames.Contains(taskName) &&
item.GetComponent<TeamTargetItem>().TankName == tankName)
{
pos = item.position;
break;
}
}
return pos;
}
}