Struct ProtectedVector4Int
Drop-in replacement for an integer-component Vector4 that obfuscates each component in memory and reports tampering to the
Implements
Namespace: GUPS.AntiCheat.Protected
Assembly: cs.temp.dll.dll
Syntax
public struct ProtectedVector4Int
Remarks
Unity has no built-in Vector4Int, so this type stores the honeypot as a
Constructors
ProtectedVector4Int(Vector4)
Initializes a new protected Vector4Int with the specified value.
Declaration
public ProtectedVector4Int(Vector4 _Value)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | _Value | Initial value; non-integral components are truncated. |
Properties
HasIntegrity
Gets a value indicating whether the protected value still has integrity (i.e. the honeypot has not been tampered with).
Declaration
public bool HasIntegrity { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Value
Gets or sets the unobfuscated value.
Declaration
public Vector4 Value { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Remarks
Reading the value runs an integrity check; if the honeypot has been tampered with, the
Methods
CheckIntegrity()
Returns true when the honeypot still matches the obfuscated value.
Declaration
public bool CheckIntegrity()
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Dispose()
Clears the obfuscated components and the secret.
Declaration
public void Dispose()
Equals(Object)
Returns true when this protected vector equals the given object.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | Object to compare with. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Overrides
GetHashCode()
Returns the hash code of the unobfuscated value.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 | Hash code of the unobfuscated value. |
Overrides
Obfuscate()
Rerolls the secret and re-obfuscates the current value.
Declaration
public void Obfuscate()
OnAfterDeserialize()
Unity deserialization hook; rebuilds the obfuscation state from the deserialized honeypot value.
Declaration
public void OnAfterDeserialize()
OnBeforeSerialize()
Unity serialization hook; writes the true value into the honeypot field.
Declaration
public void OnBeforeSerialize()
ToString()
Returns the string representation of the unobfuscated value.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String | The string representation of the unobfuscated value. |
Overrides
Operators
Equality(ProtectedVector4Int, ProtectedVector4Int)
Returns true when both protected vectors represent the same value.
Declaration
public static bool operator ==(ProtectedVector4Int v1, ProtectedVector4Int v2)
Parameters
| Type | Name | Description |
|---|---|---|
| ProtectedVector4Int | v1 | First operand. |
| ProtectedVector4Int | v2 | Second operand. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Implicit(ProtectedQuaternion to ProtectedVector4Int)
Implicitly converts a ProtectedQuaternion to a protected Vector4Int (components are truncated to integers).
Declaration
public static implicit operator ProtectedVector4Int(ProtectedQuaternion _Value)
Parameters
| Type | Name | Description |
|---|---|---|
| ProtectedQuaternion | _Value | Protected Quaternion to convert. |
Returns
| Type | Description |
|---|---|
| ProtectedVector4Int | A protected Vector4Int holding the truncated x/y/z/w components. |
Implicit(ProtectedVector4Int to ProtectedQuaternion)
Implicitly converts a protected Vector4Int to a ProtectedQuaternion.
Declaration
public static implicit operator ProtectedQuaternion(ProtectedVector4Int _Value)
Parameters
| Type | Name | Description |
|---|---|---|
| ProtectedVector4Int | _Value | Protected Vector4Int to convert. |
Returns
| Type | Description |
|---|---|
| ProtectedQuaternion | A protected Quaternion built from the x/y/z/w components. |
Implicit(ProtectedVector4Int to Vector4)
Implicitly unwraps a protected Vector4Int to its
Declaration
public static implicit operator Vector4(ProtectedVector4Int _Value)
Parameters
| Type | Name | Description |
|---|---|---|
| ProtectedVector4Int | _Value | Protected Vector4Int to unwrap. |
Returns
| Type | Description |
|---|---|
| Vector4 | The unobfuscated Vector4 value. |
Implicit(Vector4 to ProtectedVector4Int)
Implicitly wraps a
Declaration
public static implicit operator ProtectedVector4Int(Vector4 _Value)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | _Value | Value to wrap. |
Returns
| Type | Description |
|---|---|
| ProtectedVector4Int | A protected Vector4Int holding the truncated value. |
Inequality(ProtectedVector4Int, ProtectedVector4Int)
Returns true when the two protected vectors represent different values.
Declaration
public static bool operator !=(ProtectedVector4Int v1, ProtectedVector4Int v2)
Parameters
| Type | Name | Description |
|---|---|---|
| ProtectedVector4Int | v1 | First operand. |
| ProtectedVector4Int | v2 | Second operand. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|