Files
2026-02-21 16:45:37 +08:00

53 lines
960 B
C#

using System;
using System.Linq;
using UnityEngine;
namespace ProGroups
{
[Serializable]
public class Group
{
public string name;
public GameObject[] objects;
public bool frozen;
public bool hidden;
public Group(string InName, GameObject[] InObjects, bool InFrozen, bool InHidden)
{
name = InName;
objects = InObjects.Distinct().ToArray();
frozen = InFrozen;
hidden = InHidden;
}
public void RemoveNullOrEmpty()
{
if (objects == null)
{
objects = new GameObject[0];
return;
}
objects = objects.Where((GameObject x) => x != null).ToArray();
}
public void AddObjects(GameObject[] InObjects)
{
ArrayExt.AddRange(ref objects, InObjects);
objects = objects.Distinct().ToArray();
}
public void RemoveObject(GameObject InObject)
{
ArrayExt.Remove(ref objects, InObject);
}
public void RemoveObjects(GameObject[] InObjects)
{
ArrayExt.Remove(ref objects, InObjects);
}
}
}