44 lines
1.1 KiB
C#
44 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace Passer.Control
|
|
{
|
|
/// <summary>
|
|
/// A thing is the basic building block
|
|
/// </summary>
|
|
public class CoreThing
|
|
{
|
|
public Participant participant;
|
|
public byte networkId;
|
|
public byte id;
|
|
public CoreThing parent;
|
|
public List<CoreThing> children;
|
|
public byte type;
|
|
public string name;
|
|
public string modelUrl;
|
|
//protected Sensor sensor;
|
|
|
|
protected virtual void Init()
|
|
{
|
|
}
|
|
|
|
public CoreThing(Participant client, byte networkId, byte thingId, byte thingType = 0)
|
|
{
|
|
this.participant = client;
|
|
this.id = thingId;
|
|
this.type = thingType;
|
|
this.networkId = networkId;
|
|
this.Init();
|
|
allThings.Add(this);
|
|
}
|
|
|
|
private static readonly List<CoreThing> allThings = new();
|
|
|
|
public static CoreThing Get(byte networkId, byte thingId)
|
|
{
|
|
CoreThing thing = allThings.Find(aThing => aThing.networkId == networkId && aThing.id == thingId);
|
|
return thing;
|
|
}
|
|
|
|
}
|
|
}
|