Summary
The TimeStone
is managing data though time for its TimeAgent
list
The TimeStone
can record to keep past data or run simulation to generate future data
The TimeStone
can also playback its data on its TimeAgent
list
- Namespace
- RedGirafeGames
.Agamotto .Scripts .Runtime - Base Types
-
- MonoBehaviour
Syntax
[AddComponentMenu("Agamotto/Time Stone")]
public class TimeStone : MonoBehaviour
Remarks
You can have multiple stones in the scene
Use classes derived from AbstractTimeVisualizer
to visualize TimeStone's data
Attributes
Type | Description |
---|---|
AddComponentMenu |
Fields
Name | Constant Value | Summary |
---|---|---|
addTickCursor |
The current tick index used by the stone to add new data. If new data are generated by record or simulation, they will be added from this index in the You can get corresponding time using |
|
frameTimeStack |
Current simulated frame time stack
|
|
keepSimulationScene |
Keeps the scene created for the last simulation alive.
Otherwise, the scene is destroyed when the simulation end.
A new scene is created for each simulation, even if this property is true
|
|
logDebug |
Activates log messages (except performances messages)
|
|
logPerfs |
Activates performances messages
|
|
playback |
Is the stone's playback active.
|
|
playbackSpeed |
The playback's speed
|
|
playbackTickCursor |
The current tick index used to playback the TimeLine. It is also useful to use with a TimeSlider to control what index of the TimeLine to display You can get corresponding time using |
|
playbackTimeScale |
The time scale used to playback stone's data
|
|
playback |
If true, using playback will update the addTickCursor so that it's synchronized with the playbackTickCursor.
As a result, if you start recording or make a simulation after a playback, it will start where you stopped it.
|
|
recordDuration |
The maximum record duration.
If the TimeLine's duration is higher than this value during recording, oldest data are removed when adding new ones
|
|
recordingStep |
Minimum delta time between record data, 0 or less will record on each
Update() call (which while giving you great precision, will greatly impact performances)
|
|
recordingTimeScale |
The timescale used during recording
|
|
recordOnStart |
Activates recording on
Start()
If simulateOnStart is true, recordOnStart has no effect (because starting a simulation stops recording)
|
|
recordTime |
The time since current recording started.
|
|
reset |
If true, the
addTickCursor will be placed at the simulation start tick when simulation ends.
|
|
simulateOnStart |
A simulation is automatically started on
TimeAgent
|
|
simulatePhysics |
Should the simulations run the physics simulation on time agents
|
|
simulateUpdate |
Should the simulations execute the TimeAgents simulation life cycle callbacks (SimulationUpdate, SimulationComplete, etc.)
|
|
simulationDuration |
The simulation maximum duration if
simulationHasDuration is true.
|
|
simulation |
If
simulationSpeed is higher than 1.0, every simulation tick that should be made during a single frame
will be grouped into one (with adapted delta time).
This option makes the simulation faster but lowers the precision.
|
|
simulation |
Defines if the simulation has a maximum duration.
If not defined, simulation must be stopped using
StopSimulation() .
|
|
simulation |
The maximum number of milliseconds consumed by the simulation every frame.
The property let you limit the impact of the simulation on the framerate.
|
|
simulation |
The physics scene of the
simulationScene
|
|
simulation |
If
simulationUseUnityFixedDeltaTime is false, defines the step physics simulation uses
|
|
simulationScene |
The scene created for the simulation.
A new one is created everytime
|
|
simulationSpeed |
The simulation speed.
Example : Value of 2.0 will run the simulation twice as fast as real time
This value can be limited by |
|
simulationStartTick |
The tick index when current simulation started
|
|
simulationTime |
The time since the current simulation started
|
|
simulationTimeAgents |
The list of simulation time agents generated when
CreateSimulationScene() is called.
|
|
simulationTimeScale |
The time scale used to execute the simulation
|
|
simulationUpdateStep |
Delta time used during a simulation between frames if
simulationUseUpdateDeltaTime is false
|
|
simulation |
Simulation will use
Time.fixedDeltaTime for physics simulation's step
|
|
simulation |
Simulation execution will use
Time.deltaTime or Time.unscaledDeltaTime .
If simulationSpeed is higher than 1.0, every simulation tick during a frame will use the same deltaTime.
If false, Simulation uses simulationUpdateStep ;
|
|
timeAgents |
The final list of time agents used by the stone.
If you manage your TimeAgents manually, you can't add them directly in this list for simulations.
You have to add them in
timeAgentsManualInitList and then call onInitTimeAgentsList or use
StartSimulation(bool) with the right parameter to initialize simulation agents
|
|
time |
The layer's name used if the initialization mode is
Layer
|
|
time |
The initialization mode for the Time Agents.
|
|
time |
The tag used if the initialization mode is
Tag
|
|
time |
The initialization list of the time agent.
Different from the final time agent list because if
parseChildren is activated, new
time agents will be added.
|
|
timeAgentsNoChildren |
The list of time agents, but without the children searched recursively if
parseChildren
is true on some TimeAgents.
|
|
timeLine |
The TimeLine holding the time agents data over time.
|
|
time |
The selected behaviour on time line modification
|
|
update |
If true, the
playbackTickCursor is synchronized with the recording state, so that when recording is stopped,
the timeline is synchronized with the time agents states
|
Properties
Name | Value | Summary |
---|---|---|
onInitTimeAgentsList | TimeStone |
UnityEvent when stone has initialized its TimeAgent list with its initialization mode.
This is the good event to use to initialize things if the stone is making record and simulation as it is called in both cases.
|
onRecordStart | TimeStone |
UnityEvent when record starts
|
onRecordStop | TimeStone |
UnityEvent when record stops
|
onSimulationComplete | TimeStone |
UnityEvent when simulation is complete
|
on |
TimeStone |
UnityEvent when the scene for the simulation is created and the time agents cloned
|
onSimulationStart | TimeStone |
UnityEvent when the simulation is starting to simulate
|
onTimeLineChange | TimeStone |
UnityEvent when timeLine is modified.
For recording, this is called on every recorded tick.
For simulation, this is called on every frame (multiples ticks simulated on the same frame don't trigger).
|
onTimeLineClear | TimeStone |
UnityEvent when the TimeLine is cleared by calling
Clear()
|
Recording | bool |
Is the stone recording. Use
StartRecording() and StopRecording() to modify
|
Simulating | bool |
Is the stone simulating. Use
StartSimulation(bool) and StopSimulation() to modify
|
SimulationComplete | bool |
Flag when simulation is complete
|
Methods
Name | Value | Summary |
---|---|---|
CleanTimeAgentsList |
void |
Remove eventual destroyed agents from the lists
|
Clear |
void |
Clear the
timeLine 's data (not its time agents)
|
ClearTimeAgentsList |
void |
Clears the time agents lists
|
FreezeTimeAgents |
void |
Changes freeze state of
timeAgents using PhysicsAutoSimulation for the physics.
|
FreezeTimeAgents |
void |
Changes freeze state of
timeAgents using given physics freeze type
|
GetData |
TimeLine |
Get TimeData at the current played tick
|
GetDataAt |
TimeLine |
Get TimeData at the given tick index
|
GetDataAtTime |
TimeLine |
Get the TimeData at the given Time
|
GetDataValue |
T |
Get TimeData Value at the current played tick
|
GetDataValueAt |
T |
Get TimeData Value at the given tick index
|
GetPlaybackTime |
float |
Get playback's time, corresponding to current
playbackTickCursor using GetTimeAtTickIndex(int)
|
GetTickCount |
int |
Get the number of ticks in the
timeLine
|
GetTickIndexAtTime |
int |
Get the tick index at given time (in seconds). The result is an approximation, the closest tick corresponding to this time is returned.
Therefore this method always returns an index, even if time does not exist in the
timeLine
|
GetTimeAtTickIndex |
float |
Get the time (in seconds) corresponding to the tick index.
If tick index does not exist in the
timeLine then returns 0
|
GetTimeLineDuration |
float |
Get the
timeLine duration (in seconds)
|
HasTimeAgent |
bool | |
InitSimulation |
void |
Initialize the simulation data : scene, clone agents, etc.
|
InitTimeAgentsList |
void |
Initializes the time agent list using the defined mode
|
PersistData |
void |
Persist data in the TimeStone's TimeLine using current persisted tick TimeAgent, TimeTickOrigin and DeltaTime.
|
PersistData |
void |
Persist timeAgent's data in the TimeStone's TimeLine.
|
PersistTick |
void |
Persist current tick
|
RemoveData |
void |
Remove timeLine's data from the stone.
Cursors
playbackTickCursor and addTickCursor are updates in consequence.
|
SetPlaybackTick |
void |
Updates Time Agents with the TimeLine's data at tickIndex.
|
SetPlaybackTime |
void |
Set playback time. Playback is based on
playbackTickCursor , so the tick index value is
deducted using GetTickIndexAtTime(float)
|
StartPlayback |
void |
Starts playback.
Playback is applying TimeLine's data to stone's timeAgents respecting the timing, it uses You can control the speed of the playback with You can stop playback using You can control if the playback synchronizes the addTickCursor with |
StartRecording |
void |
Starts recording
|
StartSimulation |
void |
Starts a new simulation.
The simulation will really start to execute on next frame.
|
StopPlayback |
void |
Stops playback
|
StopRecording |
void |
Stops recording
|
StopSimulation |
void |
Stops running simulation
|