• Api Documentation
  • Manual
Show / Hide Table of Contents
  • FishNet
    • InstanceFinder
  • FishNet.Authenticating
    • Authenticator
  • FishNet.Broadcast
    • IBroadcast
  • FishNet.Broadcast.Helping
    • BroadcastHandlerBase
  • FishNet.CodeGenerating
    • AllowMutableSyncTypeAttribute
    • CustomComparerAttribute
    • DefaultDeltaReaderAttribute
    • DefaultDeltaWriterAttribute
    • DefaultReaderAttribute
    • DefaultWriterAttribute
    • ExcludeSerializationAttribute
    • IncludeSerializationAttribute
    • NotSerializerAttribute
    • ReadUnallocatedAttribute
    • UseGlobalCustomSerializerAttribute
  • FishNet.Component.Animating
    • NetworkAnimator
  • FishNet.Component.ColliderRollback
    • ColliderRollback
    • RollbackManager
    • RollbackPhysicsType
  • FishNet.Component.Observing
    • DistanceCondition
    • GridCondition
    • GridEntry
    • HashGrid
    • HashGrid.GridAxes
    • HostOnlyCondition
    • MatchCondition
    • MatchCondition.ConditionCollections
    • OwnerOnlyCondition
    • SceneCondition
  • FishNet.Component.Ownership
    • PredictedOwner
    • PredictedSpawn
  • FishNet.Component.Prediction
    • NetworkCollider
    • NetworkCollider2D
    • NetworkCollision
    • NetworkCollision2D
    • NetworkTrigger
    • NetworkTrigger2D
    • OfflineRigidbody
    • Rigidbody2DState
    • RigidbodyPauser
    • RigidbodyState
    • RigidbodyStateExtensions
    • RigidbodyStateSerializers
    • RigidbodyType
  • FishNet.Component.Scenes
    • DefaultScene
  • FishNet.Component.Spawning
    • PlayerSpawner
  • FishNet.Component.Transforming
    • DetachableNetworkTickSmoother
    • MonoTickSmoother
    • NetworkTickSmoother
    • NetworkTransform
    • NetworkTransform.ComponentConfigurationType
    • NetworkTransform.GoalData
    • NetworkTransform.RateData
    • NetworkTransform.SnappedAxes
    • NetworkTransform.TransformData
    • NetworkTransform.TransformData.ExtrapolateState
    • SynchronizedProperty
  • FishNet.Component.Utility
    • BandwidthDisplay
    • PingDisplay
  • FishNet.Connection
    • NetworkConnection
    • NetworkConnectionExtensions
  • FishNet.Managing
    • NetworkManager
    • NetworkManager.HostIterationOrder
    • NetworkManager.PersistenceType
    • NetworkManagerExtensions
    • RemoteTimeoutType
  • FishNet.Managing.Client
    • ClientManager
    • ClientObjects
  • FishNet.Managing.Debugging
    • DebugManager
  • FishNet.Managing.Logging
    • LevelLoggingConfiguration
    • LoggingConfiguration
    • LoggingType
  • FishNet.Managing.Object
    • DualPrefab
    • ManagedObjects
  • FishNet.Managing.Observing
    • ObserverManager
  • FishNet.Managing.Predicting
    • PredictionManager
    • PredictionManager.PostPhysicsSyncTransformDel
    • PredictionManager.PostReconcileDel
    • PredictionManager.PostReplicateReplayDel
    • PredictionManager.PrePhysicsSyncTransformDel
    • PredictionManager.PreReconcileDel
    • PredictionManager.PreReplicateReplayDel
    • PredictionManager.ReconcileDel
    • PredictionManager.ReplicateReplayDel
    • ReplicateStateOrder
  • FishNet.Managing.Scened
    • ClientPresenceChangeEventArgs
    • DefaultSceneProcessor
    • EmptyStartScenesBroadcast
    • LoadOptions
    • LoadParams
    • LoadQueueData
    • PreferredScene
    • ReplaceOption
    • SceneLoadData
    • SceneLoadEndEventArgs
    • SceneLoadPercentEventArgs
    • SceneLoadStartEventArgs
    • SceneLookupData
    • SceneManager
    • SceneProcessorBase
    • SceneScopeType
    • SceneUnloadData
    • SceneUnloadEndEventArgs
    • SceneUnloadStartEventArgs
    • UnloadedScene
    • UnloadOptions
    • UnloadOptions.ServerUnloadMode
    • UnloadParams
    • UnloadQueueData
  • FishNet.Managing.Server
    • ClientConnectionChangeBroadcast
    • ConnectedClientsBroadcast
    • KickReason
    • ServerManager
    • ServerObjects
  • FishNet.Managing.Statistic
    • NetworkTrafficArgs
    • NetworkTraficStatistics
    • StatisticsManager
  • FishNet.Managing.Timing
    • EstimatedTick
    • EstimatedTick.OldTickOption
    • PhysicsMode
    • PreciseTick
    • PreciseTickExtensions
    • PreciseTickSerializer
    • TickRounding
    • TickType
    • TimeManager
  • FishNet.Managing.Transporting
    • IntermediateLayer
    • LatencySimulator
    • TransportManager
  • FishNet.Managing.Utility
    • Packets
  • FishNet.Object
    • ClientAttribute
    • DataOrderType
    • DespawnType
    • EmptyNetworkBehaviour
    • GlobalPreserveOwnedObjects
    • NetworkBehaviour
    • NetworkObject
    • NetworkObject.HostVisibilityUpdatedDelegate
    • NetworkObjectIdComparer
    • NetworkPreserveOwnedObjects
    • ObserversRpcAttribute
    • ReplicateState
    • ReplicateStateExtensions
    • RpcAttribute
    • ServerAttribute
    • ServerRpcAttribute
    • TargetRpcAttribute
    • TransformProperties
    • TransformPropertiesCls
    • TransformPropertiesFlag
    • TransformPropertiesOptionExtensions
  • FishNet.Object.Prediction
    • AdaptiveInterpolationType
    • ChildTransformTickSmoother
    • IReconcileData
    • IReplicateData
    • PredictionigidbodySerializers
    • PredictionRigidbody
    • PredictionRigidbody.AllForceData
    • PredictionRigidbody.EntryData
    • PredictionRigidbody.ForceApplicationType
    • PredictionRigidbody.IForceData
    • PredictionRigidbody2D
    • PredictionRigidbody2D.AllForceData
    • PredictionRigidbody2D.EntryData
    • PredictionRigidbody2D.ForceApplicationType
    • PredictionRigidbody2D2DSerializers
    • ReconcileAttribute
    • ReplicateAttribute
  • FishNet.Object.Synchronizing
    • ByteSyncVar
    • DoubleSyncVar
    • FloatSyncVar
    • ICustomSync
    • IntSyncVar
    • LongSyncVar
    • ReadPermission
    • SbyteSyncVar
    • ShortSyncVar
    • SyncDictionary<TKey, TValue>
    • SyncHashSet<T>
    • SyncList<T>
    • SyncObjectAttribute
    • SyncStopwatch
    • SyncStopwatch.SyncTypeChanged
    • SyncStopwatchOperation
    • SyncTimer
    • SyncTimer.SyncTypeChanged
    • SyncTimerOperation
    • SyncTypeSettings
    • SyncVarAttribute
    • UIntSyncVar
    • ULongSyncVar
    • UShortSyncVar
    • Vector2IntSyncVar
    • Vector2SyncVar
    • Vector3IntSyncVar
    • Vector3SyncVar
    • Vector4SyncVar
    • WritePermission
  • FishNet.Observing
    • HostVisibilityUpdateTypes
    • NetworkObserver
    • NetworkObserver.ConditionOverrideType
    • ObserverCondition
    • ObserverConditionType
  • FishNet.Serializing
    • AutoPackType
    • DeltaSerializerOption
    • DeltaSerializerOptionExtensions
    • PooledReader
    • PooledWriter
    • Reader
    • Reader.DataSource
    • ReaderPool
    • SubStream
    • Writer
    • WriterPool
  • FishNet.Transporting
    • Channel
    • ClientConnectionStateArgs
    • ClientReceivedDataArgs
    • ConnectedClientsArgs
    • IPAddressType
    • LocalConnectionState
    • RemoteConnectionState
    • RemoteConnectionStateArgs
    • ServerConnectionStateArgs
    • ServerReceivedDataArgs
    • Transport
    • TransportConsts
  • GameKit.Dependencies.Utilities
    • ApplicationState
    • Arrays
    • BasicQueue<T>
    • Booleans
    • Bytes
    • CanvaseGroups
    • CanvasGroupBlockingType
    • CollectionCaches<T>
    • CollectionCaches<T1, T2>
    • Collider2DExtensions
    • ColliderExtensions
    • DictionaryFN
    • Disks
    • Enums
    • Floats
    • Hashing
    • Ints
    • IOs
    • IResettable
    • IWeighted
    • Layers
    • LayoutGroups
    • Materials
    • Maths
    • ObjectCaches<T>
    • Objects
    • Particles
    • PointerMonoBehaviour
    • Quaternions
    • ResettableCollectionCaches<T>
    • ResettableCollectionCaches<T1, T2>
    • ResettableObjectCaches<T>
    • ResettableT1CollectionCaches<T1, T2>
    • ResettableT2CollectionCaches<T1, T2>
    • Strings
    • Transforms
    • UInts
    • Vectors
    • WeightedRandom
  • GameKit.Dependencies.Utilities.ObjectPooling
    • ListStack<GameObject>
    • ObjectPool
    • PoolData
  • GameKit.Dependencies.Utilities.ObjectPooling.Examples
    • Projectile
    • ProjectileSpawner
  • GameKit.Dependencies.Utilities.Types
    • ByteRange
    • CanvasGroupFader
    • CanvasGroupFader.FadeGoalType
    • CanvasTracker
    • DDOL
    • FloatRange
    • FloatRange2D
    • IntRange
    • IOrderable
    • RectTransformResizer
    • RectTransformResizer.ResizeData
    • RectTransformResizer.ResizeDelegate
    • ResettableRingBuffer<T>
    • ResettableRingBuffer<T>.Enumerator
    • RingBuffer<T>
    • RingBuffer<T>.Enumerator
    • SceneAttribute
    • ScrollbarValueSetter
    • SingletonScriptableObject<T>
    • SmoothCameraTarget
    • TimedOperation
    • UIntRange
    • Vector2Range
  • GameKit.Dependencies.Utilities.Types.CanvasContainers
    • ButtonData
    • ButtonData.PressedDelegate
    • FloatingContainer
    • FloatingImage
    • ImageButtonData
    • ResizableContainer
  • GameKit.Dependencies.Utilities.Types.OptionMenuButtons
    • FloatingOptions

Class Floats

Inheritance
System.Object
Floats
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: GameKit.Dependencies.Utilities
Assembly: GameKit.Dependencies.dll
Syntax
public static class Floats

Methods

Clamp(Single, Single, Single, ref Boolean)

Clamps a float and returns if the float required clamping.

Declaration
public static float Clamp(float value, float min, float max, ref bool clamped)
Parameters
Type Name Description
System.Single value
System.Single min
System.Single max
System.Boolean clamped
Returns
Type Description
System.Single

InRange(Single, Single, Single)

Returns if a float is within a range.

Declaration
public static bool InRange(this float source, float rangeMin, float rangeMax)
Parameters
Type Name Description
System.Single source

Value of float.

System.Single rangeMin

Minimum of range.

System.Single rangeMax

Maximum of range.

Returns
Type Description
System.Boolean

Near(Single, Single, Single)

Returns if a target float is within variance of the source float.

Declaration
public static bool Near(this float a, float b, float tolerance = 0.01F)
Parameters
Type Name Description
System.Single a
System.Single b
System.Single tolerance
Returns
Type Description
System.Boolean

PreciseSign(Single)

Returns negative-one, zero, or postive-one of a value instead of just negative-one or positive-one.

Declaration
public static float PreciseSign(float value)
Parameters
Type Name Description
System.Single value

Value to sign.

Returns
Type Description
System.Single

Precise sign.

Random01()

Returns a random float between 0f and 1f.

Declaration
public static float Random01()
Returns
Type Description
System.Single

RandomInclusiveRange(Single, Single)

Provides a random inclusive int within a given range. Preferred over Unity's Random to eliminate confusion as Unity uses inclusive for floats max, and exclusive for int max.

Declaration
public static float RandomInclusiveRange(float minimum, float maximum)
Parameters
Type Name Description
System.Single minimum

Inclusive minimum value.

System.Single maximum

Inclusive maximum value.

Returns
Type Description
System.Single

RandomlyFlip(Single)

Randomly flips a float value.

Declaration
public static float RandomlyFlip(this float value)
Parameters
Type Name Description
System.Single value
Returns
Type Description
System.Single

SetIfOverTolerance(Single, Single, Single)

Sets a source float to value if equal to or greater than tolerance.

Declaration
public static float SetIfOverTolerance(this float source, float tolerance, float value)
Parameters
Type Name Description
System.Single source

Float to check against tolerance.

System.Single tolerance

Tolerance float must be equal to or greater than to change to value.

System.Single value

Value source is set to when breaking tolerance.

Returns
Type Description
System.Single

SetIfUnderTolerance(Single, Single, Single)

Sets a source float to value if equal to or less than tolerance.

Declaration
public static float SetIfUnderTolerance(this float source, float tolerance, float value)
Parameters
Type Name Description
System.Single source

Float to check against tolerance.

System.Single tolerance

Tolerance float must be equal to or less than to change to value.

System.Single value

Value source is set to when breaking tolerance.

Returns
Type Description
System.Single

TimeRemainingText(Single, Byte, Boolean)

Returns time remaining as a string using hh:mm:ss.

Declaration
public static string TimeRemainingText(this float value, byte segments, bool emptyOnZero = false)
Parameters
Type Name Description
System.Single value
System.Byte segments

Number of places to return. 1 is seconds, 2 is minutes, 3 is hours. If a placement does not exist it is replaced with 00.

System.Boolean emptyOnZero

True to return an empty string when value is 0 or less.

Returns
Type Description
System.String

TimeRemainingValue(Single)

Returns how much time is left on an endTime. Returns -1 if no time is left.

Declaration
public static float TimeRemainingValue(this float endTime)
Parameters
Type Name Description
System.Single endTime
Returns
Type Description
System.Single

TimeRemainingValue(Single, Boolean)

Returns how much time is left on an endTime. Returns -1 if no time is left.

Declaration
public static int TimeRemainingValue(this float endTime, bool useFloor = true)
Parameters
Type Name Description
System.Single endTime
System.Boolean useFloor
Returns
Type Description
System.Int32

Variance(Single, Single)

Returns a float after being adjusted by the specified variance.

Declaration
public static float Variance(this float source, float variance)
Parameters
Type Name Description
System.Single source
System.Single variance
Returns
Type Description
System.Single

Variance(Single, Single, ref Single)

Sets a float value to result after being adjusted by the specified variance.

Declaration
public static void Variance(this float source, float variance, ref float result)
Parameters
Type Name Description
System.Single source
System.Single variance
System.Single result
In This Article
Back to top Generated by DocFX