Update documentation
This commit is contained in:
parent
76f28e10b7
commit
b2b5ebbce0
@ -6,5 +6,4 @@ Includes support for the Unity game engine.
|
||||
# Basic components
|
||||
|
||||
- RoboidControl::Thing
|
||||
- RoboidControl::LocalParticipant
|
||||
- RoboidControl::SiteServer
|
||||
- RoboidControl::Participant
|
||||
|
@ -37,12 +37,12 @@ namespace RoboidControl {
|
||||
/// <summary>
|
||||
/// The network ID of the participant
|
||||
/// </summary>
|
||||
public byte networkId;
|
||||
public byte networkId = 0;
|
||||
|
||||
/// <summary>
|
||||
/// The things managed by this participant
|
||||
/// </summary>
|
||||
public readonly List<Thing> things = new List<Thing>();
|
||||
public readonly List<Thing> things = new();
|
||||
|
||||
public virtual void Update(ulong currentTimeMS = 0) {
|
||||
int n = this.things.Count;
|
||||
@ -51,11 +51,19 @@ namespace RoboidControl {
|
||||
if (thing != null)
|
||||
thing.Update(currentTimeMS, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static List<Participant> participants = new List<Participant>();
|
||||
/// <summary>
|
||||
/// The collection of known participants.
|
||||
/// </summary>
|
||||
public readonly static List<Participant> participants = new();
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve a participant using ip address and port number
|
||||
/// </summary>
|
||||
/// <param name="ipAddress">The ip address of the participant</param>
|
||||
/// <param name="port">The port number used to send messages to the participant</param>
|
||||
/// <returns>The participant or null if it is not found.</returns>
|
||||
public static Participant GetParticipant(string ipAddress, int port) {
|
||||
//Console.WriteLine($"Get Participant {ipAddress}:{port}");
|
||||
foreach (Participant participant in Participant.participants) {
|
||||
@ -64,14 +72,26 @@ namespace RoboidControl {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public static Participant GetParticipant(int participantId) {
|
||||
//Console.WriteLine($"Get Participant [participantId]");
|
||||
/// <summary>
|
||||
/// Retrieve a participant using a network ID
|
||||
/// </summary>
|
||||
/// <param name="networkId">The network ID of the participant</param>
|
||||
/// <returns>The participant or null if it is not found.</returns>
|
||||
public static Participant GetParticipant(int networkId) {
|
||||
//Console.WriteLine($"Get Participant [networkId]");
|
||||
foreach (Participant participant in Participant.participants) {
|
||||
if (participant.networkId == participantId)
|
||||
if (participant.networkId == networkId)
|
||||
return participant;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a new participant to the collection of participants
|
||||
/// </summary>
|
||||
/// <param name="ipAddress">The IP address of the participant</param>
|
||||
/// <param name="port">The port used to send messages to this participant</param>
|
||||
/// <returns>The added participant</returns>
|
||||
public static Participant AddParticipant(string ipAddress, int port) {
|
||||
Console.WriteLine($"New Participant {ipAddress}:{port}");
|
||||
Participant participant = new(ipAddress, port) {
|
||||
@ -80,6 +100,11 @@ namespace RoboidControl {
|
||||
Participant.participants.Add(participant);
|
||||
return participant;
|
||||
}
|
||||
/// <summary>
|
||||
/// Add a new participant to the collection of participants
|
||||
/// </summary>
|
||||
/// <param name="participant">The participant to add</param>
|
||||
/// <note>This function only adds the participant if it is not yet in the collection</note>
|
||||
public static void AddParticipant(Participant participant) {
|
||||
Participant foundParticipant = Participant.GetParticipant(participant.networkId);
|
||||
if (foundParticipant == null)
|
||||
|
@ -269,7 +269,7 @@ namespace RoboidControl {
|
||||
/// <summary>
|
||||
/// Event triggered when the pose has changed
|
||||
/// </summary>
|
||||
public event ChangeHandler OnPoseChanged = null; //delegate { };
|
||||
public event ChangeHandler OnPoseChanged = delegate { };
|
||||
/// <summary>
|
||||
/// Boolean indicating that the thing has an updated position
|
||||
/// </summary>
|
||||
|
Loading…
x
Reference in New Issue
Block a user