using UnityEngine; using System.Collections; using System.Collections.Generic; public class XiaoFangYuanToShiNei : MonoBehaviour { // Use this for initialization public List AllMembers = new List();//一同进入室内的人员 void Start() { } // Update is called once per frame void Update() { } public bool toShiNei() { List selectedObjs = InputManager.Instance_.GetSelectedCharacters(); CopyTo(selectedObjs, AllMembers); return true; } private void CopyTo(List arry1, List arry2) { arry2.Clear(); foreach (GameObject obj in arry1) { if (obj.tag== "Player")//如果是消防员 { arry2.Add(obj); } } } }