mirror of
https://github.com/Kaveinator/NetickProForUnity.git
synced 2025-10-26 01:49:05 -07:00
Read the description for detailed changes.
- Added `Sandbox.Players`: a synchronized list of `NetworkPlayerId` structs representing connected players. - Added `Sandbox.Events.OnPlayerJoined` and `Sandbox.Events.OnPlayerLeft` callbacks, synchronized across all clients. - Changed internal interpolation of quaternions to use `Slerp` instead of `Lerp`. - Fixed a potential crash caused by undefined behavior when reaching `NetickConfig.MaxPlayers` and destroying network objects. - Fixed an issue where sandbox-loaded scenes were not being unloaded during shutdown. - Fixed a bug preventing Prediction Error Correction from functioning correctly.
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -15,7 +15,6 @@
|
|||||||
<param name="inputSource">The input source to compensate for.</param>
|
<param name="inputSource">The input source to compensate for.</param>
|
||||||
<param name="maxDistance">The max distance the ray should check for collisions.</param>
|
<param name="maxDistance">The max distance the ray should check for collisions.</param>
|
||||||
<param name="layerMask">A that is used to selectively ignore Colliders when casting a ray.</param>
|
<param name="layerMask">A that is used to selectively ignore Colliders when casting a ray.</param>
|
||||||
<param name="includeUnityColliders">Choose whether you want to include normal unity colliders, or only Netick HitShapes.</param>
|
|
||||||
<returns>Returns true if the ray intersects with a Collider/HitShape, otherwise false.</returns>
|
<returns>Returns true if the ray intersects with a Collider/HitShape, otherwise false.</returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:Netick.Pro.LagCompensation.RaycastAll(System.Numerics.Vector3,System.Numerics.Vector3,System.Collections.Generic.List{Netick.Pro.NetHit},Netick.NetworkPlayer,System.Single,System.Int32,System.Boolean,System.Boolean)">
|
<member name="M:Netick.Pro.LagCompensation.RaycastAll(System.Numerics.Vector3,System.Numerics.Vector3,System.Collections.Generic.List{Netick.Pro.NetHit},Netick.NetworkPlayer,System.Single,System.Int32,System.Boolean,System.Boolean)">
|
||||||
@@ -38,7 +37,6 @@
|
|||||||
<param name="hits"></param>
|
<param name="hits"></param>
|
||||||
<param name="inputSource">The input source to compensate for.</param>
|
<param name="inputSource">The input source to compensate for.</param>
|
||||||
<param name="layerMask">A defines which layers of colliders to include in the query.</param>
|
<param name="layerMask">A defines which layers of colliders to include in the query.</param>
|
||||||
<param name="includeUnityColliders">Choose whether you want to include normal unity colliders, or only Netick HitShapes.</param>
|
|
||||||
<param name="oneHitPerHitShapeContainer">Choose whether you want to include only one HitShape per HitShapeContainer</param>
|
<param name="oneHitPerHitShapeContainer">Choose whether you want to include only one HitShape per HitShapeContainer</param>
|
||||||
</member>
|
</member>
|
||||||
</members>
|
</members>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -4,9 +4,69 @@
|
|||||||
<name>Netick</name>
|
<name>Netick</name>
|
||||||
</assembly>
|
</assembly>
|
||||||
<members>
|
<members>
|
||||||
|
<member name="M:Netick.NativeUDPSocket.Deinitialize">
|
||||||
|
--------------------------------------------------------------------------------------------------------------
|
||||||
|
--------------------------------------------------------------------------------------------------------------
|
||||||
|
--------------------------------------------------------------------------------------------------------------
|
||||||
|
--------------------------------------------------------------------------------------------------------------
|
||||||
|
</member>
|
||||||
<member name="M:Netick.NetickTransport.OnConnectRequest(Netick.NetworkConnectionRequest)">
|
<member name="M:Netick.NetickTransport.OnConnectRequest(Netick.NetworkConnectionRequest)">
|
||||||
-------------------------------
|
-------------------------------
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:Netick.SequenceId">
|
||||||
|
<summary>
|
||||||
|
A rolling sequence counter for ordering values. Repeats indefinitely
|
||||||
|
with 1022 possible unique values (0 is treated as invalid internally).
|
||||||
|
|
||||||
|
Consumes 10 bits when encoded for transmission.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.NotServerException.#ctor">
|
||||||
|
<summary>
|
||||||
|
Constructs a NotServerException
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.NotServerException.#ctor(System.String)">
|
||||||
|
<summary>
|
||||||
|
Constructs a NotServerException with a message
|
||||||
|
</summary>
|
||||||
|
<param name="message">The exception message</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.NotServerException.#ctor(System.String,System.Exception)">
|
||||||
|
<summary>
|
||||||
|
Constructs a NotServerException with a message and a inner exception
|
||||||
|
</summary>
|
||||||
|
<param name="message">The exception message</param>
|
||||||
|
<param name="inner">The inner exception</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.NotClientException.#ctor">
|
||||||
|
<summary>
|
||||||
|
Constructs a NotClientException
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.NotClientException.#ctor(System.String)">
|
||||||
|
<summary>
|
||||||
|
Constructs a NotClientException with a message
|
||||||
|
</summary>
|
||||||
|
<param name="message">The exception message</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.NotClientException.#ctor(System.String,System.Exception)">
|
||||||
|
<summary>
|
||||||
|
Constructs a NotClientException with a message and a inner exception
|
||||||
|
</summary>
|
||||||
|
<param name="message">The exception message</param>
|
||||||
|
<param name="inner">The inner exception</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.BadPacketException.#ctor">
|
||||||
|
<summary>
|
||||||
|
Constructs a BadPacketException
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:Netick.NetworkPlayerId">
|
||||||
|
<summary>
|
||||||
|
Represents an networked struct identifier for a <see cref="T:Netick.NetworkPlayer"/>.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="T:Netick.NetworkQueueSnapshot`1">
|
<member name="T:Netick.NetworkQueueSnapshot`1">
|
||||||
<summary>
|
<summary>
|
||||||
A snapshot of the state of a <see cref="T:Netick.NetworkQueue`1"/> collection. Note this must not be used outside the scope of an OnChanged call or a NetworkRender call.
|
A snapshot of the state of a <see cref="T:Netick.NetworkQueue`1"/> collection. Note this must not be used outside the scope of an OnChanged call or a NetworkRender call.
|
||||||
@@ -17,6 +77,325 @@
|
|||||||
A networked <see cref="T:System.Collections.Generic.Queue`1"/> collection.
|
A networked <see cref="T:System.Collections.Generic.Queue`1"/> collection.
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:Netick.AdaptiveRemoteInterpolation.CurrentBufferTime">
|
||||||
|
<summary>
|
||||||
|
Interpolation time in seconds.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Netick.AdaptiveRemoteInterpolation.Time">
|
||||||
|
<summary>
|
||||||
|
Time in seconds.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:Netick.Interpolator">
|
||||||
|
<summary>
|
||||||
|
A struct that is used to obtain interpolation data for a network variable.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.Interpolator.GetInterpolationData``1(Netick.InterpolationSource,``0@,``0@,System.Single@)">
|
||||||
|
<summary>
|
||||||
|
Tries to obtain interpolation data for this frame.
|
||||||
|
</summary>
|
||||||
|
<param name="interpolationSource"></param>
|
||||||
|
<param name="from"></param>
|
||||||
|
<param name="to"></param>
|
||||||
|
<param name="alpha"></param>
|
||||||
|
<returns>Returns true if there was interpolation data for this frame.</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.Interpolator.GetInterpolationData``1(Netick.InterpolationSource,System.Int32,``0@,``0@,System.Single@)">
|
||||||
|
<summary>
|
||||||
|
Tries to obtain interpolation data for this frame. This is the array version.
|
||||||
|
</summary>
|
||||||
|
<param name="interpolationSource"></param>
|
||||||
|
<param name="from"></param>
|
||||||
|
<param name="to"></param>
|
||||||
|
<param name="alpha"></param>
|
||||||
|
<returns>Returns true if there was interpolation data for this frame.</returns>
|
||||||
|
</member>
|
||||||
|
<member name="T:Netick.Interpolation">
|
||||||
|
<summary>
|
||||||
|
A class representing an abstract interpolation interface, which is implemented by <see cref="T:Netick.RemoteInterpolation"/> and <see cref="T:Netick.LocalInterpolation"/>
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:Netick.LocalInterpolation">
|
||||||
|
<summary>
|
||||||
|
A class representing the local interpolation of this instance <see cref="T:Netick.NetickEngine"/>. This should be used whenever you want to use Predicted Timeline on the client.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Netick.LocalInterpolation.Time">
|
||||||
|
<summary>
|
||||||
|
Time in seconds.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:Netick.RemoteInterpolation">
|
||||||
|
<summary>
|
||||||
|
A class representing the remote interpolation of this instance <see cref="T:Netick.NetickEngine"/>. This should be used whenever you want to use Remote Timeline on the client.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Netick.RemoteInterpolation.CurrentBufferTime">
|
||||||
|
<summary>
|
||||||
|
Interpolation time in seconds.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Netick.RemoteInterpolation.Time">
|
||||||
|
<summary>
|
||||||
|
Time in seconds.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Netick.OnChangedData.InvokedForMisprediction">
|
||||||
|
<summary>
|
||||||
|
Returns true if this OnChanged callback is due to a mismatch between the state of this variable before rollback, and the state after rollback and resimulation.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.OnChangedData.GetPreviousNetworkDictionary``2(Netick.NetworkDictionary{``0,``1})">
|
||||||
|
<summary>
|
||||||
|
Gets a snapshot of the previous state of a NetworkDictionary collection.
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.OnChangedData.GetPreviousNetworkHashSet``1(Netick.NetworkHashSet{``0})">
|
||||||
|
<summary>
|
||||||
|
Gets a snapshot of the previous state of a NetworkHashSet collection.
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.OnChangedData.GetPreviousNetworkLinkedList``1(Netick.NetworkLinkedList{``0})">
|
||||||
|
<summary>
|
||||||
|
Gets a snapshot of the previous state of a NetworkLinkedList collection.
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.OnChangedData.GetPreviousNetworkUnorderedList``1(Netick.NetworkUnorderedList{``0})">
|
||||||
|
<summary>
|
||||||
|
Gets a snapshot of the previous state of a NetworkUnorderedList collection.
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.OnChangedData.GetPreviousNetworkQueue``1(Netick.NetworkQueue{``0})">
|
||||||
|
<summary>
|
||||||
|
Gets a snapshot of the previous state of a NetworkQueue collection.
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.OnChangedData.GetPreviousNetworkStack``1(Netick.NetworkStack{``0})">
|
||||||
|
<summary>
|
||||||
|
Gets a snapshot of the previous state of a NetworkStack collection.
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.OnChangedData.GetPreviousValue``1">
|
||||||
|
<summary>
|
||||||
|
Gets previous value for the changed network property.
|
||||||
|
<para>Note: this must only be used with non-array network properties. For arrays, use <see cref="M:Netick.OnChangedData.GetArrayPreviousElementValue``1(System.Int32)"/> instead. </para>
|
||||||
|
</summary>
|
||||||
|
<typeparam name="T"></typeparam>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.OnChangedData.GetPreviousValueAsPointer">
|
||||||
|
<summary>
|
||||||
|
Gets a pointer to the previous value
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.OnChangedData.GetArrayChangedElementIndex">
|
||||||
|
<summary>
|
||||||
|
Gets the index of the changed element of the array.
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.OnChangedData.GetArrayPreviousElementValue``1(System.Int32)">
|
||||||
|
<summary>
|
||||||
|
Gets the value of the changed element of the array. This is an unsafe method, use it carefully and make sure to never go outside range to avoid a crash.
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.OnChangedData.GetArrayPreviousElementValue``1">
|
||||||
|
<summary>
|
||||||
|
Gets the index of the changed element of the array.
|
||||||
|
</summary>
|
||||||
|
<typeparam name="T"></typeparam>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="T:Netick.NetworkDictionarySnapshot`2">
|
||||||
|
<summary>
|
||||||
|
A snapshot of the state of a <see cref="T:Netick.NetworkDictionary`2"/> collection. Note this must not be used outside the scope of an OnChanged call or a NetworkRender call.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:Netick.NetworkDictionary`2">
|
||||||
|
<summary>
|
||||||
|
A networked <see cref="T:System.Collections.Generic.Dictionary`2"/> collection.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:Netick.OnChanged">
|
||||||
|
<summary>
|
||||||
|
Use this attribute on a method you want to call when a specific property value changes. Example: [OnChanged(nameof(PropertyName)]
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:Netick.Rpc">
|
||||||
|
<summary>
|
||||||
|
Use this attribute on any method you want to make an RPC. Should have the return type of void.
|
||||||
|
<para> * Use the parameter "source" to specify who is allowed to send this RPC.</para>
|
||||||
|
<para> * Use the parameter "target" to specify who is allowed to receive and execute this RPC.</para>
|
||||||
|
<para> * Use the parameter "isReliable" to specify if this Rpc should be reliable or not, meaning it won't be lost (due to packet loss).</para>
|
||||||
|
<para> * Use the parameter "localInvoke" to specify if this Rpc should be executed on the machine it was called from.</para>
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:Netick.NetworkHashSetSnapshot`1">
|
||||||
|
<summary>
|
||||||
|
A snapshot of the state of a <see cref="T:Netick.NetworkHashSet`1"/> collection. Note this must not be used outside the scope of an OnChanged call or a NetworkRender call.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:Netick.NetworkHashSet`1">
|
||||||
|
<summary>
|
||||||
|
A networked <see cref="T:System.Collections.Generic.HashSet`1"/> collection.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:Netick.NetworkStackSnapshot`1">
|
||||||
|
<summary>
|
||||||
|
A snapshot of the state of a <see cref="T:Netick.NetworkStack`1"/> collection. Note this must not be used outside the scope of an OnChanged call or a NetworkRender call.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:Netick.NetworkStack`1">
|
||||||
|
<summary>
|
||||||
|
A networked <see cref="T:System.Collections.Generic.Stack`1"/> collection.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:Netick.NetworkLinkedListSnapshot`1">
|
||||||
|
<summary>
|
||||||
|
A snapshot of the state of a <see cref="T:Netick.NetworkLinkedList`1"/> collection. Note this must not be used outside the scope of an OnChanged call or a NetworkRender call.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:Netick.NetworkLinkedListNode`1.Index">
|
||||||
|
<summary>
|
||||||
|
Index of this node within the collection.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:Netick.NetworkLinkedListNode`1.Next">
|
||||||
|
<summary>
|
||||||
|
Index of the next node.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:Netick.NetworkLinkedListNode`1.Previous">
|
||||||
|
<summary>
|
||||||
|
Index of the previous node.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:Netick.NetworkLinkedList`1">
|
||||||
|
<summary>
|
||||||
|
A networked linked list collection. This is an ordered list meaning that the elements insertion order is maintained when iterating through the collection.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:Netick.NetworkPlayer">
|
||||||
|
<summary>
|
||||||
|
Represents a network player, which can be either a local player (representing this player) or a remote connection (representing a connected client)).
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Netick.NetworkPlayer.PlayerId">
|
||||||
|
<summary>
|
||||||
|
The networked index of this player.
|
||||||
|
<para>Note: it returns -1 on the client for the local player when not connected to a server.</para>
|
||||||
|
<para>Note: the server player always has Id 0.</para>
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Netick.NetworkPlayer.PlayerObject">
|
||||||
|
<summary>
|
||||||
|
Use this to associate an object with this player. This is a local variable that is not synced.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Netick.NetickEngine.ConnectedClients">
|
||||||
|
<summary>
|
||||||
|
A list containing all connected clients currently.
|
||||||
|
<para>Note: if you want the clients + the server, use <see cref="P:Netick.NetickEngine.ConnectedPlayers"/>.</para>
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Netick.NetickEngine.ConnectedPlayers">
|
||||||
|
<summary>
|
||||||
|
<para>A list containing all connected clients currently, in addition to the server.</para>
|
||||||
|
<para>Note: if you only want the clients, use <see cref="P:Netick.NetickEngine.ConnectedClients"/>.</para>
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Netick.NetickEngine.ServerEndPoint">
|
||||||
|
<summary>
|
||||||
|
<c><b>[Client Only]</b></c> The <see cref="T:System.Net.IPEndPoint"/> of the server you are connected to. Returns null if you are not connected to any server, or if you are the server.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Netick.NetickEngine.IsConnected">
|
||||||
|
<summary>
|
||||||
|
<c><b>[Client Only]</b></c> Returns true if this client is currently connected to a server.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Netick.NetickEngine.FixedDeltaTime">
|
||||||
|
<summary>
|
||||||
|
Time period between simulation ticks.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<!-- Badly formed XML comment ignored for member "P:Netick.NetickEngine.Tick" -->
|
||||||
|
<member name="P:Netick.NetickEngine.IsResimulating">
|
||||||
|
<summary>
|
||||||
|
Returns true if we are currently resimulating a previous input/tick of the past. On the server, it always returns false since <b>only the clients resimulate</b>.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Netick.NetickEngine.InKBps">
|
||||||
|
<summary>
|
||||||
|
Incoming data in kilobytes per second (KBps).
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Netick.NetickEngine.OutKBps">
|
||||||
|
<summary>
|
||||||
|
Outgoing data in kilobytes per second (KBps).
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Netick.NetickEngine.InPacketLoss">
|
||||||
|
<summary>
|
||||||
|
<c><b>[Client Only]</b></c> Estimation of incoming packets that are being lost. Value ranges between 0.0 and 1.0, with 1.0 meaning all packets are being lost.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Netick.NetickEngine.OutPacketLoss">
|
||||||
|
<summary>
|
||||||
|
<c><b>[Client Only]</b></c> Estimation of outgoing packets that are being lost. Value ranges between 0.0 and 1.0, with 1.0 meaning all packets are being lost.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Netick.NetickEngine.InterpolationDelay">
|
||||||
|
<summary>
|
||||||
|
<c><b>[Client Only]</b></c> Interpolation delay in seconds.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Netick.NetickEngine.RTT">
|
||||||
|
<summary>
|
||||||
|
<c><b>[Client Only]</b></c> The round-trip time (RTT) of the client in seconds.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.NetickEngine.DisconnectFromServer">
|
||||||
|
<summary>
|
||||||
|
<c><b>[Client Only]</b></c> Disconnects this client from the server.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.NetickEngine.AttachBehaviour(Netick.INetickScript,System.Boolean)">
|
||||||
|
<summary>
|
||||||
|
Attaches a <see cref="T:Netick.INetickScript"/> to the simulation.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.NetickEngine.DetachBehaviour(Netick.INetickScript)">
|
||||||
|
<summary>
|
||||||
|
Detaches a <see cref="T:Netick.INetickScript"/> from the simulation.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.NetickEngine.GetWorldStateTotalSize">
|
||||||
|
<summary>
|
||||||
|
Returns the size of the entirety of the game's networked state snapshot size, in bytes. This includes the sizes of all allocated blocks.
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.NetickEngine.Update(System.Single,System.Single)">
|
||||||
|
<summary>
|
||||||
|
Updates Netick logic.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:Netick.NetickEngine.Render">
|
||||||
|
<summary>
|
||||||
|
Call this to invoke NetworkRender on simulated entities. This might not be needed if you are running a headless build.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="M:Netick.IGameEngine.GetConnectionMetaSizeWords">
|
<member name="M:Netick.IGameEngine.GetConnectionMetaSizeWords">
|
||||||
<summary>
|
<summary>
|
||||||
Implements this to inform Netick about the size (in 32 bit words) of your connection meta data.
|
Implements this to inform Netick about the size (in 32 bit words) of your connection meta data.
|
||||||
@@ -102,7 +481,7 @@
|
|||||||
<member name="M:Netick.INetickScript.NetworkFixedUpdate">
|
<member name="M:Netick.INetickScript.NetworkFixedUpdate">
|
||||||
<summary>
|
<summary>
|
||||||
Called every fixed-time network update/tick. Any changes/updates to the network state must happen here.
|
Called every fixed-time network update/tick. Any changes/updates to the network state must happen here.
|
||||||
<para>On the client, if you are the Input Source or if this Entity.PredictionMode is set to None, it will be called several times in one update/tick during resimulations. To check for resimulations, use [<see cref="P:Netick.Entity.IsResimulating"/>].</para>
|
<para>On the client, if you are the Input Source or if this Entity.PredictionMode is set to Global, it will be called several times in one update/tick during resimulations. To check for resimulations, use [<see cref="P:Netick.Entity.IsResimulating"/>].</para>
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:Netick.INetickScript.NetworkRender">
|
<member name="M:Netick.INetickScript.NetworkRender">
|
||||||
@@ -112,157 +491,29 @@
|
|||||||
</member>
|
</member>
|
||||||
<member name="T:Netick.INetickNetworkScript">
|
<member name="T:Netick.INetickNetworkScript">
|
||||||
<summary>
|
<summary>
|
||||||
A network scripts which can have networked properties and rpcs.
|
A script which can have networked properties and rpcs.
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:Netick.INetickEntity.Initialize(Netick.NetickEngine,Netick.Entity)">
|
<member name="M:Netick.INetickEntity.Initialize(Netick.NetickEngine,Netick.Entity)">
|
||||||
<summary>
|
<summary>
|
||||||
Used to initialize the user entity and assign Engine and Entity
|
Used to initialize the user entity and assign Engine and Entity.
|
||||||
</summary>
|
</summary>
|
||||||
<param name="netickEngine"></param>
|
<param name="netickEngine"></param>
|
||||||
<param name="entity"></param>
|
<param name="entity"></param>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:Netick.OnChangedData.InvokedForMisprediction">
|
<member name="T:Netick.NetworkUnorderedListSnapshot`1">
|
||||||
<summary>
|
<summary>
|
||||||
Returns true if this OnChanged callback is due to a mismatch between the state of this variable before rollback, and the state after rollback and resimulation.
|
A snapshot of the state of a <see cref="T:Netick.NetworkUnorderedList`1"/> collection. Note this must not be used outside the scope of an OnChanged call or a NetworkRender call.
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:Netick.OnChangedData.GetPreviousNetworkDictionary``2(Netick.NetworkDictionary{``0,``1})">
|
<member name="T:Netick.NetworkUnorderedList`1">
|
||||||
<summary>
|
<summary>
|
||||||
Gets a snapshot of the previous state of a NetworkDictionary collection.
|
A networked list collection. This is an unordered list meaning that the order of the elements during iteration is undefined.
|
||||||
</summary>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.OnChangedData.GetPreviousNetworkHashSet``1(Netick.NetworkHashSet{``0})">
|
|
||||||
<summary>
|
|
||||||
Gets a snapshot of the previous state of a NetworkHashSet collection.
|
|
||||||
</summary>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.OnChangedData.GetPreviousNetworkLinkedList``1(Netick.NetworkLinkedList{``0})">
|
|
||||||
<summary>
|
|
||||||
Gets a snapshot of the previous state of a NetworkLinkedList collection.
|
|
||||||
</summary>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.OnChangedData.GetPreviousNetworkQueue``1(Netick.NetworkQueue{``0})">
|
|
||||||
<summary>
|
|
||||||
Gets a snapshot of the previous state of a NetworkQueue collection.
|
|
||||||
</summary>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.OnChangedData.GetPreviousNetworkStack``1(Netick.NetworkStack{``0})">
|
|
||||||
<summary>
|
|
||||||
Gets a snapshot of the previous state of a NetworkStack collection.
|
|
||||||
</summary>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.OnChangedData.GetPreviousValue``1">
|
|
||||||
<summary>
|
|
||||||
Gets previous value for the changed network property.
|
|
||||||
<para>Note: this must only be used with non-array network properties. For arrays, use <see cref="M:Netick.OnChangedData.GetArrayPreviousElementValue``1(System.Int32)"/> instead. </para>
|
|
||||||
</summary>
|
|
||||||
<typeparam name="T"></typeparam>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.OnChangedData.GetPreviousValueAsPointer">
|
|
||||||
<summary>
|
|
||||||
Gets a pointer to the previous value
|
|
||||||
</summary>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.OnChangedData.GetArrayChangedElementIndex">
|
|
||||||
<summary>
|
|
||||||
Gets the index of the changed element of the array.
|
|
||||||
</summary>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.OnChangedData.GetArrayPreviousElementValue``1(System.Int32)">
|
|
||||||
<summary>
|
|
||||||
Gets the value of the changed element of the array. This is an unsafe method, use it carefully and make sure to never go outside range to avoid a crash.
|
|
||||||
</summary>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.OnChangedData.GetArrayPreviousElementValue``1">
|
|
||||||
<summary>
|
|
||||||
Gets the index of the changed element of the array.
|
|
||||||
</summary>
|
|
||||||
<typeparam name="T"></typeparam>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="T:Netick.NetworkDictionarySnapshot`2">
|
|
||||||
<summary>
|
|
||||||
A snapshot of the state of a <see cref="T:Netick.NetworkDictionary`2"/> collection. Note this must not be used outside the scope of an OnChanged call or a NetworkRender call.
|
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="T:Netick.NetworkDictionary`2">
|
<member name="T:Netick.NetworkBool">
|
||||||
<summary>
|
<summary>
|
||||||
A networked <see cref="T:System.Collections.Generic.Dictionary`2"/> collection.
|
Always use NetworkBool instead of bool, for networked properties and RPC parameters.
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="T:Netick.Interpolator">
|
|
||||||
<summary>
|
|
||||||
A struct that is used to obtain interpolation data for a network property.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.Interpolator.GetInterpolationData``1(Netick.InterpolationSource,``0@,``0@,System.Single@)">
|
|
||||||
<summary>
|
|
||||||
Tries to obtain interpolation data for this frame.
|
|
||||||
</summary>
|
|
||||||
<param name="interpolationSource"></param>
|
|
||||||
<param name="from"></param>
|
|
||||||
<param name="to"></param>
|
|
||||||
<param name="alpha"></param>
|
|
||||||
<returns>Returns true if there was interpolation data for this frame.</returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.Interpolator.GetInterpolationData``1(Netick.InterpolationSource,System.Int32,``0@,``0@,System.Single@)">
|
|
||||||
<summary>
|
|
||||||
Tries to obtain interpolation data for this frame. This is the array version.
|
|
||||||
</summary>
|
|
||||||
<param name="interpolationSource"></param>
|
|
||||||
<param name="from"></param>
|
|
||||||
<param name="to"></param>
|
|
||||||
<param name="alpha"></param>
|
|
||||||
<returns>Returns true if there was interpolation data for this frame.</returns>
|
|
||||||
</member>
|
|
||||||
<member name="T:Netick.Interpolation">
|
|
||||||
<summary>
|
|
||||||
A class representing an abstract interpolation interface, which is implemented by <see cref="T:Netick.RemoteInterpolation"/> and <see cref="T:Netick.LocalInterpolation"/>
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="T:Netick.LocalInterpolation">
|
|
||||||
<summary>
|
|
||||||
A class representing the local interpolation of this instance <see cref="T:Netick.NetickEngine"/>. This should be used whenever you want to use Predicted Timeline on the client.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Netick.LocalInterpolation.Time">
|
|
||||||
<summary>
|
|
||||||
Time in seconds.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="T:Netick.RemoteInterpolation">
|
|
||||||
<summary>
|
|
||||||
A class representing the remote interpolation of this instance <see cref="T:Netick.NetickEngine"/>. This should be used whenever you want to use Remote Timeline on the client.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Netick.RemoteInterpolation.CurrentBufferTime">
|
|
||||||
<summary>
|
|
||||||
Interpolation time in seconds.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Netick.RemoteInterpolation.Time">
|
|
||||||
<summary>
|
|
||||||
Time in seconds.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Netick.AdaptiveRemoteInterpolation.CurrentBufferTime">
|
|
||||||
<summary>
|
|
||||||
Interpolation time in seconds.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Netick.AdaptiveRemoteInterpolation.Time">
|
|
||||||
<summary>
|
|
||||||
Time in seconds.
|
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:Netick.NetworkRpc.InternalIsResim(Netick.NetickEngine)">
|
<member name="M:Netick.NetworkRpc.InternalIsResim(Netick.NetickEngine)">
|
||||||
@@ -285,229 +536,29 @@
|
|||||||
Internal method. Never call this.
|
Internal method. Never call this.
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="T:Netick.SequenceId">
|
|
||||||
<summary>
|
|
||||||
A rolling sequence counter for ordering values. Repeats indefinitely
|
|
||||||
with 1022 possible unique values (0 is treated as invalid internally).
|
|
||||||
|
|
||||||
Consumes 10 bits when encoded for transmission.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="T:Netick.NetworkHashSetSnapshot`1">
|
|
||||||
<summary>
|
|
||||||
A snapshot of the state of a <see cref="T:Netick.NetworkHashSet`1"/> collection. Note this must not be used outside the scope of an OnChanged call or a NetworkRender call.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="T:Netick.NetworkHashSet`1">
|
|
||||||
<summary>
|
|
||||||
A networked <see cref="T:System.Collections.Generic.HashSet`1"/> collection.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="T:Netick.NetworkStackSnapshot`1">
|
|
||||||
<summary>
|
|
||||||
A snapshot of the state of a <see cref="T:Netick.NetworkStack`1"/> collection. Note this must not be used outside the scope of an OnChanged call or a NetworkRender call.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="T:Netick.NetworkStack`1">
|
|
||||||
<summary>
|
|
||||||
A networked <see cref="T:System.Collections.Generic.Stack`1"/> collection.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.NotServerException.#ctor">
|
|
||||||
<summary>
|
|
||||||
Constructs a NotServerException
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.NotServerException.#ctor(System.String)">
|
|
||||||
<summary>
|
|
||||||
Constructs a NotServerException with a message
|
|
||||||
</summary>
|
|
||||||
<param name="message">The exception message</param>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.NotServerException.#ctor(System.String,System.Exception)">
|
|
||||||
<summary>
|
|
||||||
Constructs a NotServerException with a message and a inner exception
|
|
||||||
</summary>
|
|
||||||
<param name="message">The exception message</param>
|
|
||||||
<param name="inner">The inner exception</param>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.NotClientException.#ctor">
|
|
||||||
<summary>
|
|
||||||
Constructs a NotClientException
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.NotClientException.#ctor(System.String)">
|
|
||||||
<summary>
|
|
||||||
Constructs a NotClientException with a message
|
|
||||||
</summary>
|
|
||||||
<param name="message">The exception message</param>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.NotClientException.#ctor(System.String,System.Exception)">
|
|
||||||
<summary>
|
|
||||||
Constructs a NotClientException with a message and a inner exception
|
|
||||||
</summary>
|
|
||||||
<param name="message">The exception message</param>
|
|
||||||
<param name="inner">The inner exception</param>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.BadPacketException.#ctor">
|
|
||||||
<summary>
|
|
||||||
Constructs a BadPacketException
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="T:Netick.NetworkLinkedListSnapshot`1">
|
|
||||||
<summary>
|
|
||||||
A snapshot of the state of a <see cref="T:Netick.NetworkLinkedList`1"/> collection. Note this must not be used outside the scope of an OnChanged call or a NetworkRender call.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="T:Netick.NetworkLinkedList`1">
|
|
||||||
<summary>
|
|
||||||
A networked linked list collection. This is an ordered list meaning that the elements insertion order is maintained when iterating through the collection.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="F:Netick.CustomizableSocketTransport._connectRequestBuffer">
|
<member name="F:Netick.CustomizableSocketTransport._connectRequestBuffer">
|
||||||
----------------------------------------------------
|
----------------------------------------------------
|
||||||
</member>
|
</member>
|
||||||
<member name="T:Netick.NetworkPlayer">
|
<member name="P:Netick.NetworkConnection.InPacketLossBurst">
|
||||||
<summary>
|
<summary>
|
||||||
Represents a network player, which can be either a local player (representing this sandbox) or a remote connection (representing a connected client)).
|
The longest inward packet loss burst (more than 2 packets lost in a row) in the last 10 seconds.
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:Netick.NetworkPlayer.PlayerId">
|
<member name="P:Netick.NetworkConnection.InPacketLoss">
|
||||||
<summary>
|
<summary>
|
||||||
The networked index of this player.
|
Estimation of incoming packets that are being lost. Value ranges between 0.0 and 1.0, with 1.0 meaning all packets are being lost.
|
||||||
<para>Note: it returns -1 on the client for the local player when not connected to a server.</para>
|
|
||||||
<para>Note: the server player always has Id 0.</para>
|
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:Netick.NetworkPlayer.PlayerObject">
|
<member name="P:Netick.NetworkConnection.OutPacketLoss">
|
||||||
<summary>
|
<summary>
|
||||||
Use this to associate an object with this player.
|
Estimation of outgoing packets that are being lost. Value ranges between 0.0 and 1.0, with 1.0 meaning all packets are being lost.
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:Netick.NetickEngine.ConnectedClients">
|
|
||||||
<summary>
|
|
||||||
A list containing all connected clients currently.
|
|
||||||
<para>Note: if you want the clients + the server, use <see cref="P:Netick.NetickEngine.ConnectedPlayers"/>.</para>
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Netick.NetickEngine.ConnectedPlayers">
|
|
||||||
<summary>
|
|
||||||
<para>A list containing all connected clients currently, in addition to the server.</para>
|
|
||||||
<para>Note: if you only want the clients, use <see cref="P:Netick.NetickEngine.ConnectedClients"/>.</para>
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Netick.NetickEngine.ServerEndPoint">
|
|
||||||
<summary>
|
|
||||||
<i><b>[Client Only]</b></i> The <see cref="T:System.Net.IPEndPoint"/> of the server you are connected to. Returns null if you are not connected to any server, or if you are the server.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Netick.NetickEngine.IsConnected">
|
|
||||||
<summary>
|
|
||||||
<i><b>[Client Only]</b></i> Returns true if this client is currently connected to a server.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Netick.NetickEngine.FixedDeltaTime">
|
|
||||||
<summary>
|
|
||||||
Time period between simulation ticks.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<!-- Badly formed XML comment ignored for member "P:Netick.NetickEngine.Tick" -->
|
|
||||||
<member name="P:Netick.NetickEngine.IsResimulating">
|
|
||||||
<summary>
|
|
||||||
Returns true if we are currently resimulating a previous input/tick of the past. On the server, it always returns false since <b>only the clients resimulate</b>.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Netick.NetickEngine.InKBps">
|
|
||||||
<summary>
|
|
||||||
Incoming data in kilobytes per second (KBps).
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Netick.NetickEngine.OutKBps">
|
|
||||||
<summary>
|
|
||||||
Outgoing data in kilobytes per second (KBps).
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Netick.NetickEngine.InterpolationDelay">
|
|
||||||
<summary>
|
|
||||||
<i><b>[Client Only]</b></i> Interpolation delay in seconds.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Netick.NetickEngine.RTT">
|
|
||||||
<summary>
|
|
||||||
<i><b>[Client Only]</b></i> The round-trip time (RTT) of the client in seconds.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.NetickEngine.DisconnectFromServer">
|
|
||||||
<summary>
|
|
||||||
<i><b>[Client Only]</b></i> Disconnects this client from the server.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.NetickEngine.Update(System.Single,System.Single)">
|
|
||||||
<summary>
|
|
||||||
Update Netick's logic.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.NetickEngine.Render">
|
|
||||||
<summary>
|
|
||||||
Call this to invoke NetworkRender on simulated entities. This might not be needed if you are running a headless build.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.NetickEngine.AttachBehaviour(Netick.INetickScript)">
|
|
||||||
<summary>
|
|
||||||
Attachs a <see cref="T:Netick.INetickScript"/> to the simulation.
|
|
||||||
</summary>
|
|
||||||
<param name="behaviour"></param>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.NetickEngine.DeattachBehaviour(Netick.INetickScript)">
|
|
||||||
<summary>
|
|
||||||
Deattachs a <see cref="T:Netick.INetickScript"/> from the simulation.
|
|
||||||
</summary>
|
|
||||||
<param name="behaviour"></param>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.NetworkConnection.SendData(System.Byte,System.Byte*,System.Int32,Netick.TransportDeliveryMethod)">
|
<member name="M:Netick.NetworkConnection.SendData(System.Byte,System.Byte*,System.Int32,Netick.TransportDeliveryMethod)">
|
||||||
<summary>
|
<summary>
|
||||||
Sends data to this connection.
|
Sends data to this connection.
|
||||||
<para>Note: the low-level transport must implement <see cref="M:Netick.TransportConnection.SendUserData(System.IntPtr,System.Int32,Netick.TransportDeliveryMethod)"/> for this method to have an effect.</para>
|
<para>Note: the low-level transport must implement <see cref="M:Netick.TransportConnection.SendUserData(System.IntPtr,System.Int32,Netick.TransportDeliveryMethod)"/> for this method to have an effect.</para>
|
||||||
</summary>
|
</summary>
|
||||||
<param name="id"></param>
|
|
||||||
<param name="data"></param>
|
|
||||||
<param name="length"></param>
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.NativeUDPSocket.Deinitialize">
|
|
||||||
--------------------------------------------------------------------------------------------------------------
|
|
||||||
--------------------------------------------------------------------------------------------------------------
|
|
||||||
--------------------------------------------------------------------------------------------------------------
|
|
||||||
--------------------------------------------------------------------------------------------------------------
|
|
||||||
</member>
|
|
||||||
<member name="F:Netick.ClientSimulation.SimReady">
|
|
||||||
-------------------------------- -------------------------------- -------------------------------- --------------------------------
|
|
||||||
</member>
|
|
||||||
<member name="M:Netick.ClientSimulation.AddSnaps">
|
|
||||||
-------------------------------- -------------------------------- -------------------------------- --------------------------------
|
|
||||||
</member>
|
|
||||||
<member name="T:Netick.NetworkUnorderedListSnapshot`1">
|
|
||||||
<summary>
|
|
||||||
A snapshot of the state of a <see cref="T:Netick.NetworkUnorderedList`1"/> collection. Note this must not be used outside the scope of an OnChanged call or a NetworkRender call.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="T:Netick.NetworkUnorderedList`1">
|
|
||||||
<summary>
|
|
||||||
A networked list collection. This is an unordered list meaning that the order of the elements during iteration is undefined.
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="T:Netick.OnChanged">
|
|
||||||
<summary>
|
|
||||||
Use this attribute on a method you want to call when a specific property value changes. Example: [OnChanged(nameof(PropertyName)]
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="T:Netick.Rpc">
|
|
||||||
<summary>
|
|
||||||
Use this attribute on any method you want to make an RPC. Should have the return type of void, and not be static.
|
|
||||||
<para> * Use the parameter "source" to specify who is allowed to send this RPC.</para>
|
|
||||||
<para> * Use the parameter "target" to specify who is allowed to receive and execute this RPC.</para>
|
|
||||||
<para> * Use the parameter "isReliable" to specify if this Rpc should be reliable or not, meaning it won't be lost (due to packet loss).</para>
|
|
||||||
<para> * Use the parameter "localInvoke" to specify if this Rpc should be executed on the machine it was called from.</para>
|
|
||||||
</summary>
|
|
||||||
</member>
|
</member>
|
||||||
</members>
|
</members>
|
||||||
</doc>
|
</doc>
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ RenderSettings:
|
|||||||
m_ReflectionIntensity: 1
|
m_ReflectionIntensity: 1
|
||||||
m_CustomReflection: {fileID: 0}
|
m_CustomReflection: {fileID: 0}
|
||||||
m_Sun: {fileID: 0}
|
m_Sun: {fileID: 0}
|
||||||
m_IndirectSpecularColor: {r: 0.45137393, g: 0.50092196, b: 0.57263935, a: 1}
|
|
||||||
m_UseRadianceAmbientProbe: 0
|
m_UseRadianceAmbientProbe: 0
|
||||||
--- !u!157 &3
|
--- !u!157 &3
|
||||||
LightmapSettings:
|
LightmapSettings:
|
||||||
@@ -123,6 +122,37 @@ NavMeshSettings:
|
|||||||
debug:
|
debug:
|
||||||
m_Flags: 0
|
m_Flags: 0
|
||||||
m_NavMeshData: {fileID: 0}
|
m_NavMeshData: {fileID: 0}
|
||||||
|
--- !u!1 &293298009
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 293298010}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: GameObject
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &293298010
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 293298009}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
|
m_LocalPosition: {x: -133.02965, y: 72.981926, z: 47.2627}
|
||||||
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &1070948396
|
--- !u!1 &1070948396
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -7204,3 +7234,4 @@ SceneRoots:
|
|||||||
- {fileID: 1070948398}
|
- {fileID: 1070948398}
|
||||||
- {fileID: 1809360484}
|
- {fileID: 1809360484}
|
||||||
- {fileID: 3762179930698311635}
|
- {fileID: 3762179930698311635}
|
||||||
|
- {fileID: 293298010}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace Netick.Samples.Bomberman
|
|||||||
|
|
||||||
for (int i = 0; i < hitsCount; i++)
|
for (int i = 0; i < hitsCount; i++)
|
||||||
{
|
{
|
||||||
var target =_hits[i].collider.gameObject;
|
var target = _hits[i].collider.gameObject;
|
||||||
var block = target.GetComponent<Block>();
|
var block = target.GetComponent<Block>();
|
||||||
var bomber = target.GetComponent<BombermanController>();
|
var bomber = target.GetComponent<BombermanController>();
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ MonoImporter:
|
|||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
defaultReferences: []
|
defaultReferences: []
|
||||||
executionOrder: 10
|
executionOrder: 0
|
||||||
icon: {instanceID: 0}
|
icon: {instanceID: 0}
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ namespace Netick.Samples.Bomberman
|
|||||||
|
|
||||||
private GameObject _bombPrefab;
|
private GameObject _bombPrefab;
|
||||||
private CharacterController _CC;
|
private CharacterController _CC;
|
||||||
|
private BombermanInput _lastInput;
|
||||||
|
|
||||||
// Networked Properties
|
// Networked Properties
|
||||||
[Networked]
|
[Networked]
|
||||||
@@ -53,10 +54,12 @@ namespace Netick.Samples.Bomberman
|
|||||||
if (!Alive)
|
if (!Alive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (FetchInput(out BombermanInput input))
|
FetchInput(out _lastInput);
|
||||||
|
|
||||||
|
if (IsInputSource || IsServer)
|
||||||
{
|
{
|
||||||
// clamp movement inputs.
|
// clamp movement inputs.
|
||||||
input.Movement = new Vector3(Mathf.Clamp(input.Movement.x, -1f, 1f), Mathf.Clamp(input.Movement.y, -1f, 1f));
|
_lastInput.Movement = new Vector3(Mathf.Clamp(_lastInput.Movement.x, -1f, 1f), Mathf.Clamp(_lastInput.Movement.y, -1f, 1f));
|
||||||
|
|
||||||
if (BombPowerUpTimer > 0)
|
if (BombPowerUpTimer > 0)
|
||||||
BombPowerUpTimer -= Sandbox.FixedDeltaTime;
|
BombPowerUpTimer -= Sandbox.FixedDeltaTime;
|
||||||
@@ -69,12 +72,12 @@ namespace Netick.Samples.Bomberman
|
|||||||
var hasSpeedBoost = SpeedPowerUpTimer > 0;
|
var hasSpeedBoost = SpeedPowerUpTimer > 0;
|
||||||
var speed = hasSpeedBoost ? _speed * _speedBoostMultiplayer : _speed;
|
var speed = hasSpeedBoost ? _speed * _speedBoostMultiplayer : _speed;
|
||||||
|
|
||||||
_CC.Move(input.Movement * speed * Sandbox.FixedDeltaTime);
|
_CC.Move(_lastInput.Movement * speed * Sandbox.FixedDeltaTime);
|
||||||
|
|
||||||
// we make sure the z coord of the pos of the player is always zero.
|
// we make sure the z coord of the pos of the player is always zero.
|
||||||
transform.position = new Vector3(transform.position.x, transform.position.y, 0f);
|
transform.position = new Vector3(transform.position.x, transform.position.y, 0f);
|
||||||
|
|
||||||
if (IsServer && input.PlantBomb && SpawnedBombs.Count < MaxBombs)
|
if (IsServer && _lastInput.PlantBomb && SpawnedBombs.Count < MaxBombs)
|
||||||
{
|
{
|
||||||
// round the bomb pos so that it snaps to the nearest square.
|
// round the bomb pos so that it snaps to the nearest square.
|
||||||
var bomb = Sandbox.NetworkInstantiate(_bombPrefab, Round(transform.position), Quaternion.identity).GetComponent<Bomb>();
|
var bomb = Sandbox.NetworkInstantiate(_bombPrefab, Round(transform.position), Quaternion.identity).GetComponent<Bomb>();
|
||||||
@@ -120,7 +123,7 @@ namespace Netick.Samples.Bomberman
|
|||||||
// based on state of Alive:
|
// based on state of Alive:
|
||||||
|
|
||||||
// * hide/show player object.
|
// * hide/show player object.
|
||||||
GetComponentInChildren<Renderer>().SetEnabled(Sandbox,Alive);
|
GetComponentInChildren<Renderer>().SetEnabled(Sandbox, Alive);
|
||||||
|
|
||||||
// * enable/disable the CharacterController.
|
// * enable/disable the CharacterController.
|
||||||
_CC.enabled = Alive;
|
_CC.enabled = Alive;
|
||||||
|
|||||||
@@ -7,51 +7,54 @@ namespace Netick.Samples.Bomberman
|
|||||||
{
|
{
|
||||||
public class BombermanEventsHandler : NetworkBehaviour
|
public class BombermanEventsHandler : NetworkBehaviour
|
||||||
{
|
{
|
||||||
public List<BombermanController> Players = new(4);
|
|
||||||
public List<BombermanController> AlivePlayers = new(4);
|
public List<BombermanController> AlivePlayers = new(4);
|
||||||
|
|
||||||
private GameObject _playerPrefab;
|
private GameObject _playerPrefab;
|
||||||
private Vector3[] _spawnPositions = new Vector3[4] { new Vector3(11, 9, 0), new Vector3(11, 1, 0), new Vector3(1, 9, 0), new Vector3(1, 1, 0) };
|
private Vector3[] _spawnPositions = new Vector3[4] { new Vector3(11, 9, 0), new Vector3(11, 1, 0), new Vector3(1, 9, 0), new Vector3(1, 1, 0) };
|
||||||
private Queue<Vector3> _freePositions = new(4);
|
private Queue<Vector3> _freePositions = new(4);
|
||||||
|
|
||||||
public override void NetworkStart()
|
public override void NetworkAwake()
|
||||||
{
|
{
|
||||||
Sandbox.Events.OnInputRead += OnInput;
|
Sandbox.Events.OnInputRead += OnInput;
|
||||||
Sandbox.Events.OnConnectRequest += OnConnectRequest;
|
Sandbox.Events.OnConnectRequest += OnConnectRequest;
|
||||||
Sandbox.Events.OnPlayerConnected += OnPlayerConnected;
|
Sandbox.Events.OnPlayerJoined += OnPlayerJoined;
|
||||||
Sandbox.Events.OnPlayerDisconnected += OnPlayerDisconnected;
|
Sandbox.Events.OnPlayerLeft += OnPlayerLeft;
|
||||||
|
|
||||||
_playerPrefab = Sandbox.GetPrefab("Bomberman Player");
|
_playerPrefab = Sandbox.GetPrefab("Bomberman Player");
|
||||||
Sandbox.InitializePool(Sandbox.GetPrefab("Bomb"), 5);
|
Sandbox.InitializePool(Sandbox.GetPrefab("Bomb"), 5);
|
||||||
Sandbox.InitializePool(_playerPrefab,4);
|
Sandbox.InitializePool(_playerPrefab, 4);
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
_freePositions.Enqueue(_spawnPositions[i]);
|
_freePositions.Enqueue(_spawnPositions[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void NetworkStart()
|
||||||
|
{
|
||||||
if (IsServer)
|
if (IsServer)
|
||||||
RestartGame();
|
RestartGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnConnectRequest(NetworkSandbox sandbox, NetworkConnectionRequest request)
|
public void OnConnectRequest(NetworkSandbox sandbox, NetworkConnectionRequest request)
|
||||||
{
|
{
|
||||||
if (Sandbox.ConnectedPlayers.Count >= 4)
|
if (Sandbox.Players.Count >= 4)
|
||||||
request.Refuse();
|
request.Refuse();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is called on the server when a playerObj has connected.
|
// This is called when a player has has joined the game.
|
||||||
public void OnPlayerConnected(NetworkSandbox sandbox, NetworkPlayer player)
|
public void OnPlayerJoined(NetworkSandbox sandbox, NetworkPlayerId player)
|
||||||
{
|
{
|
||||||
var playerObj = sandbox.NetworkInstantiate(_playerPrefab, _spawnPositions[Sandbox.ConnectedPlayers.Count], Quaternion.identity, player).GetComponent<BombermanController>();
|
if (IsClient)
|
||||||
player.PlayerObject = playerObj.gameObject;
|
return;
|
||||||
AlivePlayers. Add(playerObj);
|
var playerObj = sandbox.NetworkInstantiate(_playerPrefab, _spawnPositions[Sandbox.Players.Count], Quaternion.identity, player).GetComponent<BombermanController>();
|
||||||
Players. Add(playerObj);
|
sandbox.SetPlayerObject(player, playerObj.Object);
|
||||||
|
AlivePlayers.Add(playerObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is called on the server when a client has disconnected.
|
// This is called when a player has has left the game.
|
||||||
public void OnPlayerDisconnected(NetworkSandbox sandbox, Netick.NetworkPlayer player, TransportDisconnectReason reason)
|
public void OnPlayerLeft(NetworkSandbox sandbox, NetworkPlayerId player)
|
||||||
{
|
{
|
||||||
_freePositions.Enqueue(((GameObject)player.PlayerObject).GetComponent<BombermanController>().SpawnPos);
|
if (IsClient)
|
||||||
Players. Remove (((GameObject)player.PlayerObject).GetComponent<BombermanController>());
|
return;
|
||||||
|
var playerObj = sandbox.GetPlayerObject<BombermanController>(player);
|
||||||
|
_freePositions.Enqueue(playerObj.SpawnPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is called to read inputs.
|
// This is called to read inputs.
|
||||||
@@ -74,7 +77,7 @@ namespace Netick.Samples.Bomberman
|
|||||||
// create new level.
|
// create new level.
|
||||||
var blockPrefab = Sandbox.GetPrefab("DestroyableBlock");
|
var blockPrefab = Sandbox.GetPrefab("DestroyableBlock");
|
||||||
var powerUpPrefab = Sandbox.GetPrefab("Power Up");
|
var powerUpPrefab = Sandbox.GetPrefab("Power Up");
|
||||||
var numberOfBoosters = Random.Range(2, 4+1);
|
var numberOfBoosters = Random.Range(2, 4 + 1);
|
||||||
var takenPositions = new List<Vector3>();
|
var takenPositions = new List<Vector3>();
|
||||||
var maxX = 11;
|
var maxX = 11;
|
||||||
var maxY = 9;
|
var maxY = 9;
|
||||||
@@ -96,7 +99,7 @@ namespace Netick.Samples.Bomberman
|
|||||||
|
|
||||||
while (numberOfBoosters > 0)
|
while (numberOfBoosters > 0)
|
||||||
{
|
{
|
||||||
var randomPos = new Vector3(Random.Range(1, 11+1), Random.Range(1, 9+1), 0);
|
var randomPos = new Vector3(Random.Range(1, 11 + 1), Random.Range(1, 9 + 1), 0);
|
||||||
var type = (Random.value > 0.5f) ? PowerUpType.Speed : PowerUpType.IncreaseBombs;
|
var type = (Random.value > 0.5f) ? PowerUpType.Speed : PowerUpType.IncreaseBombs;
|
||||||
|
|
||||||
if (!takenPositions.Contains(randomPos) && IsValidPos(randomPos))
|
if (!takenPositions.Contains(randomPos) && IsValidPos(randomPos))
|
||||||
@@ -108,8 +111,8 @@ namespace Netick.Samples.Bomberman
|
|||||||
}
|
}
|
||||||
|
|
||||||
// reset players.
|
// reset players.
|
||||||
foreach (var player in Players)
|
foreach (var player in Sandbox.Players)
|
||||||
player.Respawn();
|
Sandbox.GetPlayerObject<BombermanController>(player).Respawn();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsValidPos(Vector3 pos)
|
private bool IsValidPos(Vector3 pos)
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ RenderSettings:
|
|||||||
m_ReflectionIntensity: 1
|
m_ReflectionIntensity: 1
|
||||||
m_CustomReflection: {fileID: 0}
|
m_CustomReflection: {fileID: 0}
|
||||||
m_Sun: {fileID: 0}
|
m_Sun: {fileID: 0}
|
||||||
m_IndirectSpecularColor: {r: 0.43668216, g: 0.48427725, b: 0.56452835, a: 1}
|
|
||||||
m_UseRadianceAmbientProbe: 0
|
m_UseRadianceAmbientProbe: 0
|
||||||
--- !u!157 &3
|
--- !u!157 &3
|
||||||
LightmapSettings:
|
LightmapSettings:
|
||||||
@@ -503,12 +502,15 @@ MonoBehaviour:
|
|||||||
m_GameObject: {fileID: 1293352707}
|
m_GameObject: {fileID: 1293352707}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_EditorHideFlags: 0
|
m_EditorHideFlags: 0
|
||||||
m_Script: {fileID: 11500000, guid: fb5a4e3a1e885b04e8f36bf0b0597274, type: 3}
|
m_Script: {fileID: 11500000, guid: 13d95c28de1bac54f8b26fc8dd960077, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
SpawnPos: {fileID: 10129275}
|
|
||||||
PlayerPrefab: {fileID: 7011933354638177272, guid: d66d5a97430d3364890108321123b309,
|
PlayerPrefab: {fileID: 7011933354638177272, guid: d66d5a97430d3364890108321123b309,
|
||||||
type: 3}
|
type: 3}
|
||||||
|
SpawnPosition: {fileID: 10129275}
|
||||||
|
HorizontalOffset: 5
|
||||||
|
StaggerSpawns: 1
|
||||||
|
DestroyPlayerObjectWhenLeaving: 1
|
||||||
--- !u!1 &1318413499
|
--- !u!1 &1318413499
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -672,6 +674,7 @@ Terrain:
|
|||||||
m_DetailObjectDensity: 1
|
m_DetailObjectDensity: 1
|
||||||
m_HeightmapPixelError: 5
|
m_HeightmapPixelError: 5
|
||||||
m_SplatMapDistance: 1000
|
m_SplatMapDistance: 1000
|
||||||
|
m_HeightmapMinimumLODSimplification: 0
|
||||||
m_HeightmapMaximumLOD: 0
|
m_HeightmapMaximumLOD: 0
|
||||||
m_ShadowCastingMode: 2
|
m_ShadowCastingMode: 2
|
||||||
m_DrawHeightmap: 1
|
m_DrawHeightmap: 1
|
||||||
|
|||||||
@@ -19,9 +19,11 @@ namespace Netick.Samples.FPS
|
|||||||
private Transform _cameraParent;
|
private Transform _cameraParent;
|
||||||
private CharacterController _CC;
|
private CharacterController _CC;
|
||||||
private Vector2 _camAngles;
|
private Vector2 _camAngles;
|
||||||
|
private FPSInput _lastInput;
|
||||||
|
|
||||||
// Networked Properties
|
// Networked Properties
|
||||||
[Networked][Smooth]
|
[Networked]
|
||||||
|
[Smooth]
|
||||||
public Vector2 YawPitch { get; set; }
|
public Vector2 YawPitch { get; set; }
|
||||||
|
|
||||||
public override void NetworkStart()
|
public override void NetworkStart()
|
||||||
@@ -63,8 +65,10 @@ namespace Netick.Samples.FPS
|
|||||||
|
|
||||||
public override void NetworkFixedUpdate()
|
public override void NetworkFixedUpdate()
|
||||||
{
|
{
|
||||||
if (FetchInput(out FPSInput input))
|
FetchInput(out _lastInput);
|
||||||
MoveAndRotate(input);
|
|
||||||
|
if (IsInputSource || IsServer)
|
||||||
|
MoveAndRotate(_lastInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MoveAndRotate(FPSInput input)
|
private void MoveAndRotate(FPSInput input)
|
||||||
@@ -74,7 +78,7 @@ namespace Netick.Samples.FPS
|
|||||||
|
|
||||||
// rotation.
|
// rotation.
|
||||||
YawPitch = ClampAngles(YawPitch.x + input.YawPitch.x, YawPitch.y + input.YawPitch.y);
|
YawPitch = ClampAngles(YawPitch.x + input.YawPitch.x, YawPitch.y + input.YawPitch.y);
|
||||||
ApplyRotations(YawPitch,false);
|
ApplyRotations(YawPitch, false);
|
||||||
|
|
||||||
// movement direction.
|
// movement direction.
|
||||||
var movement = transform.TransformVector(new Vector3(input.Movement.x, 0, input.Movement.y)) * _movementSpeed;
|
var movement = transform.TransformVector(new Vector3(input.Movement.x, 0, input.Movement.y)) * _movementSpeed;
|
||||||
@@ -95,7 +99,7 @@ namespace Netick.Samples.FPS
|
|||||||
|
|
||||||
public override void NetworkRender()
|
public override void NetworkRender()
|
||||||
{
|
{
|
||||||
if (IsProxy)
|
if (!IsInputSource)
|
||||||
ApplyRotations(YawPitch, true);
|
ApplyRotations(YawPitch, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ namespace Netick.Samples
|
|||||||
{
|
{
|
||||||
if (Application.isBatchMode)
|
if (Application.isBatchMode)
|
||||||
{
|
{
|
||||||
|
if (Cap)
|
||||||
Application.targetFrameRate = FPS;
|
Application.targetFrameRate = FPS;
|
||||||
Network.StartAsServer(Transport, Port, SandboxPrefab);
|
Network.StartAsServer(Transport, Port, SandboxPrefab);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,25 +17,27 @@ namespace Netick.Samples
|
|||||||
public bool StaggerSpawns = true;
|
public bool StaggerSpawns = true;
|
||||||
public bool DestroyPlayerObjectWhenLeaving = true;
|
public bool DestroyPlayerObjectWhenLeaving = true;
|
||||||
|
|
||||||
// This is called on the server when a player has connected.
|
// This is called when a player has joined the game.
|
||||||
public override void OnPlayerConnected(NetworkSandbox sandbox, Netick.NetworkPlayer client)
|
public override void OnPlayerJoined(NetworkSandbox sandbox, NetworkPlayerId player)
|
||||||
{
|
{
|
||||||
|
if (sandbox.IsClient)
|
||||||
|
return;
|
||||||
var spawnPos = SpawnPosition.position;
|
var spawnPos = SpawnPosition.position;
|
||||||
if (StaggerSpawns)
|
if (StaggerSpawns)
|
||||||
spawnPos += (HorizontalOffset * Vector3.left) * (sandbox.ConnectedPlayers.Count - 1);
|
spawnPos += (HorizontalOffset * Vector3.left) * (sandbox.Players.Count - 1);
|
||||||
var player = sandbox.NetworkInstantiate(PlayerPrefab, spawnPos, SpawnPosition.rotation, client);
|
var playerObj = sandbox.NetworkInstantiate(PlayerPrefab, spawnPos, SpawnPosition.rotation, player);
|
||||||
client.PlayerObject = player;
|
sandbox.SetPlayerObject(player, playerObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is called on the server when a player has disconnected.
|
// This is called when a player has left the game.
|
||||||
public override void OnPlayerDisconnected(NetworkSandbox sandbox, Netick.NetworkPlayer client, TransportDisconnectReason transportDisconnectReason)
|
public override void OnPlayerLeft(NetworkSandbox sandbox, NetworkPlayerId player)
|
||||||
{
|
{
|
||||||
|
if (sandbox.IsClient)
|
||||||
|
return;
|
||||||
if (!DestroyPlayerObjectWhenLeaving)
|
if (!DestroyPlayerObjectWhenLeaving)
|
||||||
return;
|
return;
|
||||||
|
if (sandbox.TryGetPlayerObject(player, out var playerObj))
|
||||||
var netObj = client.PlayerObject as NetworkObject;
|
Sandbox.Destroy(playerObj);
|
||||||
if (netObj != null)
|
|
||||||
Sandbox.Destroy(netObj);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "com.karrar.netick",
|
"name": "com.karrar.netick",
|
||||||
"version": "0.13.71",
|
"version": "0.14.2",
|
||||||
"displayName": "Netick",
|
"displayName": "Netick",
|
||||||
"description": "A networking solution for Unity",
|
"description": "A networking solution for Unity",
|
||||||
"unity": "2021.3",
|
"unity": "2021.3",
|
||||||
|
|||||||
Reference in New Issue
Block a user