GamePropertyEventArgsT Class |
Namespace: DigitalRune.Game
The GamePropertyEventArgsT type exposes the following members.
Name | Description | |
---|---|---|
Equals | (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
CoercedValue |
Gets or sets the coerced value.
| |
NewValue |
Gets the new value of the game object property.
| |
OldValue |
Gets the old value of the game object property.
| |
Property |
Gets the game object property.
|
These type of event arguments are passed to event handlers when the value of a game object property changes. This class stores the OldValue and the NewValue of the property. Event handlers of the Changing can set the CoercedValue to coerce the property to a corrected value. CoercedValue is not used in Changed events.
In detail: When the user calls a SetValue method of a GameObject the Changing event is raised (unless the new value is the same as the current property value). The OldValue of the event arguments is set to the current property value. NewValue and CoercedValue are set to the value that was specified in SetValue. The Changing event handlers can change the CoercedValue. After all Changing event handlers have been called the property value is set to the CoercedValue. After that, if the CoercedValue is different from the OldValue, the Changed event is raised. In the event arguments the OldValue is the same as in the Changing event. NewValue is set to the new property value (which is the coerced value). CoercedValue is not used in Changed events.
Important: Event handlers of the Changing and Changed events should not directly change the game object property using a SetValue method. This can result in unexpected behavior. The CoercedValue property of this event arguments can be used instead.