2020-08-20 17:29:47 +01:00
|
|
|
|
using QSB.WorldSync;
|
2020-08-16 17:15:36 +02:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
2020-12-31 12:10:55 +00:00
|
|
|
|
namespace QSB.SectorSync.WorldObjects
|
2020-08-16 17:15:36 +02:00
|
|
|
|
{
|
2020-12-23 22:43:05 +00:00
|
|
|
|
public class QSBSector : WorldObject<Sector>
|
2020-12-02 21:23:01 +00:00
|
|
|
|
{
|
2020-12-23 22:43:05 +00:00
|
|
|
|
public Sector.Name Type => AttachedObject.GetName();
|
|
|
|
|
public Transform Transform => AttachedObject.transform;
|
2020-12-02 21:23:01 +00:00
|
|
|
|
public Vector3 Position => Transform.position;
|
2021-03-11 20:02:23 +00:00
|
|
|
|
public bool IsFakeSector => AttachedObject.GetType() == typeof(FakeSector);
|
2020-08-20 19:31:10 +01:00
|
|
|
|
|
2020-12-23 22:43:05 +00:00
|
|
|
|
public override void Init(Sector sector, int id)
|
2020-12-02 21:23:01 +00:00
|
|
|
|
{
|
|
|
|
|
ObjectId = id;
|
2020-12-23 22:43:05 +00:00
|
|
|
|
AttachedObject = sector;
|
2021-03-11 20:02:23 +00:00
|
|
|
|
if (IsFakeSector)
|
|
|
|
|
{
|
|
|
|
|
QSBSectorManager.Instance.FakeSectors.Add(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnRemoval()
|
|
|
|
|
{
|
|
|
|
|
if (IsFakeSector)
|
|
|
|
|
{
|
|
|
|
|
QSBSectorManager.Instance.FakeSectors.Remove(this);
|
|
|
|
|
}
|
2020-12-02 21:23:01 +00:00
|
|
|
|
}
|
2021-03-12 21:46:02 +00:00
|
|
|
|
|
|
|
|
|
public bool ShouldSyncTo()
|
|
|
|
|
{
|
|
|
|
|
if (Type == Sector.Name.Ship)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2021-03-13 10:19:02 +00:00
|
|
|
|
if ((AttachedObject.name == "Sector_Shuttle" || AttachedObject.name == "Sector_NomaiShuttleInterior")
|
2021-03-12 21:46:02 +00:00
|
|
|
|
&& !AttachedObject.gameObject.GetComponentInParent<NomaiShuttleController>().IsPlayerInside())
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2020-12-02 21:23:01 +00:00
|
|
|
|
}
|
2020-12-03 08:28:05 +00:00
|
|
|
|
}
|