Add StickGame Assets

This commit is contained in:
Dzejkobik007
2024-03-24 22:21:16 +01:00
parent 5a5812c0c7
commit 6c8b523d1f
6643 changed files with 596260 additions and 0 deletions

View File

@@ -0,0 +1,83 @@
using UnityEngine;
namespace FishNet.Object.Prediction
{
/// <summary>
/// How to favor smoothing for predicted objects.
/// </summary>
internal enum AdaptiveSmoothingType
{
/// <summary>
/// Favor accurate collisions. With fast moving objects this may result in some jitter with higher latencies.
/// </summary>
Accuracy = 0,
/// <summary>
/// A mix between Accuracy and Smoothness.
/// </summary>
Mixed = 1,
/// <summary>
/// Prefer smooth movement and corrections. Fast moving objects may collide before the graphical representation catches up.
/// </summary>
Gradual = 2,
/// <summary>
/// Configure values to your preference.
/// </summary>
Custom = 3,
}
[System.Serializable]
public struct AdaptiveInterpolationSmoothingData
{
[HideInInspector, System.NonSerialized]
public bool SmoothPosition;
[HideInInspector, System.NonSerialized]
public bool SmoothRotation;
[HideInInspector, System.NonSerialized]
public bool SmoothScale;
[HideInInspector,System.NonSerialized]
public Transform GraphicalObject;
[HideInInspector,System.NonSerialized]
public NetworkObject NetworkObject;
[HideInInspector, System.NonSerialized]
public float TeleportThreshold;
/// <summary>
/// Percentage of ping to use as interpolation. Higher values will result in more interpolation.
/// </summary>
[Tooltip("Percentage of ping to use as interpolation. Higher values will result in more interpolation.")]
[Range(0.01f, 5f)]
public float NormalPercent;
/// <summary>
/// Percentage of ping to use as interpolation when colliding with an object local client owns.
/// This is used to speed up local interpolation when predicted objects collide with a player as well keep graphics closer to the objects root while colliding.
/// </summary>
[Tooltip("Percentage of ping to use as interpolation when colliding with an object local client owns." +
"This is used to speed up local interpolation when predicted objects collide with a player as well keep graphics closer to the objects root while colliding.")]
[Range(0.01f, 5f)]
public float CollisionPercent;
/// <summary>
/// How much per tick to decrease to collision interpolation when colliding with a local player object.
/// Higher values will set interpolation to collision settings faster.
/// </summary>
[Tooltip("How much per tick to decrease to collision interpolation when colliding with a local player object. Higher values will set interpolation to collision settings faster.")]
[Range(0.1f, 10f)]
public float CollisionStep;
/// <summary>
/// How much per tick to increase to normal interpolation when not colliding with a local player object.
/// Higher values will set interpolation to normal settings faster.
/// </summary>
[Tooltip("How much per tick to increase to normal interpolation when not colliding with a local player object. Higher values will set interpolation to normal settings faster.")]
[Range(0.1f, 10f)]
public float NormalStep;
/// <summary>
/// Interpolation applied regardless of settings when colliding with a localClient object.
/// </summary>
internal const byte BASE_COLLISION_INTERPOLATION = 0;
/// <summary>
/// Interpolation applied regardless of settings when not colliding with a localClient object.
/// </summary>
internal const byte BASE_NORMAL_INTERPOLATION = 1;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9fcf00526b5e1bf40a6565c3f521d926
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,48 @@
using System;
namespace FishNet.Object.Prediction
{
/// <summary>
/// Replicated methods are to be called from clients and will run the same data and logic on the server.
/// Only data used as method arguments will be serialized.
/// </summary>
[AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
public class ReplicateAttribute : Attribute
{
/// <summary>
/// How many past datas to resend.
/// </summary>
[Obsolete("Use PredictionManager.RedundancyCount.")] //Remove on 2023/06/01
public byte Resends = 5;
/// <summary>
/// True to allow running input passed in with asServer true when there is no owner.
/// </summary>
public bool AllowServerControl = false;
}
/// <summary>
/// Reconcile methods indicate how to reset your script or object after the server has replicated user data.
/// </summary>
[AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
public class ReconcileAttribute : Attribute
{
/// <summary>
/// How many times to resend reconcile.
/// </summary>
[Obsolete("Use PredictionManager.RedundancyCount.")] //Remove on 2023/06/01
public byte Resends = 3;
}
/// <summary>
/// Replicated methods are to be called from clients and will run the same data and logic on the server.
/// Only data used as method arguments will be serialized.
/// </summary>
[AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
public class ReplicateV2Attribute : Attribute { }
/// <summary>
/// Reconcile methods indicate how to reset your script or object after the server has replicated user data.
/// </summary>
[AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
public class ReconcileV2Attribute : Attribute { }
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b082d36535ce0404d8438bc1b0499e53
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,21 @@
using FishNet.Connection;
using FishNet.Documenting;
using FishNet.Serializing;
using FishNet.Transporting;
using FishNet.Utility.Constant;
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo(UtilityConstants.CODEGEN_ASSEMBLY_NAME)]
namespace FishNet.Object.Prediction.Delegating
{
[APIExclude]
public delegate void ReplicateRpcDelegate(PooledReader reader, NetworkConnection sender, Channel channel);
[APIExclude]
public delegate void ReconcileRpcDelegate(PooledReader reader, Channel channel);
[APIExclude]
public delegate void ReplicateUserLogicDelegate<T>(T data, bool asServer, Channel channel, bool replaying);
[APIExclude]
public delegate void ReconcileUserLogicDelegate<T>(T data, bool asServer, Channel channel);
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c9904192dacd41a4ba7b29bc3199ec3a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,40 @@

namespace FishNet.Object.Prediction
{
public interface IReplicateData
{
/// <summary>
/// Local tick when the data was created.
/// </summary>
/// <returns></returns>
uint GetTick();
/// <summary>
/// Sets the local tick when data was created.
/// </summary>
/// <param name="value"></param>
void SetTick(uint value);
/// <summary>
/// Allows for any cleanup when the data is being discarded.
/// </summary>
void Dispose();
}
public interface IReconcileData
{
/// <summary>
/// Local tick when the data was created.
/// </summary>
/// <returns></returns>
uint GetTick();
/// <summary>
/// Sets the local tick when data was created.
/// </summary>
/// <param name="value"></param>
void SetTick(uint value);
/// <summary>
/// Allows for any cleanup when the data is being discarded.
/// </summary>
void Dispose();
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 515754257f85574438408c7f5b268590
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,232 @@

using GameKit.Utilities;
using System.Runtime.CompilerServices;
namespace FishNet.Object.Prediction
{
/// <summary>
/// Data to be used to configure smoothing for an owned predicted object.
/// </summary>
internal struct MoveRates
{
public float Position;
public float Rotation;
public float Scale;
public MoveRates(float value)
{
Position = value;
Rotation = value;
Scale = value;
}
public MoveRates(float position, float rotation)
{
Position = position;
Rotation = rotation;
Scale = INSTANT_VALUE;
}
public MoveRates(float position, float rotation, float scale)
{
Position = position;
Rotation = rotation;
Scale = scale;
}
/// <summary>
/// True if a positional move rate is set.
/// </summary>
public bool PositionSet => (Position != UNSET_VALUE);
/// <summary>
/// True if rotation move rate is set.
/// </summary>
public bool RotationSet => (Rotation != UNSET_VALUE);
/// <summary>
/// True if a scale move rate is set.
/// </summary>
public bool ScaleSet => (Scale != UNSET_VALUE);
/// <summary>
/// True if any move rate is set.
/// </summary>
public bool AnySet => (PositionSet || RotationSet || ScaleSet);
/// <summary>
/// True if position move rate should be instant.
/// </summary>
public bool InstantPosition => (Position == INSTANT_VALUE);
/// <summary>
/// True if rotation move rate should be instant.
/// </summary>
public bool InstantRotation => (Rotation == INSTANT_VALUE);
/// <summary>
/// True if scale move rate should be instant.
/// </summary>
public bool InstantScale => (Scale == INSTANT_VALUE);
/// <summary>
/// Sets all rates to instant.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetInstantRates()
{
Update(INSTANT_VALUE);
}
/// <summary>
/// Sets all rates to the same value.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Update(float value)
{
Update(value, value, value);
}
/// <summary>
/// Sets rates for each property.
/// </summary>
public void Update(float position, float rotation, float scale)
{
Position = position;
Rotation = rotation;
Scale = scale;
}
/// <summary>
/// Value used when data is not set.
/// </summary>
public const float UNSET_VALUE = float.NegativeInfinity;
/// <summary>
/// Value used when move rate should be instant.
/// </summary>
public const float INSTANT_VALUE = float.PositiveInfinity;
}
/// <summary>
/// Data to be used to configure smoothing for an owned predicted object.
/// </summary>
internal class MoveRatesCls : IResettable
{
public float Position;
public float Rotation;
public float Scale;
public float LastMultiplier { get; private set; } = 1f;
public MoveRatesCls(float value)
{
Position = value;
Rotation = value;
Scale = value;
}
public MoveRatesCls(float position, float rotation)
{
Position = position;
Rotation = rotation;
Scale = INSTANT_VALUE;
}
public MoveRatesCls(float position, float rotation, float scale)
{
Position = position;
Rotation = rotation;
Scale = scale;
}
/// <summary>
/// True if a positional move rate is set.
/// </summary>
public bool PositionSet => (Position != UNSET_VALUE);
/// <summary>
/// True if rotation move rate is set.
/// </summary>
public bool RotationSet => (Rotation != UNSET_VALUE);
/// <summary>
/// True if a scale move rate is set.
/// </summary>
public bool ScaleSet => (Scale != UNSET_VALUE);
/// <summary>
/// True if any move rate is set.
/// </summary>
public bool AnySet => (PositionSet || RotationSet || ScaleSet);
/// <summary>
/// True if position move rate should be instant.
/// </summary>
public bool InstantPosition => (Position == INSTANT_VALUE);
/// <summary>
/// True if rotation move rate should be instant.
/// </summary>
public bool InstantRotation => (Rotation == INSTANT_VALUE);
/// <summary>
/// True if scale move rate should be instant.
/// </summary>
public bool InstantScale => (Scale == INSTANT_VALUE);
public MoveRatesCls()
{
Update(UNSET_VALUE, UNSET_VALUE, UNSET_VALUE);
}
/// <summary>
/// Multiplies all rates by value.
/// </summary>
public void Multiply(float value)
{
LastMultiplier = value;
Position *= value;
Rotation *= value;
Scale *= value;
}
/// <summary>
/// Sets all rates to instant.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetInstantRates()
{
Update(INSTANT_VALUE);
}
/// <summary>
/// Sets all rates to the same value.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Update(float value)
{
Update(value, value, value);
}
/// <summary>
/// Updaes values.
/// </summary>
public void Update(float position, float rotation, float scale)
{
Position = position;
Rotation = rotation;
Scale = scale;
}
/// <summary>
/// Updaes values.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Update(MoveRatesCls mr)
{
Update(mr.Position, mr.Rotation, mr.Scale);
}
public void ResetState()
{
Position = UNSET_VALUE;
Rotation = UNSET_VALUE;
Scale = UNSET_VALUE;
}
public void InitializeState() { }
/// <summary>
/// Value used when data is not set.
/// </summary>
public const float UNSET_VALUE = float.NegativeInfinity;
/// <summary>
/// Value used when move rate should be instant.
/// </summary>
public const float INSTANT_VALUE = float.PositiveInfinity;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1bddf57861232884ca21f7e97a6d662d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
using UnityEngine;
namespace FishNet.Object.Prediction
{
/// <summary>
/// Data to be used to configure smoothing for an owned predicted object.
/// </summary>
internal struct SetInterpolationSmootherData
{
public Transform GraphicalObject;
public byte Interpolation;
public NetworkObject NetworkObject;
public bool SmoothPosition;
public bool SmoothRotation;
public bool SmoothScale;
public float TeleportThreshold;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d5fecbbc171a81f4a8aaf30aebb1caef
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: