|
- using System;
-
- using RobocraftX.Blocks;
- using RobocraftX.Common;
- using Gamecraft.Blocks.TimerBlock;
- using Svelto.ECS;
- using Unity.Mathematics;
-
- using TechbloxModdingAPI;
- using TechbloxModdingAPI.Utility;
-
- namespace TechbloxModdingAPI.Blocks
- {
- public class Timer : SignalingBlock
- {
- public Timer(EGID id) : base(id)
- {
- }
-
- public Timer(uint id) : base(new EGID(id, CommonExclusiveGroups.TIMER_BLOCK_GROUP))
- {
- }
-
- // custom timer properties
-
- /// <summary>
- /// The player-specified start time.
- /// </summary>
- public float Start
- {
- get => BlockEngine.GetBlockInfo<TimerBlockDataStruct>(this).startTime;
-
- set
- {
- BlockEngine.GetBlockInfo<TimerBlockDataStruct>(this).startTime = value;
- }
- }
-
- /// <summary>
- /// The player-specified end time.
- /// </summary>
- public float End
- {
- get => BlockEngine.GetBlockInfo<TimerBlockDataStruct>(this).endTime;
-
- set
- {
- BlockEngine.GetBlockInfo<TimerBlockDataStruct>(this).endTime = value;
- }
- }
-
- /// <summary>
- /// Whether to display time with millisecond precision.
- /// </summary>
- public bool DisplayMilliseconds
- {
- get => BlockEngine.GetBlockInfo<TimerBlockDataStruct>(this).outputFormatHasMS;
-
- set
- {
- BlockEngine.GetBlockInfo<TimerBlockDataStruct>(this).outputFormatHasMS = value;
- }
- }
-
- /// <summary>
- /// Current time (as of the last video frame), in milliseconds.
- /// </summary>
- public int CurrentTime
- {
- get => BlockEngine.GetBlockInfo<TimerBlockLabelCacheEntityStruct>(this).timeLastRenderFrameMS;
-
- set
- {
- BlockEngine.GetBlockInfo<TimerBlockLabelCacheEntityStruct>(this).timeLastRenderFrameMS = value;
- }
- }
- }
- }
|