GenericTimeAgent Class

Summary

TimeAgent implementation adding a generic way to persist custom properties.

This component is made to make things simple, but it should not be used in production if performances are critical. Because Reflection is used to get custom properties values and it will always be way more slower than direct access.

To get the same result with no performance impact, use TimeAgent UnityEvent or extend TimeAgent with your own class

Namespace
RedGirafeGames.Agamotto.Scripts.Runtime.Agents
Base Types
graph BT Type-->Base0["TimeAgent"] click Base0 "/api/RedGirafeGames.Agamotto.Scripts.Runtime.Agents/TimeAgent" Base0-->Base1["MonoBehaviour"] Type["GenericTimeAgent"] class Type type-node

Syntax

[RequireComponent(typeof(Transform))]
[AddComponentMenu("Agamotto/Generic Time Agent")]
public class GenericTimeAgent : TimeAgent

Attributes

Type Description
RequireComponent
AddComponentMenu

Fields

Name Constant Value Summary
ActiveDataId GameObjectActiveSelf
GameObject.activeSelf id to persist in the TimeStone
Inherited from TimeAgent
static
agentAnimator
The Animator component to persist. If not defined, automatically get gameObject's Animator
Inherited from TimeAgent
agentRigidbody
Cached value of Rigidbody
Inherited from TimeAgent
AngularVelocityDataId RigidbodyAngularVelocity
Rigidbody.angularVelocity id to persist in the TimeStone
Inherited from TimeAgent
static
AnimatorStateHashDataId Animator#StateHash
Animator's state hash where DataIdUidToken is replaced with a unique identifier using GetUniqueDataId(string, int)
Inherited from TimeAgent
static
AnimatorStateInTransitionDataId Animator#InTransition
Animator's state transition status where DataIdUidToken is replaced with a unique identifier using GetUniqueDataId(string, int)
Inherited from TimeAgent
static
AnimatorStateLayerWeightDataId Animator#LayerWeight
Animator's state layer weight where DataIdUidToken is replaced with a unique identifier using GetUniqueDataId(string, int)
Inherited from TimeAgent
static
AnimatorStateNormalizedTimeDataId Animator#StateNormalizedTime
Animator state normalized time where DataIdUidToken is replaced with the layer num using GetAnimatorDataIdWithLayer
Inherited from TimeAgent
static
AnimatorTransitionDurationDataId Animator#TransitionDuration
Animator's transition duration where DataIdUidToken is replaced with a unique identifier using GetUniqueDataId(string, int)
Inherited from TimeAgent
static
AnimatorTransitionNextHashDataId Animator#TransitionNextHash
Animator's transition next hash where DataIdUidToken is replaced with a unique identifier using GetUniqueDataId(string, int)
Inherited from TimeAgent
static
AnimatorTransitionNextNormalizedTimeDataId Animator#TransitionNextNormalizedTime
Animator's transition next normalized time where DataIdUidToken is replaced with a unique identifier using GetUniqueDataId(string, int)
Inherited from TimeAgent
static
AnimatorTransitionNormalizedTimeDataId Animator#TransitionNormalizedTime
Animator's transition normalized time where DataIdUidToken is replaced with a unique identifier using GetUniqueDataId(string, int)
Inherited from TimeAgent
static
applyColorToClone
Applies cloneColor to the clone material
Inherited from TimeAgent
applySimulationConfigOnChildren
If true, cloneColor and cloneMaterial are applied on clone's children recursively
Inherited from TimeAgent
autoPersistedDataIdComponentTypes
The list of the ComponentNames persisted, must be synchronized with autoPersistedDataIdMemberNames
autoPersistedDataIdMemberNames
The list of the MemberNames persisted, must be synchronized with autoPersistedDataIdComponentTypes
cloneColor
The color applied to the clone if applyColorToClone is true
Inherited from TimeAgent
cloneMaterial
The material applied to the clone. If null, no material is applied.
Inherited from TimeAgent
guid
Unique ID shared by the original TimeAgent and the cloned TimeAgent used by simulations
Inherited from TimeAgent
hidePolicy
How the simulation clone is hidden (or not)
Inherited from TimeAgent
logDebug
Log all messages
Inherited from TimeAgent
parseChildren
TimeAgents will be searched in children on TimeStone initialization
Inherited from TimeAgent
ParticleSystemParticlesDataId ParticleSystem#Particles
ParticleSystem particles where DataIdUidToken is replaced with a unique identifier using GetParticleSystemUniqueDataId
Inherited from TimeAgent
static
ParticleSystemPlaybackStateDataId ParticleSystem#PlaybackState
ParticleSystem playback state where DataIdUidToken is replaced with a unique identifier using GetParticleSystemUniqueDataId
Inherited from TimeAgent
static
ParticleSystemTrailsDataId ParticleSystem#Trails
ParticleSystem trails where DataIdUidToken is replaced with a unique identifier using GetParticleSystemUniqueDataId
Inherited from TimeAgent
static
persistActive
Persist GameObject.activeSelf in TimeStone
Inherited from TimeAgent
persistAnimator
Persist Animator's state in TimeStone
Inherited from TimeAgent
persistAnimatorTransitions
Persist Animator's transitions between states.
Inherited from TimeAgent
persistParticles
Persist TimeAgent's particle systems in TimeStone
Inherited from TimeAgent
persistParticlesList
The list of ParticleSystem to persist. If empty, automatically get gameObject's ParticleSystem
Inherited from TimeAgent
persistPosition
Persist Transform.position in TimeStone
Inherited from TimeAgent
persistRotation
Persist Transform.rotation in TimeStone
Inherited from TimeAgent
persistScale
Persist Transform.localScale in TimeStone
Inherited from TimeAgent
persistVelocity
Persist Rigidbody.velocity and Rigidbody.angularVelocity in TimeStone
Inherited from TimeAgent
PositionDataId TransformPosition
Transform.position id to persist in the TimeStone
Inherited from TimeAgent
static
PositionLocalDataId TransformLocalPosition
Transform.localPosition id to persist in the TimeStone
Inherited from TimeAgent
static
RotationDataId TransformRotation
Transform.rotation id to persist in the TimeStone
Inherited from TimeAgent
static
RotationLocalDataId TransformLocalRotation
Transform.localRotation id to persist in the TimeStone
Inherited from TimeAgent
static
ScaleDataId TransformScale
Transform.localScale id to persist in the TimeStone
Inherited from TimeAgent
static
searchParticleChildren
Search for ParticleSystem in children
Inherited from TimeAgent
simulationCallbackPolicy
The simulation events receive policy. In most of the cases, original time agents won't have any use of these events, so setting the policy to CloneOnly there is no need in the code to check for IsClone
Inherited from TimeAgent
useLocalPosition
Inherited from TimeAgent
useLocalRotation
Inherited from TimeAgent
VelocityDataId RigidbodyVelocity
Rigidbody.velocity id to persist in the TimeStone
Inherited from TimeAgent
static

Properties

Methods

Name Value Summary
AddCustomDataId(string, string) bool
Add a custom data to be persisted to the component's list. No security is made to check if the component and its member really exist
ApplyCachedInitDataOnClone() void
Applies the data cached on simulation initialization
Inherited from TimeAgent
Awake() void
Inherited from TimeAgent
CacheComponentsByType() void
Cache GameObject's components by type
CacheInitDataFromOriginal() void
Cache initialization data from the Original object to apply them on the cloned Simulation object when Simulation starts
Inherited from TimeAgent
Clear() void
Clear automatically persisted components and members
ClonedForSimulation(TimeStone) void
ClonedForSimulation callback called by timeStone
Inherited from TimeAgent
GetClone() GameObject
Cloning method called by the TimeStone when creating a simulation scene. You can override it to modify the way the object is cloned.
Inherited from TimeAgent
GetComponentByType(string) Component
Get GameObject's component by its type
InitTimeAgentsList(TimeStone) void
InitTimeAgentsList callback called by timeStone
Inherited from TimeAgent
PersistGameObjectState(TimeStone, TimeStone.TimeTickOrigin, float) void
Perists GameObject's data
Inherited from TimeAgent
PersistRigidbodyData(TimeStone, TimeStone.TimeTickOrigin, float) void
Persists Rigidbody's data
Inherited from TimeAgent
PersistTick(TimeStone, TimeStone.TimeTickOrigin, float) void
Override of PersistTick(TimeStone, TimeStone.TimeTickOrigin, float) to add the persistence of custom generic data using Reflection
PersistTransformData(TimeStone, TimeStone.TimeTickOrigin, float) void
Persists Transform's data
Inherited from TimeAgent
RemoveCustomDataId(string, string) bool
Remove a custom data from automatic persistence.
SetDataTick(TimeStone, int) void
Override of SetDataTick(TimeStone, int) to apply custom generic properties using Reflection
SetDataTime(TimeStone, float) void
Set data from the stone but using time
Inherited from TimeAgent
SimulationComplete(TimeStone) void
SimulationComplete callback called by timeStone
Inherited from TimeAgent
SimulationFixedUpdate(float, TimeStone) void
SimulationUpdate callback called by timeStone
Inherited from TimeAgent
SimulationLateUpdate(float, TimeStone) void
SimulationLateUpdate callback called by timeStone
Inherited from TimeAgent
SimulationSceneReady(TimeStone) void
SimulationSceneReady callback
SimulationStart(TimeStone) void
SimulationStart callback called by timeStone
Inherited from TimeAgent
SimulationUpdate(float, TimeStone) void
SimulationUpdate callback called by timeStone.
Inherited from TimeAgent
TimeLineChange(TimeStone, TimeStone.TimeTickOrigin) void
TimeLineChange callback called by timeStone
Inherited from TimeAgent