quantum-space-buddies/QSB/WorldSync/WorldObject.cs

20 lines
618 B
C#
Raw Normal View History

2021-11-11 05:51:14 +00:00
using QSB.Player;
using UnityEngine;
2021-01-29 15:29:50 +00:00
namespace QSB.WorldSync
2020-08-13 17:25:12 +00:00
{
public abstract class WorldObject<T> : IWorldObject
2021-01-29 15:29:50 +00:00
where T : MonoBehaviour
2020-12-02 21:23:01 +00:00
{
public int ObjectId { get; protected set; }
2020-12-23 22:43:05 +00:00
public T AttachedObject { get; protected set; }
public string Name => AttachedObject == null ? "<NullObject!>" : AttachedObject.name;
2021-11-11 05:51:14 +00:00
public string LogName => $"{QSBPlayerManager.LocalPlayerId}.{ObjectId}:{GetType().Name}";
2020-12-23 22:43:05 +00:00
public abstract void Init(T attachedObject, int id);
public virtual void PostInit() { }
2021-02-09 21:35:31 +00:00
public virtual void OnRemoval() { }
2021-04-16 10:40:13 +00:00
public MonoBehaviour ReturnObject() => AttachedObject;
2020-12-02 21:23:01 +00:00
}
2021-11-11 05:51:14 +00:00
}