mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Compare commits
28 Commits
4fdfe5f06a
...
1ba9e716a0
Author | SHA1 | Date | |
---|---|---|---|
|
1ba9e716a0 | ||
|
499e4daea3 | ||
|
04bb95311b | ||
|
e9a8e02a40 | ||
|
bb97db4eaa | ||
|
e7b3aa77df | ||
|
f61524863e | ||
|
af133e6110 | ||
|
a9d280cd4b | ||
|
c4f803fcf6 | ||
|
03357f4275 | ||
|
c80a3c8ea5 | ||
|
68c7d14a16 | ||
|
df7a343d7e | ||
|
d347600468 | ||
|
2983c45f1f | ||
|
9a2bf46774 | ||
|
549b222ec0 | ||
|
4e07f3a348 | ||
|
19296d5d21 | ||
|
01b9260768 | ||
|
74a430f647 | ||
|
de2ed26eee | ||
|
b39d7bd8d2 | ||
|
06f3bca80b | ||
|
d55faa864c | ||
|
5fbd83279e | ||
|
2508cfd618 |
4
.github/workflows/RunUnityTests.yml
vendored
4
.github/workflows/RunUnityTests.yml
vendored
@ -14,9 +14,9 @@ jobs:
|
|||||||
# - 2019.4.40f1
|
# - 2019.4.40f1
|
||||||
- 2020.3.48f1
|
- 2020.3.48f1
|
||||||
- 2021.3.45f1
|
- 2021.3.45f1
|
||||||
- 2022.3.50f1
|
- 2022.3.51f1
|
||||||
- 2023.2.20f1
|
- 2023.2.20f1
|
||||||
- 6000.0.23f1
|
- 6000.0.25f1
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
@ -119,6 +119,23 @@ public uint sendIntervalMultiplier
|
|||||||
protected double timeStampAdjustment => NetworkServer.sendInterval * (sendIntervalMultiplier - 1);
|
protected double timeStampAdjustment => NetworkServer.sendInterval * (sendIntervalMultiplier - 1);
|
||||||
protected double offset => timelineOffset ? NetworkServer.sendInterval * sendIntervalMultiplier : 0;
|
protected double offset => timelineOffset ? NetworkServer.sendInterval * sendIntervalMultiplier : 0;
|
||||||
|
|
||||||
|
[Header("Velocity")]
|
||||||
|
[ReadOnly, SerializeField] Vector3 _velocity;
|
||||||
|
[ReadOnly, SerializeField] Vector3 _angVelocity;
|
||||||
|
|
||||||
|
public Vector3 velocity
|
||||||
|
{
|
||||||
|
get => _velocity;
|
||||||
|
internal set => _velocity = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector3 angVelocity
|
||||||
|
|
||||||
|
{
|
||||||
|
get => _angVelocity;
|
||||||
|
internal set => _angVelocity = value;
|
||||||
|
}
|
||||||
|
|
||||||
// debugging ///////////////////////////////////////////////////////////
|
// debugging ///////////////////////////////////////////////////////////
|
||||||
[Header("Debug")]
|
[Header("Debug")]
|
||||||
public bool showGizmos;
|
public bool showGizmos;
|
||||||
@ -263,6 +280,14 @@ protected virtual void Apply(TransformSnapshot interpolated, TransformSnapshot e
|
|||||||
// -> but simply don't apply it. if the user doesn't want to sync
|
// -> but simply don't apply it. if the user doesn't want to sync
|
||||||
// scale, then we should not touch scale etc.
|
// scale, then we should not touch scale etc.
|
||||||
|
|
||||||
|
// Calculate the velocity and angular velocity for the object
|
||||||
|
// These can be used to drive animations or other behaviours
|
||||||
|
if (!isOwned)
|
||||||
|
{
|
||||||
|
velocity = (transform.position - interpolated.position) / Time.deltaTime;
|
||||||
|
angVelocity = (transform.rotation.eulerAngles - interpolated.rotation.eulerAngles) / Time.deltaTime;
|
||||||
|
}
|
||||||
|
|
||||||
// interpolate parts
|
// interpolate parts
|
||||||
if (syncPosition) SetPosition(interpolatePosition ? interpolated.position : endGoal.position);
|
if (syncPosition) SetPosition(interpolatePosition ? interpolated.position : endGoal.position);
|
||||||
if (syncRotation) SetRotation(interpolateRotation ? interpolated.rotation : endGoal.rotation);
|
if (syncRotation) SetRotation(interpolateRotation ? interpolated.rotation : endGoal.rotation);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,11 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: f49d76ebe6adef649872e344e495b1c1
|
guid: 8f63ea2e505fd484193fb31c5c55ca73
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
defaultReferences: []
|
defaultReferences: []
|
||||||
executionOrder: 0
|
executionOrder: 0
|
||||||
icon: {instanceID: 0}
|
icon: {fileID: 2800000, guid: 7453abfe9e8b2c04a8a47eb536fe21eb, type: 3}
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
assetBundleVariant:
|
assetBundleVariant:
|
@ -671,7 +671,24 @@ void OnDestroy()
|
|||||||
|
|
||||||
// if an identity is still in .spawned, remove it too.
|
// if an identity is still in .spawned, remove it too.
|
||||||
// fixes: https://github.com/MirrorNetworking/Mirror/issues/3324
|
// fixes: https://github.com/MirrorNetworking/Mirror/issues/3324
|
||||||
NetworkClient.spawned.Remove(netId);
|
//
|
||||||
|
// however, verify that spawned[netId] is this NetworkIdentity
|
||||||
|
// fixes: https://github.com/MirrorNetworking/Mirror/issues/3785
|
||||||
|
// - server: netId=42 walks out of and back into AOI range in same frame
|
||||||
|
// - client frame 1:
|
||||||
|
// on_destroymsg(42) -> NetworkClient.DestroyObject -> GameObject.Destroy(42) // next frame
|
||||||
|
// on_spawnmsg(42) -> NetworkClient.SpawnPrefab -> Instantiate(42) -> spawned[42]=new_identity
|
||||||
|
// - client frame 2:
|
||||||
|
// Unity destroys the old 42
|
||||||
|
// NetworkIdentity.OnDestroy removes .spawned[42] which is new_identity not old_identity
|
||||||
|
// new_identity becomes orphaned
|
||||||
|
//
|
||||||
|
// solution: only remove if spawned[netId] is this NetworkIdentity or null
|
||||||
|
if (NetworkClient.spawned.TryGetValue(netId, out NetworkIdentity entry))
|
||||||
|
{
|
||||||
|
if (entry == this || entry == null)
|
||||||
|
NetworkClient.spawned.Remove(netId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// workaround for cyclid NI<->NB reference causing memory leaks
|
// workaround for cyclid NI<->NB reference causing memory leaks
|
||||||
|
@ -634,31 +634,6 @@ public void StopClient()
|
|||||||
NetworkClient.Disconnect();
|
NetworkClient.Disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
// called when quitting the application by closing the window / pressing
|
|
||||||
// stop in the editor. virtual so that inheriting classes'
|
|
||||||
// OnApplicationQuit() can call base.OnApplicationQuit() too
|
|
||||||
public virtual void OnApplicationQuit()
|
|
||||||
{
|
|
||||||
// stop client first
|
|
||||||
// (we want to send the quit packet to the server instead of waiting
|
|
||||||
// for a timeout)
|
|
||||||
if (NetworkClient.isConnected)
|
|
||||||
{
|
|
||||||
StopClient();
|
|
||||||
//Debug.Log("OnApplicationQuit: stopped client");
|
|
||||||
}
|
|
||||||
|
|
||||||
// stop server after stopping client (for proper host mode stopping)
|
|
||||||
if (NetworkServer.active)
|
|
||||||
{
|
|
||||||
StopServer();
|
|
||||||
//Debug.Log("OnApplicationQuit: stopped server");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call ResetStatics to reset statics and singleton
|
|
||||||
ResetStatics();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Set the frame rate for a headless builds. Override to disable or modify.</summary>
|
/// <summary>Set the frame rate for a headless builds. Override to disable or modify.</summary>
|
||||||
// useful for dedicated servers.
|
// useful for dedicated servers.
|
||||||
// useful for headless benchmark clients.
|
// useful for headless benchmark clients.
|
||||||
@ -772,12 +747,41 @@ public static void ResetStatics()
|
|||||||
singleton = null;
|
singleton = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// virtual so that inheriting classes' OnDestroy() can call base.OnDestroy() too
|
// called when quitting the application by closing the window / pressing
|
||||||
|
// stop in the editor.
|
||||||
|
// use OnDestroy instead of OnApplicationQuit:
|
||||||
|
// fixes: https://github.com/MirrorNetworking/Mirror/issues/2802
|
||||||
public virtual void OnDestroy()
|
public virtual void OnDestroy()
|
||||||
{
|
{
|
||||||
//Debug.Log("NetworkManager destroyed");
|
//Debug.Log("NetworkManager destroyed");
|
||||||
|
|
||||||
|
// stop client first
|
||||||
|
// (we want to send the quit packet to the server instead of waiting
|
||||||
|
// for a timeout)
|
||||||
|
if (NetworkClient.isConnected)
|
||||||
|
{
|
||||||
|
StopClient();
|
||||||
|
//Debug.Log("OnApplicationQuit: stopped client");
|
||||||
|
}
|
||||||
|
|
||||||
|
// stop server after stopping client (for proper host mode stopping)
|
||||||
|
if (NetworkServer.active)
|
||||||
|
{
|
||||||
|
StopServer();
|
||||||
|
//Debug.Log("OnApplicationQuit: stopped server");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call ResetStatics to reset statics and singleton
|
||||||
|
ResetStatics();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// [Obsolete] in case someone is inheriting it.
|
||||||
|
// don't use this anymore.
|
||||||
|
// fixes: https://github.com/MirrorNetworking/Mirror/issues/2802
|
||||||
|
// DEPRECATED 2024-10-29
|
||||||
|
[Obsolete("Override OnDestroy instead of OnApplicationQuit.")]
|
||||||
|
public virtual void OnApplicationQuit() {}
|
||||||
|
|
||||||
/// <summary>The name of the current network scene.</summary>
|
/// <summary>The name of the current network scene.</summary>
|
||||||
// set by NetworkManager when changing the scene.
|
// set by NetworkManager when changing the scene.
|
||||||
// new clients will automatically load this scene.
|
// new clients will automatically load this scene.
|
||||||
|
@ -62,6 +62,8 @@ public static class NetworkReaderExtensions
|
|||||||
public static decimal ReadDecimal(this NetworkReader reader) => reader.ReadBlittable<decimal>();
|
public static decimal ReadDecimal(this NetworkReader reader) => reader.ReadBlittable<decimal>();
|
||||||
public static decimal? ReadDecimalNullable(this NetworkReader reader) => reader.ReadBlittableNullable<decimal>();
|
public static decimal? ReadDecimalNullable(this NetworkReader reader) => reader.ReadBlittableNullable<decimal>();
|
||||||
|
|
||||||
|
public static Half ReadHalf(this NetworkReader reader) => new Half(reader.ReadUShort());
|
||||||
|
|
||||||
/// <exception cref="T:System.ArgumentException">if an invalid utf8 string is sent</exception>
|
/// <exception cref="T:System.ArgumentException">if an invalid utf8 string is sent</exception>
|
||||||
public static string ReadString(this NetworkReader reader)
|
public static string ReadString(this NetworkReader reader)
|
||||||
{
|
{
|
||||||
@ -311,8 +313,6 @@ public static List<T> ReadList<T>(this NetworkReader reader)
|
|||||||
// structs may have .Set<T> members which weaver needs to be able to
|
// structs may have .Set<T> members which weaver needs to be able to
|
||||||
// fully serialize for NetworkMessages etc.
|
// fully serialize for NetworkMessages etc.
|
||||||
// note that Weaver/Readers/GenerateReader() handles this manually.
|
// note that Weaver/Readers/GenerateReader() handles this manually.
|
||||||
// TODO writer not found. need to adjust weaver first. see tests.
|
|
||||||
/*
|
|
||||||
public static HashSet<T> ReadHashSet<T>(this NetworkReader reader)
|
public static HashSet<T> ReadHashSet<T>(this NetworkReader reader)
|
||||||
{
|
{
|
||||||
// we offset count by '1' to easily support null without writing another byte.
|
// we offset count by '1' to easily support null without writing another byte.
|
||||||
@ -332,7 +332,6 @@ public static HashSet<T> ReadHashSet<T>(this NetworkReader reader)
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
public static T[] ReadArray<T>(this NetworkReader reader)
|
public static T[] ReadArray<T>(this NetworkReader reader)
|
||||||
{
|
{
|
||||||
|
@ -57,6 +57,8 @@ public static class NetworkWriterExtensions
|
|||||||
public static void WriteDecimal(this NetworkWriter writer, decimal value) => writer.WriteBlittable(value);
|
public static void WriteDecimal(this NetworkWriter writer, decimal value) => writer.WriteBlittable(value);
|
||||||
public static void WriteDecimalNullable(this NetworkWriter writer, decimal? value) => writer.WriteBlittableNullable(value);
|
public static void WriteDecimalNullable(this NetworkWriter writer, decimal? value) => writer.WriteBlittableNullable(value);
|
||||||
|
|
||||||
|
public static void WriteHalf(this NetworkWriter writer, Half value) => writer.WriteUShort(value._value);
|
||||||
|
|
||||||
public static void WriteString(this NetworkWriter writer, string value)
|
public static void WriteString(this NetworkWriter writer, string value)
|
||||||
{
|
{
|
||||||
// we offset count by '1' to easily support null without writing another byte.
|
// we offset count by '1' to easily support null without writing another byte.
|
||||||
@ -363,28 +365,25 @@ public static void WriteList<T>(this NetworkWriter writer, List<T> list)
|
|||||||
// structs may have .Set<T> members which weaver needs to be able to
|
// structs may have .Set<T> members which weaver needs to be able to
|
||||||
// fully serialize for NetworkMessages etc.
|
// fully serialize for NetworkMessages etc.
|
||||||
// note that Weaver/Writers/GenerateWriter() handles this manually.
|
// note that Weaver/Writers/GenerateWriter() handles this manually.
|
||||||
// TODO writer not found. need to adjust weaver first. see tests.
|
public static void WriteHashSet<T>(this NetworkWriter writer, HashSet<T> hashSet)
|
||||||
// /*
|
{
|
||||||
// public static void WriteHashSet<T>(this NetworkWriter writer, HashSet<T> hashSet)
|
// we offset count by '1' to easily support null without writing another byte.
|
||||||
// {
|
// encoding null as '0' instead of '-1' also allows for better compression
|
||||||
// // we offset count by '1' to easily support null without writing another byte.
|
// (ushort vs. short / varuint vs. varint) etc.
|
||||||
// // encoding null as '0' instead of '-1' also allows for better compression
|
if (hashSet is null)
|
||||||
// // (ushort vs. short / varuint vs. varint) etc.
|
{
|
||||||
// if (hashSet is null)
|
// most sizes are small, write size as VarUInt!
|
||||||
// {
|
Compression.CompressVarUInt(writer, 0u);
|
||||||
// // most sizes are small, write size as VarUInt!
|
//writer.WriteUInt(0);
|
||||||
// Compression.CompressVarUInt(writer, 0u);
|
return;
|
||||||
// //writer.WriteUInt(0);
|
}
|
||||||
// return;
|
|
||||||
// }
|
// most sizes are small, write size as VarUInt!
|
||||||
//
|
Compression.CompressVarUInt(writer, checked((uint)hashSet.Count) + 1u);
|
||||||
// // most sizes are small, write size as VarUInt!
|
//writer.WriteUInt(checked((uint)hashSet.Count) + 1u);
|
||||||
// Compression.CompressVarUInt(writer, checked((uint)hashSet.Count) + 1u);
|
foreach (T item in hashSet)
|
||||||
// //writer.WriteUInt(checked((uint)hashSet.Count) + 1u);
|
writer.Write(item);
|
||||||
// foreach (T item in hashSet)
|
}
|
||||||
// writer.Write(item);
|
|
||||||
// }
|
|
||||||
// */
|
|
||||||
|
|
||||||
public static void WriteArray<T>(this NetworkWriter writer, T[] array)
|
public static void WriteArray<T>(this NetworkWriter writer, T[] array)
|
||||||
{
|
{
|
||||||
|
@ -21,9 +21,9 @@ public class SyncIDictionary<TKey, TValue> : SyncObject, IDictionary<TKey, TValu
|
|||||||
public enum Operation : byte
|
public enum Operation : byte
|
||||||
{
|
{
|
||||||
OP_ADD,
|
OP_ADD,
|
||||||
OP_CLEAR,
|
OP_SET,
|
||||||
OP_REMOVE,
|
OP_REMOVE,
|
||||||
OP_SET
|
OP_CLEAR
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -114,6 +114,18 @@ public static void SetPositionAndRotation(this Transform transform, Vector3 posi
|
|||||||
transform.position = position;
|
transform.position = position;
|
||||||
transform.rotation = rotation;
|
transform.rotation = rotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void GetLocalPositionAndRotation(this Transform transform, out Vector3 position, out Quaternion rotation)
|
||||||
|
{
|
||||||
|
position = transform.localPosition;
|
||||||
|
rotation = transform.localRotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SetLocalPositionAndRotation(this Transform transform, Vector3 position, Quaternion rotation)
|
||||||
|
{
|
||||||
|
transform.localPosition = position;
|
||||||
|
transform.localRotation = rotation;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// IPEndPoint address only to pretty string.
|
// IPEndPoint address only to pretty string.
|
||||||
|
773
Assets/Mirror/Core/Tools/Half.cs
Normal file
773
Assets/Mirror/Core/Tools/Half.cs
Normal file
@ -0,0 +1,773 @@
|
|||||||
|
// half float from .NET 5:
|
||||||
|
// https://devblogs.microsoft.com/dotnet/introducing-the-half-type/
|
||||||
|
//
|
||||||
|
// drop in from dotnet/runtime source:
|
||||||
|
// https://github.com/dotnet/runtime/blob/e188d6ac90fe56320cca51c53709ef1c72f063d5/src/libraries/System.Private.CoreLib/src/System/Half.cs#L17
|
||||||
|
// removing all the stuff that's not in Unity though.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Licensed to the .NET Foundation under one or more agreements.
|
||||||
|
// The .NET Foundation licenses this file to you under the MIT license.
|
||||||
|
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace System
|
||||||
|
{
|
||||||
|
// Portions of the code implemented below are based on the 'Berkeley SoftFloat Release 3e' algorithms.
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a half-precision floating-point number.
|
||||||
|
/// </summary>
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public readonly struct Half
|
||||||
|
: IComparable,
|
||||||
|
IComparable<Half>,
|
||||||
|
IEquatable<Half>
|
||||||
|
{
|
||||||
|
private const NumberStyles DefaultParseStyle = NumberStyles.Float | NumberStyles.AllowThousands;
|
||||||
|
|
||||||
|
// Constants for manipulating the private bit-representation
|
||||||
|
|
||||||
|
internal const ushort SignMask = 0x8000;
|
||||||
|
internal const int SignShift = 15;
|
||||||
|
internal const byte ShiftedSignMask = SignMask >> SignShift;
|
||||||
|
|
||||||
|
internal const ushort BiasedExponentMask = 0x7C00;
|
||||||
|
internal const int BiasedExponentShift = 10;
|
||||||
|
internal const int BiasedExponentLength = 5;
|
||||||
|
internal const byte ShiftedBiasedExponentMask = BiasedExponentMask >> BiasedExponentShift;
|
||||||
|
|
||||||
|
internal const ushort TrailingSignificandMask = 0x03FF;
|
||||||
|
|
||||||
|
internal const byte MinSign = 0;
|
||||||
|
internal const byte MaxSign = 1;
|
||||||
|
|
||||||
|
internal const byte MinBiasedExponent = 0x00;
|
||||||
|
internal const byte MaxBiasedExponent = 0x1F;
|
||||||
|
|
||||||
|
internal const byte ExponentBias = 15;
|
||||||
|
|
||||||
|
internal const sbyte MinExponent = -14;
|
||||||
|
internal const sbyte MaxExponent = +15;
|
||||||
|
|
||||||
|
internal const ushort MinTrailingSignificand = 0x0000;
|
||||||
|
internal const ushort MaxTrailingSignificand = 0x03FF;
|
||||||
|
|
||||||
|
internal const int TrailingSignificandLength = 10;
|
||||||
|
internal const int SignificandLength = TrailingSignificandLength + 1;
|
||||||
|
|
||||||
|
// Constants representing the private bit-representation for various default values
|
||||||
|
|
||||||
|
private const ushort PositiveZeroBits = 0x0000;
|
||||||
|
private const ushort NegativeZeroBits = 0x8000;
|
||||||
|
|
||||||
|
private const ushort EpsilonBits = 0x0001;
|
||||||
|
|
||||||
|
private const ushort PositiveInfinityBits = 0x7C00;
|
||||||
|
private const ushort NegativeInfinityBits = 0xFC00;
|
||||||
|
|
||||||
|
private const ushort PositiveQNaNBits = 0x7E00;
|
||||||
|
private const ushort NegativeQNaNBits = 0xFE00;
|
||||||
|
|
||||||
|
private const ushort MinValueBits = 0xFBFF;
|
||||||
|
private const ushort MaxValueBits = 0x7BFF;
|
||||||
|
|
||||||
|
private const ushort PositiveOneBits = 0x3C00;
|
||||||
|
private const ushort NegativeOneBits = 0xBC00;
|
||||||
|
|
||||||
|
private const ushort SmallestNormalBits = 0x0400;
|
||||||
|
|
||||||
|
private const ushort EBits = 0x4170;
|
||||||
|
private const ushort PiBits = 0x4248;
|
||||||
|
private const ushort TauBits = 0x4648;
|
||||||
|
|
||||||
|
// Well-defined and commonly used values
|
||||||
|
|
||||||
|
public static Half Epsilon => new Half(EpsilonBits); // 5.9604645E-08
|
||||||
|
|
||||||
|
public static Half PositiveInfinity => new Half(PositiveInfinityBits); // 1.0 / 0.0;
|
||||||
|
|
||||||
|
public static Half NegativeInfinity => new Half(NegativeInfinityBits); // -1.0 / 0.0
|
||||||
|
|
||||||
|
public static Half NaN => new Half(NegativeQNaNBits); // 0.0 / 0.0
|
||||||
|
|
||||||
|
public static Half MinValue => new Half(MinValueBits); // -65504
|
||||||
|
|
||||||
|
public static Half MaxValue => new Half(MaxValueBits); // 65504
|
||||||
|
|
||||||
|
internal readonly ushort _value; // internal representation
|
||||||
|
|
||||||
|
internal Half(ushort value)
|
||||||
|
{
|
||||||
|
_value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Half(bool sign, ushort exp, ushort sig) => _value = (ushort)(((sign ? 1 : 0) << SignShift) + (exp << BiasedExponentShift) + sig);
|
||||||
|
|
||||||
|
internal byte BiasedExponent
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
ushort bits = _value;
|
||||||
|
return ExtractBiasedExponentFromBits(bits);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal sbyte Exponent
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return (sbyte)(BiasedExponent - ExponentBias);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal ushort Significand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return (ushort)(TrailingSignificand | ((BiasedExponent != 0) ? (1U << BiasedExponentShift) : 0U));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal ushort TrailingSignificand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
ushort bits = _value;
|
||||||
|
return ExtractTrailingSignificandFromBits(bits);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static byte ExtractBiasedExponentFromBits(ushort bits)
|
||||||
|
{
|
||||||
|
return (byte)((bits >> BiasedExponentShift) & ShiftedBiasedExponentMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static ushort ExtractTrailingSignificandFromBits(ushort bits)
|
||||||
|
{
|
||||||
|
return (ushort)(bits & TrailingSignificandMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool operator <(Half left, Half right)
|
||||||
|
{
|
||||||
|
if (IsNaN(left) || IsNaN(right))
|
||||||
|
{
|
||||||
|
// IEEE defines that NaN is unordered with respect to everything, including itself.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool leftIsNegative = IsNegative(left);
|
||||||
|
|
||||||
|
if (leftIsNegative != IsNegative(right))
|
||||||
|
{
|
||||||
|
// When the signs of left and right differ, we know that left is less than right if it is
|
||||||
|
// the negative value. The exception to this is if both values are zero, in which case IEEE
|
||||||
|
// says they should be equal, even if the signs differ.
|
||||||
|
return leftIsNegative && !AreZero(left, right);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (left._value != right._value) && ((left._value < right._value) ^ leftIsNegative);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool operator >(Half left, Half right)
|
||||||
|
{
|
||||||
|
return right < left;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool operator <=(Half left, Half right)
|
||||||
|
{
|
||||||
|
if (IsNaN(left) || IsNaN(right))
|
||||||
|
{
|
||||||
|
// IEEE defines that NaN is unordered with respect to everything, including itself.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool leftIsNegative = IsNegative(left);
|
||||||
|
|
||||||
|
if (leftIsNegative != IsNegative(right))
|
||||||
|
{
|
||||||
|
// When the signs of left and right differ, we know that left is less than right if it is
|
||||||
|
// the negative value. The exception to this is if both values are zero, in which case IEEE
|
||||||
|
// says they should be equal, even if the signs differ.
|
||||||
|
return leftIsNegative || AreZero(left, right);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (left._value == right._value) || ((left._value < right._value) ^ leftIsNegative);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool operator >=(Half left, Half right)
|
||||||
|
{
|
||||||
|
return right <= left;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool operator ==(Half left, Half right)
|
||||||
|
{
|
||||||
|
if (IsNaN(left) || IsNaN(right))
|
||||||
|
{
|
||||||
|
// IEEE defines that NaN is not equal to anything, including itself.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// IEEE defines that positive and negative zero are equivalent.
|
||||||
|
return (left._value == right._value) || AreZero(left, right);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool operator !=(Half left, Half right)
|
||||||
|
{
|
||||||
|
return !(left == right);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Determines whether the specified value is finite (zero, subnormal, or normal).</summary>
|
||||||
|
/// <remarks>This effectively checks the value is not NaN and not infinite.</remarks>
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static bool IsFinite(Half value)
|
||||||
|
{
|
||||||
|
uint bits = value._value;
|
||||||
|
return (~bits & PositiveInfinityBits) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Determines whether the specified value is infinite.</summary>
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static bool IsInfinity(Half value)
|
||||||
|
{
|
||||||
|
uint bits = value._value;
|
||||||
|
return (bits & ~SignMask) == PositiveInfinityBits;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Determines whether the specified value is NaN.</summary>
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static bool IsNaN(Half value)
|
||||||
|
{
|
||||||
|
uint bits = value._value;
|
||||||
|
return (bits & ~SignMask) > PositiveInfinityBits;
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
internal static bool IsNaNOrZero(Half value)
|
||||||
|
{
|
||||||
|
uint bits = value._value;
|
||||||
|
return ((bits - 1) & ~SignMask) >= PositiveInfinityBits;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Determines whether the specified value is negative.</summary>
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static bool IsNegative(Half value)
|
||||||
|
{
|
||||||
|
return (short)(value._value) < 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Determines whether the specified value is negative infinity.</summary>
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static bool IsNegativeInfinity(Half value)
|
||||||
|
{
|
||||||
|
return value._value == NegativeInfinityBits;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Determines whether the specified value is normal (finite, but not zero or subnormal).</summary>
|
||||||
|
/// <remarks>This effectively checks the value is not NaN, not infinite, not subnormal, and not zero.</remarks>
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static bool IsNormal(Half value)
|
||||||
|
{
|
||||||
|
uint bits = value._value;
|
||||||
|
return (ushort)((bits & ~SignMask) - SmallestNormalBits) < (PositiveInfinityBits - SmallestNormalBits);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Determines whether the specified value is positive infinity.</summary>
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static bool IsPositiveInfinity(Half value)
|
||||||
|
{
|
||||||
|
return value._value == PositiveInfinityBits;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Determines whether the specified value is subnormal (finite, but not zero or normal).</summary>
|
||||||
|
/// <remarks>This effectively checks the value is not NaN, not infinite, not normal, and not zero.</remarks>
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static bool IsSubnormal(Half value)
|
||||||
|
{
|
||||||
|
uint bits = value._value;
|
||||||
|
return (ushort)((bits & ~SignMask) - 1) < MaxTrailingSignificand;
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
internal static bool IsZero(Half value)
|
||||||
|
{
|
||||||
|
uint bits = value._value;
|
||||||
|
return (bits & ~SignMask) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool AreZero(Half left, Half right)
|
||||||
|
{
|
||||||
|
// IEEE defines that positive and negative zero are equal, this gives us a quick equality check
|
||||||
|
// for two values by or'ing the private bits together and stripping the sign. They are both zero,
|
||||||
|
// and therefore equivalent, if the resulting value is still zero.
|
||||||
|
return ((left._value | right._value) & ~SignMask) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Compares this object to another object, returning an integer that indicates the relationship.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A value less than zero if this is less than <paramref name="obj"/>, zero if this is equal to <paramref name="obj"/>, or a value greater than zero if this is greater than <paramref name="obj"/>.</returns>
|
||||||
|
public int CompareTo(object obj)
|
||||||
|
{
|
||||||
|
if (obj is Half other)
|
||||||
|
{
|
||||||
|
return CompareTo(other);
|
||||||
|
}
|
||||||
|
return (obj is null) ? 1 : throw new ArgumentException("SR.Arg_MustBeHalf");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Compares this object to another object, returning an integer that indicates the relationship.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A value less than zero if this is less than <paramref name="other"/>, zero if this is equal to <paramref name="other"/>, or a value greater than zero if this is greater than <paramref name="other"/>.</returns>
|
||||||
|
public int CompareTo(Half other)
|
||||||
|
{
|
||||||
|
if (this < other)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this > other)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this == other)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsNaN(this))
|
||||||
|
{
|
||||||
|
return IsNaN(other) ? 0 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a value that indicates whether this instance is equal to a specified <paramref name="obj"/>.
|
||||||
|
/// </summary>
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
return (obj is Half other) && Equals(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a value that indicates whether this instance is equal to a specified <paramref name="other"/> value.
|
||||||
|
/// </summary>
|
||||||
|
public bool Equals(Half other)
|
||||||
|
{
|
||||||
|
return _value == other._value
|
||||||
|
|| AreZero(this, other)
|
||||||
|
|| (IsNaN(this) && IsNaN(other));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serves as the default hash function.
|
||||||
|
/// </summary>
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
uint bits = _value;
|
||||||
|
|
||||||
|
if (IsNaNOrZero(this))
|
||||||
|
{
|
||||||
|
// Ensure that all NaNs and both zeros have the same hash code
|
||||||
|
bits &= PositiveInfinityBits;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (int)bits;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a string representation of the current value.
|
||||||
|
/// </summary>
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return ((float)this).ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Explicit Convert To Half
|
||||||
|
//
|
||||||
|
|
||||||
|
/// <summary>Explicitly converts a <see cref="char" /> value to its nearest representable half-precision floating-point value.</summary>
|
||||||
|
public static explicit operator Half(char value) => (Half)(float)value;
|
||||||
|
|
||||||
|
/// <summary>Explicitly converts a <see cref="decimal" /> value to its nearest representable half-precision floating-point value.</summary>
|
||||||
|
public static explicit operator Half(decimal value) => (Half)(float)value;
|
||||||
|
|
||||||
|
/// <summary>Explicitly converts a <see cref="short" /> value to its nearest representable half-precision floating-point value.</summary>
|
||||||
|
/// <returns><paramref name="value" /> converted to its nearest representable half-precision floating-point value.</returns>
|
||||||
|
public static explicit operator Half(short value) => (Half)(float)value;
|
||||||
|
|
||||||
|
/// <summary>Explicitly converts a <see cref="int" /> value to its nearest representable half-precision floating-point value.</summary>
|
||||||
|
/// <returns><paramref name="value" /> converted to its nearest representable half-precision floating-point value.</returns>
|
||||||
|
public static explicit operator Half(int value) => (Half)(float)value;
|
||||||
|
|
||||||
|
/// <summary>Explicitly converts a <see cref="long" /> value to its nearest representable half-precision floating-point value.</summary>
|
||||||
|
/// <returns><paramref name="value" /> converted to its nearest representable half-precision floating-point value.</returns>
|
||||||
|
public static explicit operator Half(long value) => (Half)(float)value;
|
||||||
|
|
||||||
|
/// <summary>Explicitly converts a <see cref="float" /> value to its nearest representable half-precision floating-point value.</summary>
|
||||||
|
/// <returns><paramref name="value" /> converted to its nearest representable half-precision floating-point value.</returns>
|
||||||
|
public static explicit operator Half(float value)
|
||||||
|
{
|
||||||
|
// Unity implement this!
|
||||||
|
return new Half(Mathf.FloatToHalf(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Explicitly converts a <see cref="ushort" /> value to its nearest representable half-precision floating-point value.</summary>
|
||||||
|
/// <returns><paramref name="value" /> converted to its nearest representable half-precision floating-point value.</returns>
|
||||||
|
public static explicit operator Half(ushort value) => (Half)(float)value;
|
||||||
|
|
||||||
|
/// <summary>Explicitly converts a <see cref="uint" /> value to its nearest representable half-precision floating-point value.</summary>
|
||||||
|
/// <returns><paramref name="value" /> converted to its nearest representable half-precision floating-point value.</returns>
|
||||||
|
public static explicit operator Half(uint value) => (Half)(float)value;
|
||||||
|
|
||||||
|
/// <summary>Explicitly converts a <see cref="ulong" /> value to its nearest representable half-precision floating-point value.</summary>
|
||||||
|
/// <returns><paramref name="value" /> converted to its nearest representable half-precision floating-point value.</returns>
|
||||||
|
public static explicit operator Half(ulong value) => (Half)(float)value;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Explicit Convert From Half
|
||||||
|
//
|
||||||
|
|
||||||
|
/// <summary>Explicitly converts a half-precision floating-point value to its nearest representable <see cref="byte" /> value.</summary>
|
||||||
|
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="byte" /> value.</returns>
|
||||||
|
public static explicit operator byte(Half value) => (byte)(float)value;
|
||||||
|
|
||||||
|
/// <summary>Explicitly converts a half-precision floating-point value to its nearest representable <see cref="char" /> value.</summary>
|
||||||
|
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="char" /> value.</returns>
|
||||||
|
public static explicit operator char(Half value) => (char)(float)value;
|
||||||
|
|
||||||
|
/// <summary>Explicitly converts a half-precision floating-point value to its nearest representable <see cref="decimal" /> value.</summary>
|
||||||
|
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="decimal" /> value.</returns>
|
||||||
|
public static explicit operator decimal(Half value) => (decimal)(float)value;
|
||||||
|
|
||||||
|
/// <summary>Explicitly converts a half-precision floating-point value to its nearest representable <see cref="short" /> value.</summary>
|
||||||
|
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="short" /> value.</returns>
|
||||||
|
public static explicit operator short(Half value) => (short)(float)value;
|
||||||
|
|
||||||
|
/// <summary>Explicitly converts a half-precision floating-point value to its nearest representable <see cref="int" /> value.</summary>
|
||||||
|
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="int" /> value.</returns>
|
||||||
|
public static explicit operator int(Half value) => (int)(float)value;
|
||||||
|
|
||||||
|
/// <summary>Explicitly converts a half-precision floating-point value to its nearest representable <see cref="long" /> value.</summary>
|
||||||
|
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="long" /> value.</returns>
|
||||||
|
public static explicit operator long(Half value) => (long)(float)value;
|
||||||
|
|
||||||
|
/// <summary>Explicitly converts a half-precision floating-point value to its nearest representable <see cref="sbyte" /> value.</summary>
|
||||||
|
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="sbyte" /> value.</returns>
|
||||||
|
public static explicit operator sbyte(Half value) => (sbyte)(float)value;
|
||||||
|
|
||||||
|
/// <summary>Explicitly converts a half-precision floating-point value to its nearest representable <see cref="ushort" /> value.</summary>
|
||||||
|
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="ushort" /> value.</returns>
|
||||||
|
public static explicit operator ushort(Half value) => (ushort)(float)value;
|
||||||
|
|
||||||
|
/// <summary>Explicitly converts a half-precision floating-point value to its nearest representable <see cref="uint" /> value.</summary>
|
||||||
|
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="uint" /> value.</returns>
|
||||||
|
public static explicit operator uint(Half value) => (uint)(float)value;
|
||||||
|
|
||||||
|
/// <summary>Explicitly converts a half-precision floating-point value to its nearest representable <see cref="ulong" /> value.</summary>
|
||||||
|
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="ulong" /> value.</returns>
|
||||||
|
public static explicit operator ulong(Half value) => (ulong)(float)value;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Implicit Convert To Half
|
||||||
|
//
|
||||||
|
|
||||||
|
/// <summary>Implicitly converts a <see cref="byte" /> value to its nearest representable half-precision floating-point value.</summary>
|
||||||
|
/// <returns><paramref name="value" /> converted to its nearest representable half-precision floating-point value.</returns>
|
||||||
|
public static implicit operator Half(byte value) => (Half)(float)value;
|
||||||
|
|
||||||
|
/// <summary>Implicitly converts a <see cref="sbyte" /> value to its nearest representable half-precision floating-point value.</summary>
|
||||||
|
/// <returns><paramref name="value" /> converted to its nearest representable half-precision floating-point value.</returns>
|
||||||
|
public static implicit operator Half(sbyte value) => (Half)(float)value;
|
||||||
|
|
||||||
|
/// <summary>Explicitly converts a half-precision floating-point value to its nearest representable <see cref="float" /> value.</summary>
|
||||||
|
/// <returns><paramref name="value" /> converted to its nearest representable <see cref="float" /> value.</returns>
|
||||||
|
public static explicit operator float(Half value)
|
||||||
|
{
|
||||||
|
return Mathf.HalfToFloat(value._value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// IEEE 754 specifies NaNs to be propagated
|
||||||
|
internal static Half Negate(Half value)
|
||||||
|
{
|
||||||
|
return IsNaN(value) ? value : new Half((ushort)(value._value ^ SignMask));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Half operator +(Half left, Half right) => (Half)((float)left + (float)right);
|
||||||
|
|
||||||
|
//
|
||||||
|
// IDecrementOperators
|
||||||
|
//
|
||||||
|
|
||||||
|
public static Half operator --(Half value)
|
||||||
|
{
|
||||||
|
var tmp = (float)value;
|
||||||
|
--tmp;
|
||||||
|
return (Half)tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// IDivisionOperators
|
||||||
|
//
|
||||||
|
|
||||||
|
public static Half operator /(Half left, Half right) => (Half)((float)left / (float)right);
|
||||||
|
|
||||||
|
//
|
||||||
|
// IExponentialFunctions
|
||||||
|
//
|
||||||
|
|
||||||
|
public static Half Exp(Half x) => (Half)Math.Exp((float)x);
|
||||||
|
|
||||||
|
//
|
||||||
|
// IFloatingPoint
|
||||||
|
//
|
||||||
|
|
||||||
|
public static Half Ceiling(Half x) => (Half)Math.Ceiling((float)x);
|
||||||
|
|
||||||
|
public static Half Floor(Half x) => (Half)Math.Floor((float)x);
|
||||||
|
|
||||||
|
public static Half Round(Half x) => (Half)Math.Round((float)x);
|
||||||
|
|
||||||
|
public static Half Round(Half x, int digits) => (Half)Math.Round((float)x, digits);
|
||||||
|
|
||||||
|
public static Half Round(Half x, MidpointRounding mode) => (Half)Math.Round((float)x, mode);
|
||||||
|
|
||||||
|
public static Half Round(Half x, int digits, MidpointRounding mode) => (Half)Math.Round((float)x, digits, mode);
|
||||||
|
|
||||||
|
public static Half Truncate(Half x) => (Half)Math.Truncate((float)x);
|
||||||
|
|
||||||
|
//
|
||||||
|
// IFloatingPointConstants
|
||||||
|
//
|
||||||
|
|
||||||
|
public static Half E => new Half(EBits);
|
||||||
|
|
||||||
|
public static Half Pi => new Half(PiBits);
|
||||||
|
|
||||||
|
public static Half Tau => new Half(TauBits);
|
||||||
|
|
||||||
|
//
|
||||||
|
// IFloatingPointIeee754
|
||||||
|
//
|
||||||
|
|
||||||
|
public static Half NegativeZero => new Half(NegativeZeroBits);
|
||||||
|
|
||||||
|
public static Half Atan2(Half y, Half x) => (Half)Math.Atan2((float)y, (float)x);
|
||||||
|
|
||||||
|
public static Half Lerp(Half value1, Half value2, Half amount) => (Half)Mathf.Lerp((float)value1, (float)value2, (float)amount);
|
||||||
|
|
||||||
|
//
|
||||||
|
// IHyperbolicFunctions
|
||||||
|
//
|
||||||
|
|
||||||
|
public static Half Cosh(Half x) => (Half)Math.Cosh((float)x);
|
||||||
|
|
||||||
|
public static Half Sinh(Half x) => (Half)Math.Sinh((float)x);
|
||||||
|
|
||||||
|
public static Half Tanh(Half x) => (Half)Math.Tanh((float)x);
|
||||||
|
|
||||||
|
//
|
||||||
|
// IIncrementOperators
|
||||||
|
//
|
||||||
|
|
||||||
|
public static Half operator ++(Half value)
|
||||||
|
{
|
||||||
|
var tmp = (float)value;
|
||||||
|
++tmp;
|
||||||
|
return (Half)tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// ILogarithmicFunctions
|
||||||
|
//
|
||||||
|
|
||||||
|
public static Half Log(Half x) => (Half)Math.Log((float)x);
|
||||||
|
|
||||||
|
public static Half Log(Half x, Half newBase) => (Half)Math.Log((float)x, (float)newBase);
|
||||||
|
|
||||||
|
//
|
||||||
|
// IModulusOperators
|
||||||
|
//
|
||||||
|
|
||||||
|
public static Half operator %(Half left, Half right) => (Half)((float)left % (float)right);
|
||||||
|
|
||||||
|
//
|
||||||
|
// IMultiplicativeIdentity
|
||||||
|
//
|
||||||
|
|
||||||
|
public static Half MultiplicativeIdentity => new Half(PositiveOneBits);
|
||||||
|
|
||||||
|
//
|
||||||
|
// IMultiplyOperators
|
||||||
|
//
|
||||||
|
|
||||||
|
public static Half operator *(Half left, Half right) => (Half)((float)left * (float)right);
|
||||||
|
|
||||||
|
//
|
||||||
|
// INumber
|
||||||
|
//
|
||||||
|
|
||||||
|
public static Half Clamp(Half value, Half min, Half max) => (Half)Mathf.Clamp((float)value, (float)min, (float)max);
|
||||||
|
|
||||||
|
public static Half CopySign(Half value, Half sign)
|
||||||
|
{
|
||||||
|
// This method is required to work for all inputs,
|
||||||
|
// including NaN, so we operate on the raw bits.
|
||||||
|
uint xbits = value._value;
|
||||||
|
uint ybits = sign._value;
|
||||||
|
|
||||||
|
// Remove the sign from x, and remove everything but the sign from y
|
||||||
|
// Then, simply OR them to get the correct sign
|
||||||
|
return new Half((ushort)((xbits & ~SignMask) | (ybits & SignMask)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Half Max(Half x, Half y) => (Half)Math.Max((float)x, (float)y);
|
||||||
|
|
||||||
|
public static Half MaxNumber(Half x, Half y)
|
||||||
|
{
|
||||||
|
// This matches the IEEE 754:2019 `maximumNumber` function
|
||||||
|
//
|
||||||
|
// It does not propagate NaN inputs back to the caller and
|
||||||
|
// otherwise returns the larger of the inputs. It
|
||||||
|
// treats +0 as larger than -0 as per the specification.
|
||||||
|
|
||||||
|
if (x != y)
|
||||||
|
{
|
||||||
|
if (!IsNaN(y))
|
||||||
|
{
|
||||||
|
return y < x ? x : y;
|
||||||
|
}
|
||||||
|
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
return IsNegative(y) ? x : y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Half Min(Half x, Half y) => (Half)Math.Min((float)x, (float)y);
|
||||||
|
|
||||||
|
public static Half MinNumber(Half x, Half y)
|
||||||
|
{
|
||||||
|
// This matches the IEEE 754:2019 `minimumNumber` function
|
||||||
|
//
|
||||||
|
// It does not propagate NaN inputs back to the caller and
|
||||||
|
// otherwise returns the larger of the inputs. It
|
||||||
|
// treats +0 as larger than -0 as per the specification.
|
||||||
|
|
||||||
|
if (x != y)
|
||||||
|
{
|
||||||
|
if (!IsNaN(y))
|
||||||
|
{
|
||||||
|
return x < y ? x : y;
|
||||||
|
}
|
||||||
|
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
return IsNegative(x) ? x : y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int Sign(Half value)
|
||||||
|
{
|
||||||
|
if (IsNaN(value))
|
||||||
|
{
|
||||||
|
throw new ArithmeticException("SR.Arithmetic_NaN");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsZero(value))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if (IsNegative(value))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return +1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// INumberBase
|
||||||
|
//
|
||||||
|
|
||||||
|
public static Half One => new Half(PositiveOneBits);
|
||||||
|
|
||||||
|
public static Half Zero => new Half(PositiveZeroBits);
|
||||||
|
|
||||||
|
public static Half Abs(Half value) => new Half((ushort)(value._value & ~SignMask));
|
||||||
|
|
||||||
|
public static bool IsPositive(Half value) => (short)(value._value) >= 0;
|
||||||
|
|
||||||
|
public static bool IsRealNumber(Half value)
|
||||||
|
{
|
||||||
|
// A NaN will never equal itself so this is an
|
||||||
|
// easy and efficient way to check for a real number.
|
||||||
|
|
||||||
|
#pragma warning disable CS1718
|
||||||
|
return value == value;
|
||||||
|
#pragma warning restore CS1718
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// IPowerFunctions
|
||||||
|
//
|
||||||
|
|
||||||
|
public static Half Pow(Half x, Half y) => (Half)Math.Pow((float)x, (float)y);
|
||||||
|
|
||||||
|
//
|
||||||
|
// IRootFunctions
|
||||||
|
//
|
||||||
|
|
||||||
|
public static Half Sqrt(Half x) => (Half)Math.Sqrt((float)x);
|
||||||
|
|
||||||
|
//
|
||||||
|
// ISignedNumber
|
||||||
|
//
|
||||||
|
|
||||||
|
public static Half NegativeOne => new Half(NegativeOneBits);
|
||||||
|
|
||||||
|
//
|
||||||
|
// ISubtractionOperators
|
||||||
|
//
|
||||||
|
|
||||||
|
public static Half operator -(Half left, Half right) => (Half)((float)left - (float)right);
|
||||||
|
|
||||||
|
//
|
||||||
|
// ITrigonometricFunctions
|
||||||
|
//
|
||||||
|
|
||||||
|
public static Half Acos(Half x) => (Half)Math.Acos((float)x);
|
||||||
|
|
||||||
|
public static Half Asin(Half x) => (Half)Math.Asin((float)x);
|
||||||
|
|
||||||
|
public static Half Atan(Half x) => (Half)Math.Atan((float)x);
|
||||||
|
|
||||||
|
public static Half Cos(Half x) => (Half)Math.Cos((float)x);
|
||||||
|
|
||||||
|
public static Half Sin(Half x) => (Half)Math.Sin((float)x);
|
||||||
|
|
||||||
|
public static Half Tan(Half x) => (Half)Math.Tan((float)x);
|
||||||
|
|
||||||
|
//
|
||||||
|
// IUnaryNegationOperators
|
||||||
|
//
|
||||||
|
|
||||||
|
public static Half operator -(Half value) => (Half)(-(float)value);
|
||||||
|
|
||||||
|
//
|
||||||
|
// IUnaryPlusOperators
|
||||||
|
//
|
||||||
|
|
||||||
|
public static Half operator +(Half value) => value;
|
||||||
|
}
|
||||||
|
}
|
3
Assets/Mirror/Core/Tools/Half.cs.meta
Normal file
3
Assets/Mirror/Core/Tools/Half.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 70b5947c49174f3c90121edd21ea6b15
|
||||||
|
timeCreated: 1729783714
|
@ -196,8 +196,15 @@ public virtual void ServerLateUpdate() {}
|
|||||||
/// <summary>Shut down the transport, both as client and server</summary>
|
/// <summary>Shut down the transport, both as client and server</summary>
|
||||||
public abstract void Shutdown();
|
public abstract void Shutdown();
|
||||||
|
|
||||||
/// <summary>Called by Unity when quitting. Inheriting Transports should call base for proper Shutdown.</summary>
|
// [Obsolete] in case someone is inheriting it.
|
||||||
public virtual void OnApplicationQuit()
|
// don't use this anymore.
|
||||||
|
// fixes: https://github.com/MirrorNetworking/Mirror/issues/2802
|
||||||
|
// DEPRECATED 2024-10-29
|
||||||
|
[Obsolete("Override OnDestroy instead of OnApplicationQuit.")]
|
||||||
|
public virtual void OnApplicationQuit() {}
|
||||||
|
|
||||||
|
// fixes: https://github.com/MirrorNetworking/Mirror/issues/2802
|
||||||
|
public virtual void OnDestroy()
|
||||||
{
|
{
|
||||||
// stop transport (e.g. to shut down threads)
|
// stop transport (e.g. to shut down threads)
|
||||||
// (when pressing Stop in the Editor, Unity keeps threads alive
|
// (when pressing Stop in the Editor, Unity keeps threads alive
|
||||||
|
@ -55,19 +55,28 @@ public static void OnPostProcessScene()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// there are two cases where sceneId == 0:
|
// there are two cases where sceneId == 0:
|
||||||
// * if we have a prefab open in the prefab scene
|
// if we have a prefab open in the prefab scene
|
||||||
// * if an unopened scene needs resaving
|
|
||||||
// show a proper error message in both cases so the user
|
|
||||||
// knows what to do.
|
|
||||||
string path = identity.gameObject.scene.path;
|
string path = identity.gameObject.scene.path;
|
||||||
if (string.IsNullOrWhiteSpace(path))
|
if (string.IsNullOrWhiteSpace(path))
|
||||||
|
{
|
||||||
|
// pressing play while in prefab edit mode used to freeze/crash Unity 2019.
|
||||||
|
// this seems fine now so we don't need to stop the editor anymore.
|
||||||
|
#if UNITY_2020_3_OR_NEWER
|
||||||
|
Debug.LogWarning($"{identity.name} was open in Prefab Edit Mode while launching with Mirror. If this causes issues, please let us know.");
|
||||||
|
#else
|
||||||
Debug.LogError($"{identity.name} is currently open in Prefab Edit Mode. Please open the actual scene before launching Mirror.");
|
Debug.LogError($"{identity.name} is currently open in Prefab Edit Mode. Please open the actual scene before launching Mirror.");
|
||||||
|
EditorApplication.isPlaying = false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
// if an unopened scene needs resaving
|
||||||
else
|
else
|
||||||
Debug.LogError($"Scene {path} needs to be opened and resaved, because the scene object {identity.name} has no valid sceneId yet.");
|
{
|
||||||
|
|
||||||
// either way we shouldn't continue. nothing good will
|
// nothing good will happen when trying to launch with invalid sceneIds.
|
||||||
// happen when trying to launch with invalid sceneIds.
|
// show an error and stop playing immediately.
|
||||||
EditorApplication.isPlaying = false;
|
Debug.LogError($"Scene {path} needs to be opened and resaved, because the scene object {identity.name} has no valid sceneId yet.");
|
||||||
|
EditorApplication.isPlaying = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,6 +125,13 @@ MethodReference GenerateReader(TypeReference variableReference, ref bool Weaving
|
|||||||
|
|
||||||
return GenerateReadCollection(variableReference, elementType, nameof(NetworkReaderExtensions.ReadList), ref WeavingFailed);
|
return GenerateReadCollection(variableReference, elementType, nameof(NetworkReaderExtensions.ReadList), ref WeavingFailed);
|
||||||
}
|
}
|
||||||
|
else if (variableDefinition.Is(typeof(HashSet<>)))
|
||||||
|
{
|
||||||
|
GenericInstanceType genericInstance = (GenericInstanceType)variableReference;
|
||||||
|
TypeReference elementType = genericInstance.GenericArguments[0];
|
||||||
|
|
||||||
|
return GenerateReadCollection(variableReference, elementType, nameof(NetworkReaderExtensions.ReadHashSet), ref WeavingFailed);
|
||||||
|
}
|
||||||
// handle both NetworkBehaviour and inheritors.
|
// handle both NetworkBehaviour and inheritors.
|
||||||
// fixes: https://github.com/MirrorNetworking/Mirror/issues/2939
|
// fixes: https://github.com/MirrorNetworking/Mirror/issues/2939
|
||||||
else if (variableReference.IsDerivedFrom<NetworkBehaviour>() || variableReference.Is<NetworkBehaviour>())
|
else if (variableReference.IsDerivedFrom<NetworkBehaviour>() || variableReference.Is<NetworkBehaviour>())
|
||||||
|
@ -126,6 +126,13 @@ MethodReference GenerateWriter(TypeReference variableReference, ref bool Weaving
|
|||||||
|
|
||||||
return GenerateCollectionWriter(variableReference, elementType, nameof(NetworkWriterExtensions.WriteList), ref WeavingFailed);
|
return GenerateCollectionWriter(variableReference, elementType, nameof(NetworkWriterExtensions.WriteList), ref WeavingFailed);
|
||||||
}
|
}
|
||||||
|
if (variableReference.Is(typeof(HashSet<>)))
|
||||||
|
{
|
||||||
|
GenericInstanceType genericInstance = (GenericInstanceType)variableReference;
|
||||||
|
TypeReference elementType = genericInstance.GenericArguments[0];
|
||||||
|
|
||||||
|
return GenerateCollectionWriter(variableReference, elementType, nameof(NetworkWriterExtensions.WriteHashSet), ref WeavingFailed);
|
||||||
|
}
|
||||||
|
|
||||||
// handle both NetworkBehaviour and inheritors.
|
// handle both NetworkBehaviour and inheritors.
|
||||||
// fixes: https://github.com/MirrorNetworking/Mirror/issues/2939
|
// fixes: https://github.com/MirrorNetworking/Mirror/issues/2939
|
||||||
|
@ -130,7 +130,7 @@ MonoBehaviour:
|
|||||||
syncMode: 0
|
syncMode: 0
|
||||||
syncInterval: 0.1
|
syncInterval: 0.1
|
||||||
destinationScene:
|
destinationScene:
|
||||||
startPosition: {x: 0, y: 0, z: 0}
|
startPosition: {x: 0, y: 1.02, z: 0}
|
||||||
label: {fileID: 8197110483235692531}
|
label: {fileID: 8197110483235692531}
|
||||||
labelText:
|
labelText:
|
||||||
--- !u!1 &5961932215084527574
|
--- !u!1 &5961932215084527574
|
||||||
|
@ -197,7 +197,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 472411619}
|
m_GameObject: {fileID: 472411619}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: -6, y: 0, z: 0}
|
m_LocalPosition: {x: -6, y: 1.02, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1518259679}
|
m_Father: {fileID: 1518259679}
|
||||||
@ -240,7 +240,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 493146027}
|
m_GameObject: {fileID: 493146027}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: -9, y: 0, z: 0}
|
m_LocalPosition: {x: -9, y: 1.02, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1518259679}
|
m_Father: {fileID: 1518259679}
|
||||||
@ -397,7 +397,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1224119056}
|
m_GameObject: {fileID: 1224119056}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 1.02, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1518259679}
|
m_Father: {fileID: 1518259679}
|
||||||
@ -670,7 +670,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1513281386}
|
m_GameObject: {fileID: 1513281386}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: -3, y: 0, z: 0}
|
m_LocalPosition: {x: -3, y: 1.02, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1518259679}
|
m_Father: {fileID: 1518259679}
|
||||||
@ -712,7 +712,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1518259678}
|
m_GameObject: {fileID: 1518259678}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 1.1, z: -10}
|
m_LocalPosition: {x: 0, y: 0, z: -10}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 493146028}
|
- {fileID: 493146028}
|
||||||
@ -872,23 +872,13 @@ PrefabInstance:
|
|||||||
- target: {fileID: 3141292696673982546, guid: c624c75494b4d7d4086b9212f897e56a,
|
- target: {fileID: 3141292696673982546, guid: c624c75494b4d7d4086b9212f897e56a,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: sceneId
|
propertyPath: sceneId
|
||||||
value: 1143465467
|
value: 182638750
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 3141292696673982546, guid: c624c75494b4d7d4086b9212f897e56a,
|
|
||||||
type: 3}
|
|
||||||
propertyPath: serverOnly
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 5948271423698091598, guid: c624c75494b4d7d4086b9212f897e56a,
|
- target: {fileID: 5948271423698091598, guid: c624c75494b4d7d4086b9212f897e56a,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: startPosition.x
|
propertyPath: startPosition.x
|
||||||
value: -5
|
value: -5
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 5948271423698091598, guid: c624c75494b4d7d4086b9212f897e56a,
|
|
||||||
type: 3}
|
|
||||||
propertyPath: startPosition.y
|
|
||||||
value: 1.1
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 5948271423698091598, guid: c624c75494b4d7d4086b9212f897e56a,
|
- target: {fileID: 5948271423698091598, guid: c624c75494b4d7d4086b9212f897e56a,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: startPosition.z
|
propertyPath: startPosition.z
|
||||||
|
@ -132,7 +132,7 @@ PrefabInstance:
|
|||||||
- target: {fileID: 1098173225717622921, guid: c624c75494b4d7d4086b9212f897e56a,
|
- target: {fileID: 1098173225717622921, guid: c624c75494b4d7d4086b9212f897e56a,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_RootOrder
|
propertyPath: m_RootOrder
|
||||||
value: 3
|
value: 2
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 1098173225717622921, guid: c624c75494b4d7d4086b9212f897e56a,
|
- target: {fileID: 1098173225717622921, guid: c624c75494b4d7d4086b9212f897e56a,
|
||||||
type: 3}
|
type: 3}
|
||||||
@ -199,21 +199,11 @@ PrefabInstance:
|
|||||||
propertyPath: serverOnly
|
propertyPath: serverOnly
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 5948271423698091598, guid: c624c75494b4d7d4086b9212f897e56a,
|
|
||||||
type: 3}
|
|
||||||
propertyPath: originScene
|
|
||||||
value: Assets/DungeonTest/Scenes/Level2.unity
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 5948271423698091598, guid: c624c75494b4d7d4086b9212f897e56a,
|
- target: {fileID: 5948271423698091598, guid: c624c75494b4d7d4086b9212f897e56a,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: startPosition.x
|
propertyPath: startPosition.x
|
||||||
value: 5
|
value: 5
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 5948271423698091598, guid: c624c75494b4d7d4086b9212f897e56a,
|
|
||||||
type: 3}
|
|
||||||
propertyPath: startPosition.y
|
|
||||||
value: 1.1
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 5948271423698091598, guid: c624c75494b4d7d4086b9212f897e56a,
|
- target: {fileID: 5948271423698091598, guid: c624c75494b4d7d4086b9212f897e56a,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: startPosition.z
|
propertyPath: startPosition.z
|
||||||
|
@ -406,7 +406,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 178547537}
|
m_GameObject: {fileID: 178547537}
|
||||||
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
|
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
|
||||||
m_LocalPosition: {x: 0, y: 1.08, z: 20}
|
m_LocalPosition: {x: 0, y: 1.02, z: 20}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1172568542}
|
m_Father: {fileID: 1172568542}
|
||||||
@ -696,7 +696,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 652875644}
|
m_GameObject: {fileID: 652875644}
|
||||||
m_LocalRotation: {x: 0, y: 0.7071068, z: -0, w: -0.7071068}
|
m_LocalRotation: {x: 0, y: 0.7071068, z: -0, w: -0.7071068}
|
||||||
m_LocalPosition: {x: 20, y: 1.08, z: 0}
|
m_LocalPosition: {x: 20, y: 1.02, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1172568542}
|
m_Father: {fileID: 1172568542}
|
||||||
@ -739,7 +739,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 691846569}
|
m_GameObject: {fileID: 691846569}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 1.08, z: -20}
|
m_LocalPosition: {x: 0, y: 1.02, z: -20}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1172568542}
|
m_Father: {fileID: 1172568542}
|
||||||
@ -1842,8 +1842,6 @@ MonoBehaviour:
|
|||||||
headlessStartMode: 1
|
headlessStartMode: 1
|
||||||
editorAutoStart: 0
|
editorAutoStart: 0
|
||||||
sendRate: 30
|
sendRate: 30
|
||||||
autoStartServerBuild: 0
|
|
||||||
autoConnectClientBuild: 0
|
|
||||||
offlineScene:
|
offlineScene:
|
||||||
onlineScene:
|
onlineScene:
|
||||||
offlineSceneLoadDelay: 0
|
offlineSceneLoadDelay: 0
|
||||||
@ -2065,7 +2063,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1816951099}
|
m_GameObject: {fileID: 1816951099}
|
||||||
m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068}
|
m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068}
|
||||||
m_LocalPosition: {x: -20, y: 1.08, z: 0}
|
m_LocalPosition: {x: -20, y: 1.02, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1172568542}
|
m_Father: {fileID: 1172568542}
|
||||||
|
@ -62,15 +62,6 @@ public override void LateUpdate()
|
|||||||
base.LateUpdate();
|
base.LateUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Runs on both Server and Client
|
|
||||||
/// </summary>
|
|
||||||
public override void OnDestroy()
|
|
||||||
{
|
|
||||||
base.OnDestroy();
|
|
||||||
//UnityEngine.Debug.Log("OnDestroy");
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Start & Stop
|
#region Start & Stop
|
||||||
@ -87,10 +78,10 @@ public override void ConfigureHeadlessFrameRate()
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// called when quitting the application by closing the window / pressing stop in the editor
|
/// called when quitting the application by closing the window / pressing stop in the editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override void OnApplicationQuit()
|
public override void OnDestroy()
|
||||||
{
|
{
|
||||||
base.OnApplicationQuit();
|
base.OnDestroy();
|
||||||
//UnityEngine.Debug.Log("OnApplicationQuit");
|
//UnityEngine.Debug.Log("OnDestroy");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -148,5 +148,5 @@ MonoBehaviour:
|
|||||||
syncMode: 0
|
syncMode: 0
|
||||||
syncInterval: 0.1
|
syncInterval: 0.1
|
||||||
speed: 1
|
speed: 1
|
||||||
movementProbability: 0.5
|
movementProbability: 0.1
|
||||||
movementDistance: 20
|
movementDistance: 20
|
||||||
|
@ -5,7 +5,13 @@ namespace Mirror.Examples.Benchmark
|
|||||||
public class MonsterMovement : NetworkBehaviour
|
public class MonsterMovement : NetworkBehaviour
|
||||||
{
|
{
|
||||||
public float speed = 1;
|
public float speed = 1;
|
||||||
public float movementProbability = 0.5f;
|
|
||||||
|
// movement probability:
|
||||||
|
// 0.5 is too high, monsters are moving almost all the time.
|
||||||
|
// only-sync-on-change shows no difference with 0.5 at all.
|
||||||
|
// in other words: broken change detection would be too easy to miss!
|
||||||
|
[Header("Note: use 0.1 to test change detection, 0.5 is too high!")]
|
||||||
|
public float movementProbability = 0.1f;
|
||||||
public float movementDistance = 20;
|
public float movementDistance = 20;
|
||||||
|
|
||||||
bool moving;
|
bool moving;
|
||||||
|
@ -259,8 +259,6 @@ MonoBehaviour:
|
|||||||
headlessStartMode: 1
|
headlessStartMode: 1
|
||||||
editorAutoStart: 0
|
editorAutoStart: 0
|
||||||
sendRate: 60
|
sendRate: 60
|
||||||
autoStartServerBuild: 0
|
|
||||||
autoConnectClientBuild: 0
|
|
||||||
offlineScene:
|
offlineScene:
|
||||||
onlineScene:
|
onlineScene:
|
||||||
offlineSceneLoadDelay: 0
|
offlineSceneLoadDelay: 0
|
||||||
@ -363,7 +361,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 204334129}
|
m_GameObject: {fileID: 204334129}
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: -15}
|
m_LocalPosition: {x: 0, y: 1.02, z: -15}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1445635740}
|
m_Father: {fileID: 1445635740}
|
||||||
@ -406,7 +404,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 263230754}
|
m_GameObject: {fileID: 263230754}
|
||||||
m_LocalRotation: {x: 0, y: 0.38268343, z: 0, w: 0.92387956}
|
m_LocalRotation: {x: 0, y: 0.38268343, z: 0, w: 0.92387956}
|
||||||
m_LocalPosition: {x: -15, y: 0, z: -15}
|
m_LocalPosition: {x: -15, y: 1.02, z: -15}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1445635740}
|
m_Father: {fileID: 1445635740}
|
||||||
@ -449,7 +447,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 290557149}
|
m_GameObject: {fileID: 290557149}
|
||||||
m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068}
|
m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068}
|
||||||
m_LocalPosition: {x: -15, y: 0, z: 0}
|
m_LocalPosition: {x: -15, y: 1.02, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1445635740}
|
m_Father: {fileID: 1445635740}
|
||||||
@ -584,7 +582,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 733367779}
|
m_GameObject: {fileID: 733367779}
|
||||||
m_LocalRotation: {x: -0, y: 1, z: -0, w: 0}
|
m_LocalRotation: {x: -0, y: 1, z: -0, w: 0}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 15}
|
m_LocalPosition: {x: 0, y: 1.02, z: 15}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1445635740}
|
m_Father: {fileID: 1445635740}
|
||||||
@ -627,7 +625,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 990635329}
|
m_GameObject: {fileID: 990635329}
|
||||||
m_LocalRotation: {x: 0, y: 0.92387956, z: 0, w: 0.38268343}
|
m_LocalRotation: {x: 0, y: 0.92387956, z: 0, w: 0.38268343}
|
||||||
m_LocalPosition: {x: -15, y: 0, z: 15}
|
m_LocalPosition: {x: -15, y: 1.02, z: 15}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1445635740}
|
m_Father: {fileID: 1445635740}
|
||||||
@ -735,7 +733,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1445635739}
|
m_GameObject: {fileID: 1445635739}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 2, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 733367780}
|
- {fileID: 733367780}
|
||||||
@ -774,7 +772,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1760045336}
|
m_GameObject: {fileID: 1760045336}
|
||||||
m_LocalRotation: {x: 0, y: 0.3826836, z: -0, w: -0.92387944}
|
m_LocalRotation: {x: 0, y: 0.3826836, z: -0, w: -0.92387944}
|
||||||
m_LocalPosition: {x: 15, y: 0, z: -15}
|
m_LocalPosition: {x: 15, y: 1.02, z: -15}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1445635740}
|
m_Father: {fileID: 1445635740}
|
||||||
@ -817,7 +815,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1975674812}
|
m_GameObject: {fileID: 1975674812}
|
||||||
m_LocalRotation: {x: 0, y: 0.7071068, z: -0, w: -0.7071068}
|
m_LocalRotation: {x: 0, y: 0.7071068, z: -0, w: -0.7071068}
|
||||||
m_LocalPosition: {x: 15, y: 0, z: 0}
|
m_LocalPosition: {x: 15, y: 1.02, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1445635740}
|
m_Father: {fileID: 1445635740}
|
||||||
@ -860,7 +858,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 2127619491}
|
m_GameObject: {fileID: 2127619491}
|
||||||
m_LocalRotation: {x: 0, y: 0.9238796, z: -0, w: -0.38268325}
|
m_LocalRotation: {x: 0, y: 0.9238796, z: -0, w: -0.38268325}
|
||||||
m_LocalPosition: {x: 15, y: 0, z: 15}
|
m_LocalPosition: {x: 15, y: 1.02, z: 15}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1445635740}
|
m_Father: {fileID: 1445635740}
|
||||||
|
@ -1,5 +1,111 @@
|
|||||||
%YAML 1.1
|
%YAML 1.1
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &2505838817581327622
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 8070823805368028938}
|
||||||
|
- component: {fileID: 9066655185906928051}
|
||||||
|
- component: {fileID: 4760233786622638652}
|
||||||
|
- component: {fileID: 2239866139065920034}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: PlayerName
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &8070823805368028938
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2505838817581327622}
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 1.4999999, z: 0}
|
||||||
|
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 5650773562400175449}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!23 &9066655185906928051
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2505838817581327622}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
--- !u!102 &4760233786622638652
|
||||||
|
TextMesh:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2505838817581327622}
|
||||||
|
m_Text: RB Reliable
|
||||||
|
m_OffsetZ: 0
|
||||||
|
m_CharacterSize: 0.5
|
||||||
|
m_LineSpacing: 1
|
||||||
|
m_Anchor: 4
|
||||||
|
m_Alignment: 1
|
||||||
|
m_TabSize: 4
|
||||||
|
m_FontSize: 100
|
||||||
|
m_FontStyle: 0
|
||||||
|
m_RichText: 1
|
||||||
|
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_Color:
|
||||||
|
serializedVersion: 2
|
||||||
|
rgba: 4294967040
|
||||||
|
--- !u!114 &2239866139065920034
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2505838817581327622}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: afa2d590c474413d9fc183551385ed85, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &3564599214188516024
|
--- !u!1 &3564599214188516024
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -176,7 +282,7 @@ GameObject:
|
|||||||
- component: {fileID: 4932227711505240966}
|
- component: {fileID: 4932227711505240966}
|
||||||
- component: {fileID: 8229469515647906458}
|
- component: {fileID: 8229469515647906458}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: PlayerKRBReliable
|
m_Name: PlayerRBReliable
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
@ -194,6 +300,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 4320229852458648655}
|
- {fileID: 4320229852458648655}
|
||||||
|
- {fileID: 8070823805368028938}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
@ -1,5 +1,111 @@
|
|||||||
%YAML 1.1
|
%YAML 1.1
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!1 &1900176203039934355
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 4129545300081926521}
|
||||||
|
- component: {fileID: 6572775962608386051}
|
||||||
|
- component: {fileID: 3912971638250293984}
|
||||||
|
- component: {fileID: 4630973873820678624}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: PlayerName
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &4129545300081926521
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1900176203039934355}
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 1.4999999, z: 0}
|
||||||
|
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 6814142693731383418}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!23 &6572775962608386051
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1900176203039934355}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
--- !u!102 &3912971638250293984
|
||||||
|
TextMesh:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1900176203039934355}
|
||||||
|
m_Text: RB Unreliable
|
||||||
|
m_OffsetZ: 0
|
||||||
|
m_CharacterSize: 0.5
|
||||||
|
m_LineSpacing: 1
|
||||||
|
m_Anchor: 4
|
||||||
|
m_Alignment: 1
|
||||||
|
m_TabSize: 4
|
||||||
|
m_FontSize: 100
|
||||||
|
m_FontStyle: 0
|
||||||
|
m_RichText: 1
|
||||||
|
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_Color:
|
||||||
|
serializedVersion: 2
|
||||||
|
rgba: 4278255615
|
||||||
|
--- !u!114 &4630973873820678624
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1900176203039934355}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: afa2d590c474413d9fc183551385ed85, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &2414815785185615771
|
--- !u!1 &2414815785185615771
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -176,7 +282,7 @@ GameObject:
|
|||||||
- component: {fileID: 1100861297868964075}
|
- component: {fileID: 1100861297868964075}
|
||||||
- component: {fileID: 3894195534993113074}
|
- component: {fileID: 3894195534993113074}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: PlayerKRBUnreliable
|
m_Name: PlayerRBUnreliable
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
@ -194,6 +300,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 3102887894851733868}
|
- {fileID: 3102887894851733868}
|
||||||
|
- {fileID: 4129545300081926521}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
@ -79,6 +79,112 @@ MeshRenderer:
|
|||||||
m_SortingLayerID: 0
|
m_SortingLayerID: 0
|
||||||
m_SortingLayer: 0
|
m_SortingLayer: 0
|
||||||
m_SortingOrder: 0
|
m_SortingOrder: 0
|
||||||
|
--- !u!1 &5366675989284536270
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1545974004720046327}
|
||||||
|
- component: {fileID: 1128890847761595466}
|
||||||
|
- component: {fileID: 396193860522376263}
|
||||||
|
- component: {fileID: 6075803386746488465}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: PlayerName
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &1545974004720046327
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5366675989284536270}
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 1.5, z: 0}
|
||||||
|
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 4659514702152478195}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!23 &1128890847761595466
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5366675989284536270}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
--- !u!102 &396193860522376263
|
||||||
|
TextMesh:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5366675989284536270}
|
||||||
|
m_Text: Reliable
|
||||||
|
m_OffsetZ: 0
|
||||||
|
m_CharacterSize: 0.5
|
||||||
|
m_LineSpacing: 1
|
||||||
|
m_Anchor: 4
|
||||||
|
m_Alignment: 1
|
||||||
|
m_TabSize: 4
|
||||||
|
m_FontSize: 100
|
||||||
|
m_FontStyle: 0
|
||||||
|
m_RichText: 1
|
||||||
|
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_Color:
|
||||||
|
serializedVersion: 2
|
||||||
|
rgba: 4294967040
|
||||||
|
--- !u!114 &6075803386746488465
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5366675989284536270}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: afa2d590c474413d9fc183551385ed85, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &5844787331012650587
|
--- !u!1 &5844787331012650587
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -195,6 +301,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 3834521907656645861}
|
- {fileID: 3834521907656645861}
|
||||||
|
- {fileID: 1545974004720046327}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
@ -71,14 +71,6 @@ public override void ConfigureHeadlessFrameRate()
|
|||||||
base.ConfigureHeadlessFrameRate();
|
base.ConfigureHeadlessFrameRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// called when quitting the application by closing the window / pressing stop in the editor
|
|
||||||
/// </summary>
|
|
||||||
public override void OnApplicationQuit()
|
|
||||||
{
|
|
||||||
base.OnApplicationQuit();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Scene Management
|
#region Scene Management
|
||||||
|
@ -198,8 +198,8 @@ Transform:
|
|||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 361955662}
|
m_GameObject: {fileID: 361955662}
|
||||||
m_LocalRotation: {x: 0.08715574, y: -0, z: -0, w: 0.9961947}
|
m_LocalRotation: {x: 0.15731035, y: 0.072513655, z: -0.011583021, w: 0.98481524}
|
||||||
m_LocalPosition: {x: 0, y: 4.08, z: -8}
|
m_LocalPosition: {x: -402.78363, y: 31.230488, z: -13.799797}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
@ -421,7 +421,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 890531170}
|
m_GameObject: {fileID: 890531170}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: -400, y: 1, z: 5}
|
m_LocalPosition: {x: -325, y: 11.02, z: -6}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
@ -464,7 +464,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 980545347}
|
m_GameObject: {fileID: 980545347}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: -400, y: 1, z: 2}
|
m_LocalPosition: {x: -325, y: 11.02, z: -10}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
@ -507,7 +507,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1175360880}
|
m_GameObject: {fileID: 1175360880}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: -400, y: 1, z: -2}
|
m_LocalPosition: {x: -325, y: 11.02, z: -14}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
@ -524,6 +524,7 @@ GameObject:
|
|||||||
- component: {fileID: 1177316164}
|
- component: {fileID: 1177316164}
|
||||||
- component: {fileID: 1177316163}
|
- component: {fileID: 1177316163}
|
||||||
- component: {fileID: 1177316162}
|
- component: {fileID: 1177316162}
|
||||||
|
- component: {fileID: 1177316165}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Terrain
|
m_Name: Terrain
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -589,6 +590,22 @@ Transform:
|
|||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 2
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &1177316165
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1177316161}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 86898d6de7df85e4aaaaca9663b06602, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
scale: 20
|
||||||
|
heightMultiplier: 1.5
|
||||||
|
offsetX: 100
|
||||||
|
offsetY: 100
|
||||||
--- !u!1 &1708370876
|
--- !u!1 &1708370876
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -626,7 +643,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1708370876}
|
m_GameObject: {fileID: 1708370876}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: -400, y: 1, z: -5}
|
m_LocalPosition: {x: -325, y: 11.02, z: -18}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
|
Binary file not shown.
@ -159,6 +159,112 @@ MeshRenderer:
|
|||||||
m_SortingLayerID: 0
|
m_SortingLayerID: 0
|
||||||
m_SortingLayer: 0
|
m_SortingLayer: 0
|
||||||
m_SortingOrder: 0
|
m_SortingOrder: 0
|
||||||
|
--- !u!1 &7554601580530514207
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 8679949096303753939}
|
||||||
|
- component: {fileID: 3142866354055383265}
|
||||||
|
- component: {fileID: 8297296856940116434}
|
||||||
|
- component: {fileID: 1123801447343694564}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: PlayerName
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &8679949096303753939
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7554601580530514207}
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 1.4999999, z: 0}
|
||||||
|
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 4659514702152478195}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!23 &3142866354055383265
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7554601580530514207}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
--- !u!102 &8297296856940116434
|
||||||
|
TextMesh:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7554601580530514207}
|
||||||
|
m_Text: Unreliable
|
||||||
|
m_OffsetZ: 0
|
||||||
|
m_CharacterSize: 0.5
|
||||||
|
m_LineSpacing: 1
|
||||||
|
m_Anchor: 4
|
||||||
|
m_Alignment: 1
|
||||||
|
m_TabSize: 4
|
||||||
|
m_FontSize: 100
|
||||||
|
m_FontStyle: 0
|
||||||
|
m_RichText: 1
|
||||||
|
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_Color:
|
||||||
|
serializedVersion: 2
|
||||||
|
rgba: 4278255615
|
||||||
|
--- !u!114 &1123801447343694564
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7554601580530514207}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: afa2d590c474413d9fc183551385ed85, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &7863680369626900553
|
--- !u!1 &7863680369626900553
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -195,6 +301,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 3834521907656645861}
|
- {fileID: 3834521907656645861}
|
||||||
|
- {fileID: 8679949096303753939}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
@ -38,6 +38,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 702109291309605218}
|
- {fileID: 702109291309605218}
|
||||||
|
- {fileID: 1245118046271587945}
|
||||||
- {fileID: 8174595063106582951}
|
- {fileID: 8174595063106582951}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
@ -197,7 +198,6 @@ MonoBehaviour:
|
|||||||
maxTurnSpeed: 100
|
maxTurnSpeed: 100
|
||||||
turnAcceleration: 3
|
turnAcceleration: 3
|
||||||
runtimeData:
|
runtimeData:
|
||||||
_horizontal: 0
|
|
||||||
_vertical: 0
|
_vertical: 0
|
||||||
_turnSpeed: 0
|
_turnSpeed: 0
|
||||||
_animVelocity: 0
|
_animVelocity: 0
|
||||||
@ -328,6 +328,112 @@ MonoBehaviour:
|
|||||||
rotationSensitivity: 0.01
|
rotationSensitivity: 0.01
|
||||||
positionPrecision: 0.01
|
positionPrecision: 0.01
|
||||||
scalePrecision: 0.01
|
scalePrecision: 0.01
|
||||||
|
--- !u!1 &8370326626297540303
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1245118046271587945}
|
||||||
|
- component: {fileID: 2132579043257509693}
|
||||||
|
- component: {fileID: 7297775110981071875}
|
||||||
|
- component: {fileID: 755026988438523126}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: PlayerName
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &1245118046271587945
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8370326626297540303}
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 4.5, z: 0}
|
||||||
|
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 4659514702152478195}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!23 &2132579043257509693
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8370326626297540303}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
--- !u!102 &7297775110981071875
|
||||||
|
TextMesh:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8370326626297540303}
|
||||||
|
m_Text: Reliable
|
||||||
|
m_OffsetZ: 0
|
||||||
|
m_CharacterSize: 0.5
|
||||||
|
m_LineSpacing: 1
|
||||||
|
m_Anchor: 4
|
||||||
|
m_Alignment: 1
|
||||||
|
m_TabSize: 4
|
||||||
|
m_FontSize: 100
|
||||||
|
m_FontStyle: 0
|
||||||
|
m_RichText: 1
|
||||||
|
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_Color:
|
||||||
|
serializedVersion: 2
|
||||||
|
rgba: 4294967040
|
||||||
|
--- !u!114 &755026988438523126
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8370326626297540303}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: afa2d590c474413d9fc183551385ed85, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &9109672380512621037
|
--- !u!1 &9109672380512621037
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -359,7 +465,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 4659514702152478195}
|
m_Father: {fileID: 4659514702152478195}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!23 &4153780752967283830
|
--- !u!23 &4153780752967283830
|
||||||
MeshRenderer:
|
MeshRenderer:
|
||||||
@ -446,6 +552,11 @@ PrefabInstance:
|
|||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: BasePrefab
|
value: BasePrefab
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3638700596990361445, guid: dad07e68d3659e6439279d0d4110cf4c,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 3638700596990361445, guid: dad07e68d3659e6439279d0d4110cf4c,
|
- target: {fileID: 3638700596990361445, guid: dad07e68d3659e6439279d0d4110cf4c,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
|
@ -38,6 +38,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 702109291309605218}
|
- {fileID: 702109291309605218}
|
||||||
|
- {fileID: 3980373565918037634}
|
||||||
- {fileID: 8174595063106582951}
|
- {fileID: 8174595063106582951}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
@ -197,7 +198,6 @@ MonoBehaviour:
|
|||||||
maxTurnSpeed: 100
|
maxTurnSpeed: 100
|
||||||
turnAcceleration: 3
|
turnAcceleration: 3
|
||||||
runtimeData:
|
runtimeData:
|
||||||
_horizontal: 0
|
|
||||||
_vertical: 0
|
_vertical: 0
|
||||||
_turnSpeed: 0
|
_turnSpeed: 0
|
||||||
_animVelocity: 0
|
_animVelocity: 0
|
||||||
@ -328,6 +328,112 @@ MonoBehaviour:
|
|||||||
positionSensitivity: 0.01
|
positionSensitivity: 0.01
|
||||||
rotationSensitivity: 0.01
|
rotationSensitivity: 0.01
|
||||||
scaleSensitivity: 0.01
|
scaleSensitivity: 0.01
|
||||||
|
--- !u!1 &8921157218750951074
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 3980373565918037634}
|
||||||
|
- component: {fileID: 6676747655999921495}
|
||||||
|
- component: {fileID: 2065557788844610204}
|
||||||
|
- component: {fileID: 7150452883383585942}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: PlayerName
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &3980373565918037634
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8921157218750951074}
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 4.5, z: 0}
|
||||||
|
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 4659514702152478195}
|
||||||
|
m_RootOrder: 1
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!23 &6676747655999921495
|
||||||
|
MeshRenderer:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8921157218750951074}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_CastShadows: 1
|
||||||
|
m_ReceiveShadows: 1
|
||||||
|
m_DynamicOccludee: 1
|
||||||
|
m_MotionVectors: 1
|
||||||
|
m_LightProbeUsage: 1
|
||||||
|
m_ReflectionProbeUsage: 1
|
||||||
|
m_RayTracingMode: 2
|
||||||
|
m_RenderingLayerMask: 1
|
||||||
|
m_RendererPriority: 0
|
||||||
|
m_Materials:
|
||||||
|
- {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_StaticBatchInfo:
|
||||||
|
firstSubMesh: 0
|
||||||
|
subMeshCount: 0
|
||||||
|
m_StaticBatchRoot: {fileID: 0}
|
||||||
|
m_ProbeAnchor: {fileID: 0}
|
||||||
|
m_LightProbeVolumeOverride: {fileID: 0}
|
||||||
|
m_ScaleInLightmap: 1
|
||||||
|
m_ReceiveGI: 1
|
||||||
|
m_PreserveUVs: 0
|
||||||
|
m_IgnoreNormalsForChartDetection: 0
|
||||||
|
m_ImportantGI: 0
|
||||||
|
m_StitchLightmapSeams: 1
|
||||||
|
m_SelectedEditorRenderState: 3
|
||||||
|
m_MinimumChartSize: 4
|
||||||
|
m_AutoUVMaxDistance: 0.5
|
||||||
|
m_AutoUVMaxAngle: 89
|
||||||
|
m_LightmapParameters: {fileID: 0}
|
||||||
|
m_SortingLayerID: 0
|
||||||
|
m_SortingLayer: 0
|
||||||
|
m_SortingOrder: 0
|
||||||
|
--- !u!102 &2065557788844610204
|
||||||
|
TextMesh:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8921157218750951074}
|
||||||
|
m_Text: Unreliable
|
||||||
|
m_OffsetZ: 0
|
||||||
|
m_CharacterSize: 0.5
|
||||||
|
m_LineSpacing: 1
|
||||||
|
m_Anchor: 4
|
||||||
|
m_Alignment: 1
|
||||||
|
m_TabSize: 4
|
||||||
|
m_FontSize: 100
|
||||||
|
m_FontStyle: 0
|
||||||
|
m_RichText: 1
|
||||||
|
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
m_Color:
|
||||||
|
serializedVersion: 2
|
||||||
|
rgba: 4278255615
|
||||||
|
--- !u!114 &7150452883383585942
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 8921157218750951074}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: afa2d590c474413d9fc183551385ed85, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
--- !u!1 &9109672380512621037
|
--- !u!1 &9109672380512621037
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -359,7 +465,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 4659514702152478195}
|
m_Father: {fileID: 4659514702152478195}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!23 &4153780752967283830
|
--- !u!23 &4153780752967283830
|
||||||
MeshRenderer:
|
MeshRenderer:
|
||||||
@ -446,6 +552,11 @@ PrefabInstance:
|
|||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: BasePrefab
|
value: BasePrefab
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3638700596990361445, guid: dad07e68d3659e6439279d0d4110cf4c,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 3638700596990361445, guid: dad07e68d3659e6439279d0d4110cf4c,
|
- target: {fileID: 3638700596990361445, guid: dad07e68d3659e6439279d0d4110cf4c,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
|
@ -239,7 +239,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 204334129}
|
m_GameObject: {fileID: 204334129}
|
||||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: -15}
|
m_LocalPosition: {x: 0, y: 1.02, z: -15}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1445635740}
|
m_Father: {fileID: 1445635740}
|
||||||
@ -282,7 +282,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 263230754}
|
m_GameObject: {fileID: 263230754}
|
||||||
m_LocalRotation: {x: 0, y: 0.38268343, z: 0, w: 0.92387956}
|
m_LocalRotation: {x: 0, y: 0.38268343, z: 0, w: 0.92387956}
|
||||||
m_LocalPosition: {x: -15, y: 0, z: -15}
|
m_LocalPosition: {x: -15, y: 1.02, z: -15}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1445635740}
|
m_Father: {fileID: 1445635740}
|
||||||
@ -391,7 +391,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 290557149}
|
m_GameObject: {fileID: 290557149}
|
||||||
m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068}
|
m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068}
|
||||||
m_LocalPosition: {x: -15, y: 0, z: 0}
|
m_LocalPosition: {x: -15, y: 1.02, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1445635740}
|
m_Father: {fileID: 1445635740}
|
||||||
@ -434,7 +434,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 733367779}
|
m_GameObject: {fileID: 733367779}
|
||||||
m_LocalRotation: {x: -0, y: 1, z: -0, w: 0}
|
m_LocalRotation: {x: -0, y: 1, z: -0, w: 0}
|
||||||
m_LocalPosition: {x: 0, y: 0, z: 15}
|
m_LocalPosition: {x: 0, y: 1.02, z: 15}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1445635740}
|
m_Father: {fileID: 1445635740}
|
||||||
@ -477,7 +477,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 990635329}
|
m_GameObject: {fileID: 990635329}
|
||||||
m_LocalRotation: {x: 0, y: 0.92387956, z: 0, w: 0.38268343}
|
m_LocalRotation: {x: 0, y: 0.92387956, z: 0, w: 0.38268343}
|
||||||
m_LocalPosition: {x: -15, y: 0, z: 15}
|
m_LocalPosition: {x: -15, y: 1.02, z: 15}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1445635740}
|
m_Father: {fileID: 1445635740}
|
||||||
@ -743,7 +743,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1445635739}
|
m_GameObject: {fileID: 1445635739}
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
m_LocalPosition: {x: 0, y: 1.08, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 733367780}
|
- {fileID: 733367780}
|
||||||
@ -782,7 +782,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1760045336}
|
m_GameObject: {fileID: 1760045336}
|
||||||
m_LocalRotation: {x: 0, y: 0.3826836, z: -0, w: -0.92387944}
|
m_LocalRotation: {x: 0, y: 0.3826836, z: -0, w: -0.92387944}
|
||||||
m_LocalPosition: {x: 15, y: 0, z: -15}
|
m_LocalPosition: {x: 15, y: 1.02, z: -15}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1445635740}
|
m_Father: {fileID: 1445635740}
|
||||||
@ -825,7 +825,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1975674812}
|
m_GameObject: {fileID: 1975674812}
|
||||||
m_LocalRotation: {x: 0, y: 0.7071068, z: -0, w: -0.7071068}
|
m_LocalRotation: {x: 0, y: 0.7071068, z: -0, w: -0.7071068}
|
||||||
m_LocalPosition: {x: 15, y: 0, z: 0}
|
m_LocalPosition: {x: 15, y: 1.02, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1445635740}
|
m_Father: {fileID: 1445635740}
|
||||||
@ -868,7 +868,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 2127619491}
|
m_GameObject: {fileID: 2127619491}
|
||||||
m_LocalRotation: {x: 0, y: 0.9238796, z: -0, w: -0.38268325}
|
m_LocalRotation: {x: 0, y: 0.9238796, z: -0, w: -0.38268325}
|
||||||
m_LocalPosition: {x: 15, y: 0, z: 15}
|
m_LocalPosition: {x: 15, y: 1.02, z: 15}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 1445635740}
|
m_Father: {fileID: 1445635740}
|
||||||
|
@ -147,7 +147,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 12226146}
|
m_GameObject: {fileID: 12226146}
|
||||||
m_LocalRotation: {x: 0, y: 0.38268343, z: 0, w: 0.92387956}
|
m_LocalRotation: {x: 0, y: 0.38268343, z: 0, w: 0.92387956}
|
||||||
m_LocalPosition: {x: -14, y: 2, z: -14}
|
m_LocalPosition: {x: -14, y: 1.02, z: -14}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 4239341309712137294}
|
m_Father: {fileID: 4239341309712137294}
|
||||||
@ -282,7 +282,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 386825728}
|
m_GameObject: {fileID: 386825728}
|
||||||
m_LocalRotation: {x: 0, y: -0.38268343, z: 0, w: 0.92387956}
|
m_LocalRotation: {x: 0, y: -0.38268343, z: 0, w: 0.92387956}
|
||||||
m_LocalPosition: {x: 14, y: 2, z: -14}
|
m_LocalPosition: {x: 14, y: 1.02, z: -14}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 4239341309712137294}
|
m_Father: {fileID: 4239341309712137294}
|
||||||
@ -390,7 +390,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 781619875}
|
m_GameObject: {fileID: 781619875}
|
||||||
m_LocalRotation: {x: 0, y: 0.92387956, z: 0, w: 0.38268343}
|
m_LocalRotation: {x: 0, y: 0.92387956, z: 0, w: 0.38268343}
|
||||||
m_LocalPosition: {x: -14, y: 2, z: 14}
|
m_LocalPosition: {x: -14, y: 1.02, z: 14}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 4239341309712137294}
|
m_Father: {fileID: 4239341309712137294}
|
||||||
@ -583,7 +583,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1695890598}
|
m_GameObject: {fileID: 1695890598}
|
||||||
m_LocalRotation: {x: 0, y: -0.92387956, z: 0, w: 0.38268343}
|
m_LocalRotation: {x: 0, y: -0.92387956, z: 0, w: 0.38268343}
|
||||||
m_LocalPosition: {x: 14, y: 2, z: 14}
|
m_LocalPosition: {x: 14, y: 1.02, z: 14}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 4239341309712137294}
|
m_Father: {fileID: 4239341309712137294}
|
||||||
|
@ -238,7 +238,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 251893064}
|
m_GameObject: {fileID: 251893064}
|
||||||
m_LocalRotation: {x: 0, y: -0.92387956, z: 0, w: 0.38268343}
|
m_LocalRotation: {x: 0, y: -0.92387956, z: 0, w: 0.38268343}
|
||||||
m_LocalPosition: {x: 14, y: 0, z: 14}
|
m_LocalPosition: {x: 14, y: 0.4, z: 14}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
@ -281,7 +281,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 535739935}
|
m_GameObject: {fileID: 535739935}
|
||||||
m_LocalRotation: {x: 0, y: -0.38268343, z: 0, w: 0.92387956}
|
m_LocalRotation: {x: 0, y: -0.38268343, z: 0, w: 0.92387956}
|
||||||
m_LocalPosition: {x: 14, y: 0, z: -14}
|
m_LocalPosition: {x: 14, y: 0.4, z: -14}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
@ -558,7 +558,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1458789072}
|
m_GameObject: {fileID: 1458789072}
|
||||||
m_LocalRotation: {x: 0, y: 0.92387956, z: 0, w: 0.38268343}
|
m_LocalRotation: {x: 0, y: 0.92387956, z: 0, w: 0.38268343}
|
||||||
m_LocalPosition: {x: -14, y: 0, z: 14}
|
m_LocalPosition: {x: -14, y: 0.4, z: 14}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
@ -601,7 +601,7 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1501912662}
|
m_GameObject: {fileID: 1501912662}
|
||||||
m_LocalRotation: {x: 0, y: 0.38268343, z: 0, w: 0.92387956}
|
m_LocalRotation: {x: 0, y: 0.38268343, z: 0, w: 0.92387956}
|
||||||
m_LocalPosition: {x: -14, y: 0, z: -14}
|
m_LocalPosition: {x: -14, y: 0.4, z: -14}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
|
@ -4,7 +4,7 @@ namespace Mirror.Examples.Common.Controllers
|
|||||||
{
|
{
|
||||||
[AddComponentMenu("")]
|
[AddComponentMenu("")]
|
||||||
[DisallowMultipleComponent]
|
[DisallowMultipleComponent]
|
||||||
public class ContollerUIBase : MonoBehaviour
|
public class ControllerUIBase : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
||||||
// Returns a string representation of a KeyCode that is more suitable
|
// Returns a string representation of a KeyCode that is more suitable
|
@ -6,7 +6,7 @@ namespace Mirror.Examples.Common.Controllers.Flyer
|
|||||||
{
|
{
|
||||||
[AddComponentMenu("")]
|
[AddComponentMenu("")]
|
||||||
[DisallowMultipleComponent]
|
[DisallowMultipleComponent]
|
||||||
public class FlyerControllerUI : ContollerUIBase
|
public class FlyerControllerUI : ControllerUIBase
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public struct MoveTexts
|
public struct MoveTexts
|
||||||
|
@ -6,7 +6,7 @@ namespace Mirror.Examples.Common.Controllers.Player
|
|||||||
{
|
{
|
||||||
[AddComponentMenu("")]
|
[AddComponentMenu("")]
|
||||||
[DisallowMultipleComponent]
|
[DisallowMultipleComponent]
|
||||||
public class PlayerControllerUI : ContollerUIBase
|
public class PlayerControllerUI : ControllerUIBase
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public struct MoveTexts
|
public struct MoveTexts
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Mirror.Examples.Common.Controllers.Player
|
|
||||||
{
|
|
||||||
[AddComponentMenu("Network/Player Controller KRB (Reliable)")]
|
|
||||||
[RequireComponent(typeof(NetworkTransformReliable))]
|
|
||||||
public class PlayerControllerKRBReliable : PlayerControllerKRBBase { }
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Mirror.Examples.Common.Controllers.Player
|
|
||||||
{
|
|
||||||
[AddComponentMenu("Network/Player Controller KRB (Unreliable)")]
|
|
||||||
[RequireComponent(typeof(NetworkTransformUnreliable))]
|
|
||||||
public class PlayerControllerKRBUnreliable : PlayerControllerKRBBase { }
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Serialization;
|
using UnityEngine.Serialization;
|
||||||
|
|
||||||
@ -9,7 +9,7 @@ namespace Mirror.Examples.Common.Controllers.Player
|
|||||||
[RequireComponent(typeof(CapsuleCollider))]
|
[RequireComponent(typeof(CapsuleCollider))]
|
||||||
[RequireComponent(typeof(NetworkIdentity))]
|
[RequireComponent(typeof(NetworkIdentity))]
|
||||||
[DisallowMultipleComponent]
|
[DisallowMultipleComponent]
|
||||||
public class PlayerControllerKRBBase : NetworkBehaviour
|
public class PlayerControllerRBBase : NetworkBehaviour
|
||||||
{
|
{
|
||||||
const float BASE_DPI = 96f;
|
const float BASE_DPI = 96f;
|
||||||
|
|
||||||
@ -236,8 +236,6 @@ void Reset()
|
|||||||
// Freeze rotation on X and Z axes, but allow rotation on Y axis
|
// Freeze rotation on X and Z axes, but allow rotation on Y axis
|
||||||
rigidBody.constraints = RigidbodyConstraints.FreezeRotation;
|
rigidBody.constraints = RigidbodyConstraints.FreezeRotation;
|
||||||
|
|
||||||
GetComponent<Rigidbody>().isKinematic = true;
|
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
// For convenience in the examples, we use the GUID of the PlayerControllerUI
|
// For convenience in the examples, we use the GUID of the PlayerControllerUI
|
||||||
// to find the correct prefab in the Mirror/Examples/_Common/Controllers folder.
|
// to find the correct prefab in the Mirror/Examples/_Common/Controllers folder.
|
||||||
@ -292,7 +290,7 @@ public override void OnStartLocalPlayer()
|
|||||||
|
|
||||||
if (runtimeData.controllerUI != null)
|
if (runtimeData.controllerUI != null)
|
||||||
{
|
{
|
||||||
if (runtimeData.controllerUI.TryGetComponent(out PlayerControllerKRBUI canvasControlPanel))
|
if (runtimeData.controllerUI.TryGetComponent(out PlayerControllerRBUI canvasControlPanel))
|
||||||
canvasControlPanel.Refresh(moveKeys, optionsKeys);
|
canvasControlPanel.Refresh(moveKeys, optionsKeys);
|
||||||
|
|
||||||
runtimeData.controllerUI.SetActive(controlOptions.HasFlag(ControlOptions.ShowUI));
|
runtimeData.controllerUI.SetActive(controlOptions.HasFlag(ControlOptions.ShowUI));
|
||||||
@ -312,6 +310,36 @@ public override void OnStopLocalPlayer()
|
|||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
HandleOptions();
|
HandleOptions();
|
||||||
|
|
||||||
|
float deltaTime = Time.deltaTime;
|
||||||
|
|
||||||
|
if (controlOptions.HasFlag(ControlOptions.MouseSteer))
|
||||||
|
HandleMouseSteer(deltaTime);
|
||||||
|
else
|
||||||
|
HandleTurning(deltaTime);
|
||||||
|
|
||||||
|
HandleJumping(deltaTime);
|
||||||
|
HandleMove(deltaTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FixedUpdate()
|
||||||
|
{
|
||||||
|
float fixedDeltaTime = Time.fixedDeltaTime;
|
||||||
|
ApplyMove(fixedDeltaTime);
|
||||||
|
|
||||||
|
// Update ground state
|
||||||
|
bool isGrounded = Physics.Raycast(transform.position, Vector3.down, capsuleCollider.height / 2 + 0.1f);
|
||||||
|
if (isGrounded)
|
||||||
|
runtimeData.groundState = GroundState.Grounded;
|
||||||
|
else if (runtimeData.groundState != GroundState.Jumping)
|
||||||
|
runtimeData.groundState = GroundState.Falling;
|
||||||
|
|
||||||
|
// Update velocity for diagnostics
|
||||||
|
#if UNITY_6000_0_OR_NEWER
|
||||||
|
runtimeData.velocity = Vector3Int.FloorToInt(rigidBody.linearVelocity);
|
||||||
|
#else
|
||||||
|
runtimeData.velocity = Vector3Int.FloorToInt(rigidBody.velocity);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleOptions()
|
void HandleOptions()
|
||||||
@ -340,32 +368,8 @@ void SetCursor(bool locked)
|
|||||||
Cursor.visible = !locked;
|
Cursor.visible = !locked;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FixedUpdate()
|
|
||||||
{
|
|
||||||
float fixedDeltaTime = Time.fixedDeltaTime;
|
|
||||||
|
|
||||||
if (controlOptions.HasFlag(ControlOptions.MouseSteer))
|
|
||||||
HandleMouseSteer(fixedDeltaTime);
|
|
||||||
else
|
|
||||||
HandleTurning(fixedDeltaTime);
|
|
||||||
|
|
||||||
HandleJumping(fixedDeltaTime);
|
|
||||||
HandleMove(fixedDeltaTime);
|
|
||||||
ApplyMove(fixedDeltaTime);
|
|
||||||
|
|
||||||
// Update ground state
|
|
||||||
bool isGrounded = Physics.Raycast(transform.position, Vector3.down, capsuleCollider.height / 2 + 0.1f);
|
|
||||||
if (isGrounded)
|
|
||||||
runtimeData.groundState = GroundState.Grounded;
|
|
||||||
else if (runtimeData.groundState != GroundState.Jumping)
|
|
||||||
runtimeData.groundState = GroundState.Falling;
|
|
||||||
|
|
||||||
// Update velocity for diagnostics
|
|
||||||
runtimeData.velocity = Vector3Int.FloorToInt(rigidBody.velocity);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Turning works while airborne...feature?
|
// Turning works while airborne...feature?
|
||||||
void HandleTurning(float fixedDeltaTime)
|
void HandleTurning(float deltaTime)
|
||||||
{
|
{
|
||||||
float targetTurnSpeed = 0f;
|
float targetTurnSpeed = 0f;
|
||||||
|
|
||||||
@ -378,13 +382,13 @@ void HandleTurning(float fixedDeltaTime)
|
|||||||
// If there's turn input or AutoRun is not enabled, adjust turn speed towards target
|
// If there's turn input or AutoRun is not enabled, adjust turn speed towards target
|
||||||
// If no turn input and AutoRun is enabled, maintain the previous turn speed
|
// If no turn input and AutoRun is enabled, maintain the previous turn speed
|
||||||
if (targetTurnSpeed != 0f || !controlOptions.HasFlag(ControlOptions.AutoRun))
|
if (targetTurnSpeed != 0f || !controlOptions.HasFlag(ControlOptions.AutoRun))
|
||||||
runtimeData.turnSpeed = Mathf.MoveTowards(runtimeData.turnSpeed, targetTurnSpeed, turnAcceleration * maxTurnSpeed * fixedDeltaTime);
|
runtimeData.turnSpeed = Mathf.MoveTowards(runtimeData.turnSpeed, targetTurnSpeed, turnAcceleration * maxTurnSpeed * deltaTime);
|
||||||
|
|
||||||
//transform.Rotate(0f, runtimeData.turnSpeed * fixedDeltaTime, 0f);
|
//transform.Rotate(0f, runtimeData.turnSpeed * fixedDeltaTime, 0f);
|
||||||
transform.Rotate(transform.up, runtimeData.turnSpeed * fixedDeltaTime, Space.World);
|
transform.Rotate(transform.up, runtimeData.turnSpeed * deltaTime, Space.World);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleMouseSteer(float fixedDeltaTime)
|
void HandleMouseSteer(float deltaTime)
|
||||||
{
|
{
|
||||||
// Accumulate mouse input over time
|
// Accumulate mouse input over time
|
||||||
runtimeData.mouseInputX += Input.GetAxisRaw("Mouse X") * runtimeData.mouseSensitivity;
|
runtimeData.mouseInputX += Input.GetAxisRaw("Mouse X") * runtimeData.mouseSensitivity;
|
||||||
@ -396,16 +400,16 @@ void HandleMouseSteer(float fixedDeltaTime)
|
|||||||
float targetTurnSpeed = runtimeData.mouseInputX * maxTurnSpeed;
|
float targetTurnSpeed = runtimeData.mouseInputX * maxTurnSpeed;
|
||||||
|
|
||||||
// Use the same acceleration logic as HandleTurning
|
// Use the same acceleration logic as HandleTurning
|
||||||
runtimeData.turnSpeed = Mathf.MoveTowards(runtimeData.turnSpeed, targetTurnSpeed, runtimeData.mouseSensitivity * maxTurnSpeed * fixedDeltaTime);
|
runtimeData.turnSpeed = Mathf.MoveTowards(runtimeData.turnSpeed, targetTurnSpeed, runtimeData.mouseSensitivity * maxTurnSpeed * deltaTime);
|
||||||
|
|
||||||
// Apply rotation
|
// Apply rotation
|
||||||
//transform.Rotate(0f, runtimeData.turnSpeed * fixedDeltaTime, 0f);
|
//transform.Rotate(0f, runtimeData.turnSpeed * fixedDeltaTime, 0f);
|
||||||
transform.Rotate(transform.up, runtimeData.turnSpeed * fixedDeltaTime, Space.World);
|
transform.Rotate(transform.up, runtimeData.turnSpeed * deltaTime, Space.World);
|
||||||
|
|
||||||
runtimeData.mouseInputX = Mathf.MoveTowards(runtimeData.mouseInputX, 0f, runtimeData.mouseSensitivity * fixedDeltaTime);
|
runtimeData.mouseInputX = Mathf.MoveTowards(runtimeData.mouseInputX, 0f, runtimeData.mouseSensitivity * deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleJumping(float fixedDeltaTime)
|
void HandleJumping(float deltaTime)
|
||||||
{
|
{
|
||||||
if (runtimeData.groundState != GroundState.Falling && moveKeys.Jump != KeyCode.None && Input.GetKey(moveKeys.Jump))
|
if (runtimeData.groundState != GroundState.Falling && moveKeys.Jump != KeyCode.None && Input.GetKey(moveKeys.Jump))
|
||||||
{
|
{
|
||||||
@ -418,7 +422,7 @@ void HandleJumping(float fixedDeltaTime)
|
|||||||
{
|
{
|
||||||
// Increase jumpSpeed using a square root function for a fast start and slow finish
|
// Increase jumpSpeed using a square root function for a fast start and slow finish
|
||||||
float jumpProgress = (runtimeData.jumpSpeed - initialJumpSpeed) / (maxJumpSpeed - initialJumpSpeed);
|
float jumpProgress = (runtimeData.jumpSpeed - initialJumpSpeed) / (maxJumpSpeed - initialJumpSpeed);
|
||||||
runtimeData.jumpSpeed += (jumpAcceleration * Mathf.Sqrt(1 - jumpProgress)) * fixedDeltaTime;
|
runtimeData.jumpSpeed += (jumpAcceleration * Mathf.Sqrt(1 - jumpProgress)) * deltaTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (runtimeData.jumpSpeed >= maxJumpSpeed)
|
if (runtimeData.jumpSpeed >= maxJumpSpeed)
|
||||||
@ -431,14 +435,14 @@ void HandleJumping(float fixedDeltaTime)
|
|||||||
{
|
{
|
||||||
runtimeData.groundState = GroundState.Falling;
|
runtimeData.groundState = GroundState.Falling;
|
||||||
runtimeData.jumpSpeed = Mathf.Min(runtimeData.jumpSpeed, maxJumpSpeed);
|
runtimeData.jumpSpeed = Mathf.Min(runtimeData.jumpSpeed, maxJumpSpeed);
|
||||||
runtimeData.jumpSpeed += Physics.gravity.y * fixedDeltaTime;
|
runtimeData.jumpSpeed += Physics.gravity.y * deltaTime;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// maintain small downward speed for when falling off ledges
|
// maintain small downward speed for when falling off ledges
|
||||||
runtimeData.jumpSpeed = Physics.gravity.y * fixedDeltaTime;
|
runtimeData.jumpSpeed = Physics.gravity.y * deltaTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleMove(float fixedDeltaTime)
|
void HandleMove(float deltaTime)
|
||||||
{
|
{
|
||||||
// Initialize target movement variables
|
// Initialize target movement variables
|
||||||
float targetMoveX = 0f;
|
float targetMoveX = 0f;
|
||||||
@ -453,18 +457,18 @@ void HandleMove(float fixedDeltaTime)
|
|||||||
if (targetMoveX == 0f)
|
if (targetMoveX == 0f)
|
||||||
{
|
{
|
||||||
if (!controlOptions.HasFlag(ControlOptions.AutoRun))
|
if (!controlOptions.HasFlag(ControlOptions.AutoRun))
|
||||||
runtimeData.horizontal = Mathf.MoveTowards(runtimeData.horizontal, targetMoveX, inputGravity * fixedDeltaTime);
|
runtimeData.horizontal = Mathf.MoveTowards(runtimeData.horizontal, targetMoveX, inputGravity * deltaTime);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
runtimeData.horizontal = Mathf.MoveTowards(runtimeData.horizontal, targetMoveX, inputSensitivity * fixedDeltaTime);
|
runtimeData.horizontal = Mathf.MoveTowards(runtimeData.horizontal, targetMoveX, inputSensitivity * deltaTime);
|
||||||
|
|
||||||
if (targetMoveZ == 0f)
|
if (targetMoveZ == 0f)
|
||||||
{
|
{
|
||||||
if (!controlOptions.HasFlag(ControlOptions.AutoRun))
|
if (!controlOptions.HasFlag(ControlOptions.AutoRun))
|
||||||
runtimeData.vertical = Mathf.MoveTowards(runtimeData.vertical, targetMoveZ, inputGravity * fixedDeltaTime);
|
runtimeData.vertical = Mathf.MoveTowards(runtimeData.vertical, targetMoveZ, inputGravity * deltaTime);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
runtimeData.vertical = Mathf.MoveTowards(runtimeData.vertical, targetMoveZ, inputSensitivity * fixedDeltaTime);
|
runtimeData.vertical = Mathf.MoveTowards(runtimeData.vertical, targetMoveZ, inputSensitivity * deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplyMove(float fixedDeltaTime)
|
void ApplyMove(float fixedDeltaTime)
|
||||||
@ -479,7 +483,11 @@ void ApplyMove(float fixedDeltaTime)
|
|||||||
rigidBody.MovePosition(rigidBody.position + runtimeData.direction * fixedDeltaTime);
|
rigidBody.MovePosition(rigidBody.position + runtimeData.direction * fixedDeltaTime);
|
||||||
|
|
||||||
// Handle vertical movement (jumping and gravity)
|
// Handle vertical movement (jumping and gravity)
|
||||||
|
#if UNITY_6000_0_OR_NEWER
|
||||||
|
Vector3 verticalMovement = rigidBody.linearVelocity;
|
||||||
|
#else
|
||||||
Vector3 verticalMovement = rigidBody.velocity;
|
Vector3 verticalMovement = rigidBody.velocity;
|
||||||
|
#endif
|
||||||
verticalMovement.y = runtimeData.jumpSpeed;
|
verticalMovement.y = runtimeData.jumpSpeed;
|
||||||
|
|
||||||
// Apply gravity
|
// Apply gravity
|
||||||
@ -487,7 +495,11 @@ void ApplyMove(float fixedDeltaTime)
|
|||||||
verticalMovement.y += Physics.gravity.y * fixedDeltaTime;
|
verticalMovement.y += Physics.gravity.y * fixedDeltaTime;
|
||||||
|
|
||||||
// Apply vertical movement
|
// Apply vertical movement
|
||||||
|
#if UNITY_6000_0_OR_NEWER
|
||||||
|
rigidBody.linearVelocity = new Vector3(rigidBody.linearVelocity.x, verticalMovement.y, rigidBody.linearVelocity.z);
|
||||||
|
#else
|
||||||
rigidBody.velocity = new Vector3(rigidBody.velocity.x, verticalMovement.y, rigidBody.velocity.z);
|
rigidBody.velocity = new Vector3(rigidBody.velocity.x, verticalMovement.y, rigidBody.velocity.z);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0d6d426b831ca7c43a7ebc82d324dbb6
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {fileID: 2800000, guid: 7453abfe9e8b2c04a8a47eb536fe21eb, type: 3}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Mirror.Examples.Common.Controllers.Player
|
||||||
|
{
|
||||||
|
[AddComponentMenu("Network/Player Controller RB (Reliable)")]
|
||||||
|
[RequireComponent(typeof(NetworkTransformReliable))]
|
||||||
|
public class PlayerControllerRBReliable : PlayerControllerRBBase { }
|
||||||
|
}
|
@ -5,7 +5,7 @@ MonoImporter:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
defaultReferences: []
|
defaultReferences: []
|
||||||
executionOrder: 0
|
executionOrder: 0
|
||||||
icon: {instanceID: 0}
|
icon: {fileID: 2800000, guid: 7453abfe9e8b2c04a8a47eb536fe21eb, type: 3}
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
assetBundleVariant:
|
assetBundleVariant:
|
@ -6,7 +6,7 @@ namespace Mirror.Examples.Common.Controllers.Player
|
|||||||
{
|
{
|
||||||
[AddComponentMenu("")]
|
[AddComponentMenu("")]
|
||||||
[DisallowMultipleComponent]
|
[DisallowMultipleComponent]
|
||||||
public class PlayerControllerKRBUI : ContollerUIBase
|
public class PlayerControllerRBUI : ControllerUIBase
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public struct MoveTexts
|
public struct MoveTexts
|
||||||
@ -31,7 +31,7 @@ public struct OptionsTexts
|
|||||||
[SerializeField] MoveTexts moveTexts;
|
[SerializeField] MoveTexts moveTexts;
|
||||||
[SerializeField] OptionsTexts optionsTexts;
|
[SerializeField] OptionsTexts optionsTexts;
|
||||||
|
|
||||||
public void Refresh(PlayerControllerKRBBase.MoveKeys moveKeys, PlayerControllerKRBBase.OptionsKeys optionsKeys)
|
public void Refresh(PlayerControllerRBBase.MoveKeys moveKeys, PlayerControllerRBBase.OptionsKeys optionsKeys)
|
||||||
{
|
{
|
||||||
// Movement Keys
|
// Movement Keys
|
||||||
moveTexts.keyTextTurnLeft.text = GetKeyText(moveKeys.TurnLeft);
|
moveTexts.keyTextTurnLeft.text = GetKeyText(moveKeys.TurnLeft);
|
@ -5,7 +5,7 @@ MonoImporter:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
defaultReferences: []
|
defaultReferences: []
|
||||||
executionOrder: 0
|
executionOrder: 0
|
||||||
icon: {instanceID: 0}
|
icon: {fileID: 2800000, guid: 7453abfe9e8b2c04a8a47eb536fe21eb, type: 3}
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
assetBundleVariant:
|
assetBundleVariant:
|
@ -143,7 +143,7 @@ GameObject:
|
|||||||
- component: {fileID: 28027543193692803}
|
- component: {fileID: 28027543193692803}
|
||||||
- component: {fileID: 5839359391402956113}
|
- component: {fileID: 5839359391402956113}
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: PlayerControllerKRBUI
|
m_Name: PlayerControllerRBUI
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
@ -0,0 +1,8 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Mirror.Examples.Common.Controllers.Player
|
||||||
|
{
|
||||||
|
[AddComponentMenu("Network/Player Controller RB (Unreliable)")]
|
||||||
|
[RequireComponent(typeof(NetworkTransformUnreliable))]
|
||||||
|
public class PlayerControllerRBUnreliable : PlayerControllerRBBase { }
|
||||||
|
}
|
@ -5,7 +5,7 @@ MonoImporter:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
defaultReferences: []
|
defaultReferences: []
|
||||||
executionOrder: 0
|
executionOrder: 0
|
||||||
icon: {instanceID: 0}
|
icon: {fileID: 2800000, guid: 7453abfe9e8b2c04a8a47eb536fe21eb, type: 3}
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
assetBundleVariant:
|
assetBundleVariant:
|
@ -6,7 +6,7 @@ namespace Mirror.Examples.Common.Controllers.Tank
|
|||||||
{
|
{
|
||||||
[AddComponentMenu("")]
|
[AddComponentMenu("")]
|
||||||
[DisallowMultipleComponent]
|
[DisallowMultipleComponent]
|
||||||
public class TankControllerUI : ContollerUIBase
|
public class TankControllerUI : ControllerUIBase
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public struct MoveTexts
|
public struct MoveTexts
|
||||||
|
@ -6,7 +6,7 @@ namespace Mirror.Examples.Common.Controllers.Tank
|
|||||||
{
|
{
|
||||||
[AddComponentMenu("")]
|
[AddComponentMenu("")]
|
||||||
[DisallowMultipleComponent]
|
[DisallowMultipleComponent]
|
||||||
public class TurretUI : ContollerUIBase
|
public class TurretUI : ControllerUIBase
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public struct MoveTexts
|
public struct MoveTexts
|
||||||
|
@ -8,7 +8,7 @@ Material:
|
|||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_Name: Robot_Color
|
m_Name: Robot_Color
|
||||||
m_Shader: {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
|
m_Shader: {fileID: 2, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
m_ShaderKeywords:
|
m_ShaderKeywords:
|
||||||
m_LightmapFlags: 1
|
m_LightmapFlags: 1
|
||||||
m_EnableInstancingVariants: 0
|
m_EnableInstancingVariants: 0
|
||||||
@ -24,7 +24,7 @@ Material:
|
|||||||
m_Scale: {x: 1, y: 1}
|
m_Scale: {x: 1, y: 1}
|
||||||
m_Offset: {x: 0, y: 0}
|
m_Offset: {x: 0, y: 0}
|
||||||
- _BumpMap:
|
- _BumpMap:
|
||||||
m_Texture: {fileID: 2800000, guid: a1454d7237641fa49a7f66d6bee624ad, type: 3}
|
m_Texture: {fileID: 2800000, guid: 7bf5087089ac3424a982003c10dda35f, type: 3}
|
||||||
m_Scale: {x: 1, y: 1}
|
m_Scale: {x: 1, y: 1}
|
||||||
m_Offset: {x: 0, y: 0}
|
m_Offset: {x: 0, y: 0}
|
||||||
- _EmissionMap:
|
- _EmissionMap:
|
||||||
@ -32,7 +32,7 @@ Material:
|
|||||||
m_Scale: {x: 1, y: 1}
|
m_Scale: {x: 1, y: 1}
|
||||||
m_Offset: {x: 0, y: 0}
|
m_Offset: {x: 0, y: 0}
|
||||||
- _MainTex:
|
- _MainTex:
|
||||||
m_Texture: {fileID: 2800000, guid: 1fbb41709a1d9334696860db720026e5, type: 3}
|
m_Texture: {fileID: 2800000, guid: fa652271323864a648c14b00ef5c677b, type: 3}
|
||||||
m_Scale: {x: 1, y: 1}
|
m_Scale: {x: 1, y: 1}
|
||||||
m_Offset: {x: 0, y: 0}
|
m_Offset: {x: 0, y: 0}
|
||||||
- _SpecGlossMap:
|
- _SpecGlossMap:
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 482 KiB |
@ -0,0 +1,104 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fa652271323864a648c14b00ef5c677b
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 11
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 1
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 1
|
||||||
|
aniso: 1
|
||||||
|
mipBias: 0
|
||||||
|
wrapU: 0
|
||||||
|
wrapV: 0
|
||||||
|
wrapW: 0
|
||||||
|
nPOTScale: 1
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 0
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 0
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 1024
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 1024
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID:
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Binary file not shown.
Before Width: | Height: | Size: 3.0 MiB |
@ -1,45 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 1fbb41709a1d9334696860db720026e5
|
|
||||||
TextureImporter:
|
|
||||||
serializedVersion: 2
|
|
||||||
mipmaps:
|
|
||||||
mipMapMode: 0
|
|
||||||
enableMipMap: 1
|
|
||||||
linearTexture: 0
|
|
||||||
correctGamma: 0
|
|
||||||
fadeOut: 0
|
|
||||||
borderMipMap: 0
|
|
||||||
mipMapFadeDistanceStart: 1
|
|
||||||
mipMapFadeDistanceEnd: 3
|
|
||||||
bumpmap:
|
|
||||||
convertToNormalMap: 0
|
|
||||||
externalNormalMap: 0
|
|
||||||
heightScale: .25
|
|
||||||
normalMapFilter: 0
|
|
||||||
isReadable: 0
|
|
||||||
grayScaleToAlpha: 0
|
|
||||||
generateCubemap: 0
|
|
||||||
seamlessCubemap: 0
|
|
||||||
textureFormat: -1
|
|
||||||
maxTextureSize: 1024
|
|
||||||
textureSettings:
|
|
||||||
filterMode: -1
|
|
||||||
aniso: -1
|
|
||||||
mipBias: -1
|
|
||||||
wrapMode: -1
|
|
||||||
nPOTScale: 1
|
|
||||||
lightmap: 0
|
|
||||||
compressionQuality: 50
|
|
||||||
spriteMode: 0
|
|
||||||
spriteExtrude: 1
|
|
||||||
spriteMeshType: 1
|
|
||||||
alignment: 0
|
|
||||||
spritePivot: {x: .5, y: .5}
|
|
||||||
spritePixelsToUnits: 100
|
|
||||||
alphaIsTransparency: 0
|
|
||||||
textureType: -1
|
|
||||||
buildTargetSettings: []
|
|
||||||
spriteSheet:
|
|
||||||
sprites: []
|
|
||||||
spritePackingTag:
|
|
||||||
userData:
|
|
Binary file not shown.
After Width: | Height: | Size: 431 KiB |
@ -0,0 +1,104 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7bf5087089ac3424a982003c10dda35f
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 11
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 1
|
||||||
|
sRGBTexture: 0
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 1
|
||||||
|
aniso: 1
|
||||||
|
mipBias: 0
|
||||||
|
wrapU: 0
|
||||||
|
wrapV: 0
|
||||||
|
wrapW: 0
|
||||||
|
nPOTScale: 1
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 0
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 1
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 1024
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 1024
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID:
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Binary file not shown.
Before Width: | Height: | Size: 3.8 MiB |
@ -1,45 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: a1454d7237641fa49a7f66d6bee624ad
|
|
||||||
TextureImporter:
|
|
||||||
serializedVersion: 2
|
|
||||||
mipmaps:
|
|
||||||
mipMapMode: 0
|
|
||||||
enableMipMap: 1
|
|
||||||
linearTexture: 1
|
|
||||||
correctGamma: 0
|
|
||||||
fadeOut: 0
|
|
||||||
borderMipMap: 0
|
|
||||||
mipMapFadeDistanceStart: 1
|
|
||||||
mipMapFadeDistanceEnd: 3
|
|
||||||
bumpmap:
|
|
||||||
convertToNormalMap: 0
|
|
||||||
externalNormalMap: 1
|
|
||||||
heightScale: .25
|
|
||||||
normalMapFilter: 0
|
|
||||||
isReadable: 0
|
|
||||||
grayScaleToAlpha: 0
|
|
||||||
generateCubemap: 0
|
|
||||||
seamlessCubemap: 0
|
|
||||||
textureFormat: -1
|
|
||||||
maxTextureSize: 1024
|
|
||||||
textureSettings:
|
|
||||||
filterMode: -1
|
|
||||||
aniso: -1
|
|
||||||
mipBias: -1
|
|
||||||
wrapMode: -1
|
|
||||||
nPOTScale: 1
|
|
||||||
lightmap: 0
|
|
||||||
compressionQuality: 50
|
|
||||||
spriteMode: 0
|
|
||||||
spriteExtrude: 1
|
|
||||||
spriteMeshType: 1
|
|
||||||
alignment: 0
|
|
||||||
spritePivot: {x: .5, y: .5}
|
|
||||||
spritePixelsToUnits: 100
|
|
||||||
alphaIsTransparency: 0
|
|
||||||
textureType: 1
|
|
||||||
buildTargetSettings: []
|
|
||||||
spriteSheet:
|
|
||||||
sprites: []
|
|
||||||
spritePackingTag:
|
|
||||||
userData:
|
|
52
Assets/Mirror/Examples/_Common/Scripts/PerlinNoise.cs
Normal file
52
Assets/Mirror/Examples/_Common/Scripts/PerlinNoise.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEditor;
|
||||||
|
|
||||||
|
namespace Mirror.Examples.Common.Controllers.Player
|
||||||
|
{
|
||||||
|
[ExecuteInEditMode]
|
||||||
|
[AddComponentMenu("")]
|
||||||
|
public class PerlinNoise : MonoBehaviour
|
||||||
|
{
|
||||||
|
public float scale = 20f;
|
||||||
|
public float heightMultiplier = .03f;
|
||||||
|
public float offsetX = 5f;
|
||||||
|
public float offsetY = 5f;
|
||||||
|
|
||||||
|
[ContextMenu("Generate Terrain")]
|
||||||
|
void GenerateTerrain()
|
||||||
|
{
|
||||||
|
Terrain terrain = GetComponent<Terrain>();
|
||||||
|
if (terrain == null)
|
||||||
|
{
|
||||||
|
Debug.LogError("No Terrain component found on this GameObject.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
Undo.RecordObject(terrain, "Generate Perlin Noise Terrain");
|
||||||
|
#endif
|
||||||
|
terrain.terrainData = GenerateTerrainData(terrain.terrainData);
|
||||||
|
}
|
||||||
|
|
||||||
|
TerrainData GenerateTerrainData(TerrainData terrainData)
|
||||||
|
{
|
||||||
|
int width = terrainData.heightmapResolution;
|
||||||
|
int height = terrainData.heightmapResolution;
|
||||||
|
|
||||||
|
float[,] heights = new float[width, height];
|
||||||
|
|
||||||
|
for (int x = 0; x < width; x++)
|
||||||
|
{
|
||||||
|
for (int y = 0; y < height; y++)
|
||||||
|
{
|
||||||
|
float xCoord = (float)x / width * scale + offsetX;
|
||||||
|
float yCoord = (float)y / height * scale + offsetY;
|
||||||
|
|
||||||
|
heights[x, y] = Mathf.PerlinNoise(xCoord, yCoord) * heightMultiplier;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
terrainData.SetHeights(0, 0, heights);
|
||||||
|
return terrainData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Mirror/Examples/_Common/Scripts/PerlinNoise.cs.meta
Normal file
11
Assets/Mirror/Examples/_Common/Scripts/PerlinNoise.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 86898d6de7df85e4aaaaca9663b06602
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {fileID: 2800000, guid: 7453abfe9e8b2c04a8a47eb536fe21eb, type: 3}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -19,11 +19,6 @@ void Awake()
|
|||||||
mainCam = Camera.main;
|
mainCam = Camera.main;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDisable()
|
|
||||||
{
|
|
||||||
//Debug.Log("PlayerCamera.OnDisable");
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnStartLocalPlayer()
|
public override void OnStartLocalPlayer()
|
||||||
{
|
{
|
||||||
if (mainCam != null)
|
if (mainCam != null)
|
||||||
@ -38,16 +33,46 @@ public override void OnStartLocalPlayer()
|
|||||||
Debug.LogWarning("PlayerCamera: Could not find a camera in scene with 'MainCamera' tag.");
|
Debug.LogWarning("PlayerCamera: Could not find a camera in scene with 'MainCamera' tag.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnApplicationQuit()
|
||||||
|
{
|
||||||
|
//Debug.Log("PlayerCamera.OnApplicationQuit");
|
||||||
|
ReleaseCamera();
|
||||||
|
}
|
||||||
|
|
||||||
public override void OnStopLocalPlayer()
|
public override void OnStopLocalPlayer()
|
||||||
|
{
|
||||||
|
//Debug.Log("PlayerCamera.OnStopLocalPlayer");
|
||||||
|
ReleaseCamera();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnDisable()
|
||||||
|
{
|
||||||
|
//Debug.Log("PlayerCamera.OnDisable");
|
||||||
|
ReleaseCamera();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnDestroy()
|
||||||
|
{
|
||||||
|
//Debug.Log("PlayerCamera.OnDestroy");
|
||||||
|
ReleaseCamera();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ReleaseCamera()
|
||||||
{
|
{
|
||||||
if (mainCam != null && mainCam.transform.parent == transform)
|
if (mainCam != null && mainCam.transform.parent == transform)
|
||||||
{
|
{
|
||||||
|
//Debug.Log("PlayerCamera.ReleaseCamera");
|
||||||
|
|
||||||
mainCam.transform.SetParent(null);
|
mainCam.transform.SetParent(null);
|
||||||
SceneManager.MoveGameObjectToScene(mainCam.gameObject, SceneManager.GetActiveScene());
|
|
||||||
mainCam.orthographic = true;
|
mainCam.orthographic = true;
|
||||||
mainCam.orthographicSize = 15f;
|
mainCam.orthographicSize = 15f;
|
||||||
mainCam.transform.localPosition = new Vector3(0f, 70f, 0f);
|
mainCam.transform.localPosition = new Vector3(0f, 70f, 0f);
|
||||||
mainCam.transform.localEulerAngles = new Vector3(90f, 0f, 0f);
|
mainCam.transform.localEulerAngles = new Vector3(90f, 0f, 0f);
|
||||||
|
|
||||||
|
if (mainCam.gameObject.scene != SceneManager.GetActiveScene())
|
||||||
|
SceneManager.MoveGameObjectToScene(mainCam.gameObject, SceneManager.GetActiveScene());
|
||||||
|
|
||||||
|
mainCam = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1341,7 +1341,15 @@ public void TestNullList()
|
|||||||
Assert.That(readList, Is.Null);
|
Assert.That(readList, Is.Null);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, Ignore("TODO")]
|
// writer.Write<T> for HashSet only works if it's actually used by weaver somewhere.
|
||||||
|
// so for TestHashSet() to pass, we need to pretend using a HashSet<int> somewhere.
|
||||||
|
class HashSetNetworkBehaviour : NetworkBehaviour
|
||||||
|
{
|
||||||
|
[Command]
|
||||||
|
public void CmdHashSet(HashSet<int> hashSet) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test] // requires HashSetNetworkBehaviour to exits!
|
||||||
public void TestHashSet()
|
public void TestHashSet()
|
||||||
{
|
{
|
||||||
HashSet<int> original = new HashSet<int>() { 1, 2, 3, 4, 5 };
|
HashSet<int> original = new HashSet<int>() { 1, 2, 3, 4, 5 };
|
||||||
@ -1353,7 +1361,7 @@ public void TestHashSet()
|
|||||||
Assert.That(readHashSet, Is.EqualTo(original));
|
Assert.That(readHashSet, Is.EqualTo(original));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, Ignore("TODO")]
|
[Test] // requires HashSetNetworkBehaviour to exits!
|
||||||
public void TestNullHashSet()
|
public void TestNullHashSet()
|
||||||
{
|
{
|
||||||
NetworkWriter writer = new NetworkWriter();
|
NetworkWriter writer = new NetworkWriter();
|
||||||
|
35
Assets/Mirror/Tests/Editor/Tools/HalfTests.cs
Normal file
35
Assets/Mirror/Tests/Editor/Tools/HalfTests.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// we are using the dotnet/runtime implementation which is already tested.
|
||||||
|
// basic test to ensure it generally works as expected.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace Mirror.Tests.Tools
|
||||||
|
{
|
||||||
|
public class HalfTests
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void BasicTest()
|
||||||
|
{
|
||||||
|
// start from a float
|
||||||
|
Half half = (Half)42.0f;
|
||||||
|
Half other = (Half)0.5f;
|
||||||
|
|
||||||
|
// add
|
||||||
|
Half value = half + other;
|
||||||
|
Assert.That((float)value, Is.EqualTo(42.5f));
|
||||||
|
|
||||||
|
// sub
|
||||||
|
value = half - other;
|
||||||
|
Assert.That((float)value, Is.EqualTo(41.5f));
|
||||||
|
|
||||||
|
// compare
|
||||||
|
Assert.That(half < other, Is.False);
|
||||||
|
Assert.That(half > other, Is.True);
|
||||||
|
Assert.That(half == other, Is.False);
|
||||||
|
Assert.That(half != other, Is.True);
|
||||||
|
Assert.That(half, Is.EqualTo((Half)42.0f));
|
||||||
|
Assert.That(half == (Half)42.0f, Is.True);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Assets/Mirror/Tests/Editor/Tools/HalfTests.cs.meta
Normal file
3
Assets/Mirror/Tests/Editor/Tools/HalfTests.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d3c60776399c4bfcb5714b29a1ab7b9f
|
||||||
|
timeCreated: 1729787685
|
@ -323,7 +323,7 @@ public void SetServerLobbyParams(LobbyCreateRequest request)
|
|||||||
_request = request;
|
_request = request;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDestroy()
|
public override void OnDestroy()
|
||||||
{
|
{
|
||||||
// attempt to clean up lobbies, if active
|
// attempt to clean up lobbies, if active
|
||||||
if (NetworkServer.active)
|
if (NetworkServer.active)
|
||||||
@ -340,6 +340,8 @@ private void OnDestroy()
|
|||||||
// sorry. this can go once the lobby service can timeout lobbies itself
|
// sorry. this can go once the lobby service can timeout lobbies itself
|
||||||
Thread.Sleep(300);
|
Thread.Sleep(300);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
base.OnDestroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ protected virtual void Awake()
|
|||||||
() => OnClientConnected.Invoke(),
|
() => OnClientConnected.Invoke(),
|
||||||
(message, channel) => OnClientDataReceived.Invoke(message, FromKcpChannel(channel)),
|
(message, channel) => OnClientDataReceived.Invoke(message, FromKcpChannel(channel)),
|
||||||
() => OnClientDisconnected?.Invoke(), // may be null in StopHost(): https://github.com/MirrorNetworking/Mirror/issues/3708
|
() => OnClientDisconnected?.Invoke(), // may be null in StopHost(): https://github.com/MirrorNetworking/Mirror/issues/3708
|
||||||
(error, reason) => OnClientError.Invoke(ToTransportError(error), reason),
|
(error, reason) => OnClientError?.Invoke(ToTransportError(error), reason), // may be null during shutdown: https://github.com/MirrorNetworking/Mirror/issues/3876
|
||||||
config
|
config
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -197,11 +197,10 @@ void EnsureThread()
|
|||||||
Debug.Log($"ThreadedTransport: started worker thread!");
|
Debug.Log($"ThreadedTransport: started worker thread!");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnDestroy()
|
public override void OnDestroy()
|
||||||
{
|
{
|
||||||
// stop thread fully
|
// stop thread fully
|
||||||
Shutdown();
|
base.OnDestroy();
|
||||||
|
|
||||||
// TODO recycle writers.
|
// TODO recycle writers.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,14 +68,6 @@ public class #SCRIPTNAME# : NetworkManager
|
|||||||
base.ConfigureHeadlessFrameRate();
|
base.ConfigureHeadlessFrameRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// called when quitting the application by closing the window / pressing stop in the editor
|
|
||||||
/// </summary>
|
|
||||||
public override void OnApplicationQuit()
|
|
||||||
{
|
|
||||||
base.OnApplicationQuit();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Scene Management
|
#region Scene Management
|
||||||
|
@ -15,8 +15,6 @@ public class #SCRIPTNAME# : NetworkManager
|
|||||||
public event Action OnStartAction;
|
public event Action OnStartAction;
|
||||||
public event Action OnDestroyAction;
|
public event Action OnDestroyAction;
|
||||||
|
|
||||||
public event Action OnApplicationQuitAction;
|
|
||||||
|
|
||||||
public event Action<string> ServerChangeSceneAction;
|
public event Action<string> ServerChangeSceneAction;
|
||||||
public event Action<string> OnServerChangeSceneAction;
|
public event Action<string> OnServerChangeSceneAction;
|
||||||
public event Action<string> OnServerSceneChangedAction;
|
public event Action<string> OnServerSceneChangedAction;
|
||||||
@ -117,15 +115,6 @@ public class #SCRIPTNAME# : NetworkManager
|
|||||||
base.ConfigureHeadlessFrameRate();
|
base.ConfigureHeadlessFrameRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// called when quitting the application by closing the window / pressing stop in the editor
|
|
||||||
/// </summary>
|
|
||||||
public override void OnApplicationQuit()
|
|
||||||
{
|
|
||||||
OnApplicationQuitAction?.Invoke();
|
|
||||||
base.OnApplicationQuit();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Scene Management
|
#region Scene Management
|
||||||
|
@ -18,6 +18,10 @@ using Mirror;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class #SCRIPTNAME# : NetworkRoomManager
|
public class #SCRIPTNAME# : NetworkRoomManager
|
||||||
{
|
{
|
||||||
|
// Overrides the base singleton so we don't
|
||||||
|
// have to cast to this type everywhere.
|
||||||
|
public static new #SCRIPTNAME# singleton => (#SCRIPTNAME#)NetworkRoomManager.singleton;
|
||||||
|
|
||||||
#region Server Callbacks
|
#region Server Callbacks
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user