AbstractTimeVisualizer Class

Summary

Base component to make TimeStone's visualizers.

Override callbacks OnSimulationStart(), OnTimeLineChange(TimeStone.TimeTickOrigin), etc. and use visualizationEnabled to code your visualizer

See PathVisualizer for an example

graph BT Type-->Base0["MonoBehaviour"] Type["AbstractTimeVisualizer"] class Type type-node Derived0["PathVisualizer"]-->Type click Derived0 "/api/RedGirafeGames.Agamotto.Scripts.Runtime.Visualizers/PathVisualizer" Derived1["OnionSkinVisualizer"]-->Type click Derived1 "/api/RedGirafeGames.Agamotto.Scripts.Runtime.Visualizers/OnionSkinVisualizer"

Syntax

[AddComponentMenu("")]
[RequireComponent(typeof(TimeAgent))]
public class AbstractTimeVisualizer : MonoBehaviour

Attributes

Type Description
AddComponentMenu
RequireComponent

Fields

Name Constant Value Summary
autoAssignStone
Automatically assigns the stone from the first stone interacting with the timeAgent
autoUpdateOnSimulationComplete
The visualizer listens to OnSimulationComplete() UnityEvent to update wen received.
autoUpdateOnTimeLineChange
The visualizer listens to OnTimeLineChange(TimeStone.TimeTickOrigin) UnityEvent to update when received. This is mostly used to update during a recording
logDebug
Log all messages
stone
The TimeStone visualized.

Unlike TimeAgent, a visualizer can only be used by one stone.

timeAgent
The timeAgent. Should be present on the GameObject and will be automatically populated
visualizationEnabled
Flag to know if the visualization must be visible. It will be set to false if critical data are missing, like the timeAgent or the timeStone for example.

Methods

Name Value Summary
AddStoneListeners() void
Add listeners to the TimeStone
Awake() void
ClearVisualization(int) void
Base method to clear this visualizer. Override in extending component.
OnInitTimeAgentsList() void
Callback to TimeStone's event InitTimeAgentsList
OnRecordStart() void
Callback to TimeStone's event OnRecordStop
OnRecordStop() void
Callback to TimeStone's event OnRecordStart
OnSimulationComplete() void
Callback to TimeStone's event OnSimulationComplete
OnSimulationStart() void
Callback to TimeStone's event OnSimulationStart
OnStoneInitTimeAgentsList(TimeStone) void
Callback to TimeAgent's event InitTimeAgentsList Only used with autoAssignStone = true, to automatically set the TimeStone if it's not already defined The first stone to use this agent will be automatically assigned
OnTimeAgentSetDataTick(TimeStone, int) void
Callback to TimeAgent's event OnSetDataTick Can be useful if the visualizer is dependent to the current tick. See OnionSkinVisualizer for example.
OnTimeLineChange(TimeStone.TimeTickOrigin) void
Callback to TimeStone's event OnTimeLineChange
OnTimeLineClear() void
Callback to TimeStone's event OnTimeLineClear
RemoveStoneListeners() void
Remove listeners from the TimeStone
TryDisableClone() void
Visualizer is only used by the Original Time Agent. But when a TimeAgent is cloned for simulation, its Visualizers components are cloned with it. So if the time agent is a clone (used by simulation), visualizer is disabled to optimize
UpdateVisualizationStatus() void
Sets flag visualizationEnabled in case the visualizer misses a critical data to be displayed. This flag must be used in the Component extending AbstractTimeVisualizer