Empeld
Empeld plugin documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
pluginbase.Objects.Syncable.Validators.ValidateVectorDeltaAttribute Class Reference

Validation attribute that makes sure a vector doesn't move further than a certain speed More...

Inheritance diagram for pluginbase.Objects.Syncable.Validators.ValidateVectorDeltaAttribute:
pluginbase.Objects.Syncable.ValidateAttribute pluginbase.Objects.Syncable.IValidator< in T >

Public Member Functions

 ValidateVectorDeltaAttribute (float maxMovementPerSecond)
 Initializes a new instance of the pluginbase.Objects.Syncable.Validators.ValidateVectorDeltaAttribute class. More...
 
bool Validate (Vector3 current, Vector3 proposed, DecodeContext context)
 Validate a change of a previous to a new proposed value More...
 
- Public Member Functions inherited from pluginbase.Objects.Syncable.ValidateAttribute
 ValidateAttribute (SyncableEndpoint validateBy=SyncableEndpoint.Server)
 Initializes a new instance of the pluginbase.Objects.Syncable.ValidateAttribute class. More...
 
- Public Member Functions inherited from pluginbase.Objects.Syncable.IValidator< in T >
bool Validate (T current, T proposed, DecodeContext context)
 Validate a change of a previous to a new proposed value More...
 

Additional Inherited Members

- Properties inherited from pluginbase.Objects.Syncable.ValidateAttribute
SyncableEndpoint ValidateBy [get]
 Which endpoint does the validation More...
 
- Properties inherited from pluginbase.Objects.Syncable.IValidator< in T >
SyncableEndpoint ValidateBy [get]
 Which endpoint does the validation More...
 

Detailed Description

Validation attribute that makes sure a vector doesn't move further than a certain speed

Attribute: AttributeUsage(AttributeTargets.Field)

Constructor & Destructor Documentation

pluginbase.Objects.Syncable.Validators.ValidateVectorDeltaAttribute.ValidateVectorDeltaAttribute ( float  maxMovementPerSecond)

Initializes a new instance of the pluginbase.Objects.Syncable.Validators.ValidateVectorDeltaAttribute class.

Parameters
maxMovementPerSecondMax movement per second.
20  {
21  _maxMovement = maxMovementPerSecond;
22  }

Member Function Documentation

bool pluginbase.Objects.Syncable.Validators.ValidateVectorDeltaAttribute.Validate ( Vector3  current,
Vector3  proposed,
DecodeContext  context 
)

Validate a change of a previous to a new proposed value

Parameters
currentCurrent.
proposedProposed.
contextContext.
31  {
32  return (proposed - current).Length <= _maxMovement * context.TimeState.Delta;
33  }

The documentation for this class was generated from the following file: