Fix docs in Computer.cs
This commit is contained in:
parent
c5c9f662f1
commit
fa5129d147
@ -4,9 +4,21 @@ using Cyber.Console;
|
||||
using Cyber.Util;
|
||||
|
||||
namespace Cyber.Entities.SyncBases {
|
||||
|
||||
/// <summary>
|
||||
/// Runs functions.
|
||||
/// </summary>
|
||||
/// \todo Implement programs in an editor-friendly way
|
||||
public class Computer : Interactable {
|
||||
/// <summary>The "left key" key code.</summary>
|
||||
public const string KeyCodeLeft = "KeyLeft";
|
||||
/// <summary>The "right key" key code.</summary>
|
||||
public const string KeyCodeRight = "KeyRight";
|
||||
|
||||
/// <summary>
|
||||
/// The delegate which defines the function that will be run when the
|
||||
/// computer is interacted with (directly or through keys).
|
||||
/// </summary>
|
||||
public delegate void RunProgram(Computer host, string key);
|
||||
|
||||
/// <summary>
|
||||
@ -32,6 +44,12 @@ namespace Cyber.Entities.SyncBases {
|
||||
/// </summary>
|
||||
public RunProgram Program;
|
||||
|
||||
/// <summary>
|
||||
/// Runs the <see cref="Program"/> with some input, determined by the
|
||||
/// Trigger.
|
||||
/// </summary>
|
||||
/// <param name="Trigger">Determines the keycode given to the
|
||||
/// <see cref="Program"/>.</param>
|
||||
public override void Interact(SyncBase Trigger) {
|
||||
if (Trigger == KeyLeft) {
|
||||
Screen.SetTextProperties(new TextTextureProperties("\n Pressed left!"));
|
||||
@ -42,16 +60,36 @@ namespace Cyber.Entities.SyncBases {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// No serialization needed (yet).
|
||||
/// </summary>
|
||||
/// <param name="reader"></param>
|
||||
public override void Deserialize(NetworkReader reader) {
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// No serialization needed (yet).
|
||||
/// </summary>
|
||||
/// <param name="writer"></param>
|
||||
public override void Serialize(NetworkWriter writer) {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Computers could have lots of data, and therefore should be hashed
|
||||
/// to optimize bandwidth usage. No hurry in updating them though, so
|
||||
/// an update per 10 ticks is enough.
|
||||
/// </summary>
|
||||
/// <returns>The sync handletype.</returns>
|
||||
public override SyncHandletype GetSyncHandletype() {
|
||||
return new SyncHandletype(true, 10);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Computers should share state between different clients, so sync and
|
||||
/// send interactions to the network.
|
||||
/// </summary>
|
||||
/// <returns>The Interaction information.</returns>
|
||||
public override InteractableSyncdata GetInteractableSyncdata() {
|
||||
return new InteractableSyncdata(true, true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user