quantum-space-buddies/QSB/SectorSync/FakeSector.cs

34 lines
786 B
C#
Raw Normal View History

using OWML.Common;
using QSB.Utility;
using System;
using System.Collections.Generic;
using UnityEngine;
namespace QSB.SectorSync;
2022-03-03 03:46:33 +00:00
public class FakeSector : Sector
2021-03-11 20:02:23 +00:00
{
public static void Create(GameObject go, Sector parent, Action<FakeSector> setupSector)
{
var name = $"FakeSector_{go.name}";
if (go.transform.Find(name))
{
DebugLog.DebugWrite($"{name} already exists", MessageType.Warning);
return;
}
var go2 = new GameObject(name);
go2.SetActive(false);
go2.transform.SetParent(go.transform, false);
var fakeSector = go2.AddComponent<FakeSector>();
fakeSector._name = (Name)(-1);
fakeSector._subsectors = new List<Sector>();
fakeSector._idString = name;
fakeSector.SetParentSector(parent);
setupSector(fakeSector);
go2.SetActive(true);
}
}