Compare commits

...

74 Commits

Author SHA1 Message Date
MrGadget
bc43fe9272
Merge 376a733386 into 04bb95311b 2024-11-04 23:54:58 +01:00
MrGadget
04bb95311b fix(PlayerTest): Added PlayerName labels to prefabs
Some checks failed
Main / Run Unity Tests (push) Has been cancelled
Main / Semantic Release (push) Has been cancelled
Main / Delete Old Workflow Runs (push) Has been cancelled
2024-11-02 18:30:10 -04:00
MrGadget
e9a8e02a40 fix(PlayerCamera): Improved cleanup
- avoids error in editor
2024-11-02 18:29:05 -04:00
MrGadget
bb97db4eaa chore(CI): RunUnityTests - updated unityVersion 2024-11-01 15:05:14 -04:00
MrGadget
e7b3aa77df fix(Extentions): GetLocalPositionAndRotation and SetLocalPositionAndRotation 2024-10-29 17:43:44 -04:00
MrGadget
f61524863e fix: Cleanup after PR #3935 2024-10-29 10:46:43 -04:00
mischa
af133e6110
fix: #2802 NetworkManager uses OnDestroy for shutdown instead of OnApplicationQuit (#3935)
* fix: #2802 NetworkManager uses OnDestroy for shutdown instead of OnApplicationQuit

* imer feedback

---------

Co-authored-by: mischa <info@noobtuts.com>
2024-10-29 15:06:44 +01:00
mischa
a9d280cd4b fix: #3785 NetworkIdentity.OnDestroy verifies spawned[netId] before removing 2024-10-29 10:54:30 +01:00
mischa
c4f803fcf6 fix: #3301 Read/Write HashSet<T> support is now detected by Weaver 2024-10-29 09:47:33 +01:00
mischa
03357f4275 fix: #3876 KcpTransport OnClientError null handling during shutdown 2024-10-29 08:54:19 +01:00
mischa
c80a3c8ea5
fix: #3262 allow running a mirror project from edit prefab mode again (#3924)
Co-authored-by: mischa <info@noobtuts.com>
2024-10-28 23:13:23 +01:00
mischa
68c7d14a16 Benchmark: monsters move with 10% probability to make sure we can detect change detection in NT 2024-10-28 11:16:58 +01:00
JesusLuvsYooh
df7a343d7e
fix: Robot Kyle Optimized (#3934)
4mb png normal map down to 0.4mb jpg
overall RobotKyle folder down from ~7mb to 1.5mb
2024-10-27 09:00:39 -04:00
MrGadget
d347600468 chore(CI): RunUnityTests - updated unityVersion 2024-10-25 10:37:55 -04:00
MrGadget
2983c45f1f Updated NetworkRoomManager Script Template
- Added static singleton
2024-10-25 06:24:39 -04:00
mischa
9a2bf46774
feat: Half Floats (#3932)
* System.Half

* reader/writer

* remove unused namespaces

* old c# support

* remove unnecessary nint

* 2019 fixes

---------

Co-authored-by: mischa <info@noobtuts.com>
2024-10-25 10:15:37 +02:00
MrGadget
549b222ec0 Updated SyncDictinoary doc 2024-10-24 19:14:03 -04:00
MrGadget
4e07f3a348 fix(Examples): Updated Spawn Points 2024-10-24 03:19:42 -04:00
MrGadget
19296d5d21 fix(PlayerControllerRBBase): Unity 6 compatibility 2024-10-24 02:28:54 -04:00
MrGadget
01b9260768 fix(Examples): Typo in ControllerUIBase name 2024-10-24 02:03:14 -04:00
MrGadget
74a430f647 chore(CI): RunUnityTests - updated unityVersion 2024-10-23 18:05:27 -04:00
MrGadget
de2ed26eee fix(PerlineNoise): fixed error for Undo 2024-10-23 17:51:07 -04:00
MrGadget
b39d7bd8d2 fix: Renamed PlayerControllerKRB to PlayerControllerRB 2024-10-23 17:15:30 -04:00
MrGadget
06f3bca80b Perlin Noise script 2024-10-23 17:14:36 -04:00
MrGadget
d55faa864c PlayerTest: Perlin terrain 2024-10-23 17:14:09 -04:00
MrGadget
5fbd83279e fix: PlayerKRB inputs in Update 2024-10-23 16:23:06 -04:00
MrGadget
fbab75dfc8 feat(Examples): Added PlayerControllerKRB
- Uses Kinematic Rigidbody instead of Character Controller
- Prefabs added to PlayerTest example
2024-10-23 15:35:06 -04:00
MrGadget
9ffa5523ca PlayerTest: Moved spawn points 2024-10-23 15:32:24 -04:00
mischa
f74d072165 Benchmark/Tanks example: name players for easier debugging 2024-10-18 14:18:42 +02:00
MrGadget
fdc9369de4 chore(CI): RunUnityTests - updated unityVersion 2024-10-17 11:41:59 -04:00
MrGadget
dd2a1dae23 chore(CI): RunUnityTests - updated unityVersion 2024-10-16 12:39:34 -04:00
mischa
835daa30eb funding.json v2 2024-10-16 15:39:37 +02:00
mischa
fbe5351e5c funding.json 2024-10-16 15:36:42 +02:00
mischa
fe9bbcb6ac fix: #2536 NetworkServer won't accept connections while listen=false 2024-10-16 12:37:24 +02:00
mischa
7ab1b394be breaking: NetworkServer.dontListen renamed to 'listen' to avoid double negative "dontListen=false" to listen 2024-10-16 12:37:24 +02:00
mischa
13db82b347 formatting 2024-10-15 12:46:43 +02:00
mischa
ef5fc77728 NetworkServer.IsConnectionAllowed: log address too 2024-10-15 12:45:27 +02:00
MrGadget
86302503da Code Cleanup: SyncSet
Consistent order of things
2024-10-15 06:02:50 -04:00
MrGadget
c23914ca2b Code Cleanup: SyncList, SyncSet, SyncDictionary
Consistent order of things in all three
2024-10-15 05:34:18 -04:00
MrGadget
cd81e9dcdb SyncList: fixed comment typo 2024-10-15 05:26:00 -04:00
mischa
a3027b29ed
Update README.md 2024-10-14 18:25:42 +02:00
mischa
f306135333
Update README.md 2024-10-14 18:25:08 +02:00
mischa
b1b9474dad
Update README.md 2024-10-14 18:24:36 +02:00
mischa
413694af3c
feat(netgraph): universal NetworkGraph with bandwidth + ping in one (#3922)
* feature(netgraph): universal NetworkGraph with bandwidth + ping in one

* unity 2019 prefab

---------

Co-authored-by: mischa <info@noobtuts.com>
Co-authored-by: Robin Rolf <imer@imer.cc>
2024-10-14 18:20:18 +02:00
mischa
1fffa5bb6d netgraph: NetworkGraph renamed to Bandwidth graph because it only shows bandwidth 2024-10-14 13:56:47 +02:00
mischa
b98b9d56b5 netgraph: NetworkGraph adjusted to fit Y labels better 2024-10-14 13:56:44 +02:00
mischa
2bf70f3bc9 both for now 2024-10-14 12:42:31 +02:00
mischa
b57984ab59 SyncList: keep old OnChange parameters to not break projects 2024-10-14 12:42:31 +02:00
JesusLuvsYooh
501d8d52ed
fix: Updated NetworkTransform presets. (#3921)
* Updated NT presets.

Updated presets, removed old presets.

* Spaces
2024-10-14 06:03:57 -04:00
MrGadget
c6be7aaaae fix(BouncyCastle): Move BouncyCastle to Encryption Transport Plugins folder
This keeps it together, so if the transport is removed by users BouncyCastle is removed too without users having to know to find that separately and remove it.
2024-10-14 10:12:44 +02:00
Kyle Avalani
97ce2a8abf
chore(Transport): Comment typo (#3919) 2024-10-14 02:30:43 -04:00
MrGadget
2b2e4131a5 fix(Reward): Simplified and better comments 2024-10-14 02:27:40 -04:00
MrGadget
1f9faf2044 RandomColor: comments 2024-10-14 02:26:18 -04:00
MrGadget
31ac5ad5de chore(CI): RunUnityTests - updated unityVersions 2024-10-13 11:08:22 -04:00
mischa
d336893a63 fix: KcpServerConnection "invalid channel header" now logs address 2024-10-12 22:36:26 +02:00
mischa
8f5bf7b775 feature(EncryptionTransport): log hardware acceleration status 2024-10-12 22:36:26 +02:00
Michael W.
4dd3f1e71d fix(EncryptionTransport): implement PortTransport 2024-10-11 15:21:02 +02:00
MrGadget
ed53e0a5a9 fix(Custom Robot Kyle): Normalized RightHand rotation 2024-10-11 09:10:09 -04:00
MrGadget
9a7cabc4a0 fix: PickupsDropsChilds scene smaller ground plane 2024-10-11 07:03:17 -04:00
MrGadget
13bc00cfde fix: Updated PickupsDropsChilds example
- Renamed prefabs
- adjusted offsets to object prefabs
- fixed orientation of RightHand on Custom Robot Kyle
- Added spawn points to scene
- Improved and simplified code
2024-10-11 06:59:13 -04:00
MrGadget
cc9cc4280b PickupsDropsChilds: SceneObjectPrefab rigidbody settings 2024-10-10 12:48:40 -04:00
MrGadget
d32b81cfb0 PickupsDropsChilds: Semitransparent materials 2024-10-10 12:30:40 -04:00
mischa
c1f71dffe9 Edgegap plugin updated to latest 2024-10-10 17:23:01 +02:00
MrGadget
8d37cc3174 fix(Examples): Moved dirt and wall textures & materials to _Common 2024-10-10 03:57:07 -04:00
MrGadget
90fd0a01a0 fix(PickupsDropsChilds Example): Improved prefabs and scene 2024-10-10 03:54:20 -04:00
MrGadget
7c80a80c55 fix(Profiling): Prefabs -> 2019 2024-10-10 03:53:06 -04:00
MrGadget
376a733386 Revert change to CalculateAngularVelocity
Quaternion doesn't have `normalize`
2024-04-15 12:24:49 -04:00
MrGadget
25b6366cc0 Merged master 2024-04-15 12:19:09 -04:00
MrGadget
c4d138aaa0
Update Assets/Mirror/Components/NetworkTransform/NetworkTransformBase.cs
Co-authored-by: mischa <16416509+miwarnec@users.noreply.github.com>
2024-04-15 11:19:40 -04:00
MrGadget
e93e2eae4d Better CalculateAngularVelocity 2024-04-10 12:54:57 -04:00
MrGadget
80f2d1e641 Use GetPositionAndRotation 2024-04-10 11:03:50 -04:00
MrGadget
f8a4e1150f Ensure target is not null 2024-04-10 08:47:03 -04:00
MrGadget
12ffdae3eb virtuals and overrides 2024-04-10 08:33:19 -04:00
MrGadget
bab41931ee feat(NetworkTransformBase): Add Velocity and AngularVelocity 2024-04-10 08:28:33 -04:00
159 changed files with 10507 additions and 870 deletions

View File

@ -13,10 +13,10 @@ jobs:
unityVersion:
# - 2019.4.40f1
- 2020.3.48f1
- 2021.3.42f1
- 2022.3.42f1
- 2021.3.45f1
- 2022.3.51f1
- 2023.2.20f1
- 6000.0.22f1
- 6000.0.25f1
steps:
- name: Checkout repository

View File

@ -156,6 +156,54 @@ protected virtual void Awake()
Configure();
}
// These are in global coordinates for calculating velocity and angular velocity.
Vector3 lastPosition;
Quaternion lastRotation;
public Vector3 velocity { get; internal set; } = Vector3.zero;
public Vector3 angularVelocity { get; internal set; } = Vector3.zero;
protected virtual void Start()
{
// set target to self if none yet
if (target == null) target = transform;
// Set last position and rotation to current values
// so we can calculate velocity and angular velocity.
target.GetPositionAndRotation(out lastPosition, out lastRotation);
}
protected virtual void Update()
{
// set target to self if none yet
if (target == null) target = transform;
// Use global coordinates for velocity and angular velocity.
target.GetPositionAndRotation(out Vector3 pos, out Quaternion rot);
// Update velocity and angular velocity
velocity = (pos - lastPosition) / Time.deltaTime;
CalculateAngularVelocity(rot);
// Update last position and rotation
lastPosition = pos;
lastRotation = rot;
}
void CalculateAngularVelocity(Quaternion currentRot)
{
// calculate angle between two rotations
Quaternion deltaRotation = currentRot * Quaternion.Inverse(lastRotation);
//Quaternion deltaRotation = (currentRot * Quaternion.Inverse(lastRotation)).normalize;
// convert to angle axis
deltaRotation.ToAngleAxis(out float angle, out Vector3 axis);
// we assume the angle is always the shortest path
// we don't need to check for 360 degree rotations
angularVelocity = axis * angle * Mathf.Deg2Rad / Time.deltaTime;
}
// snapshot functions //////////////////////////////////////////////////
// get local/world position
protected virtual Vector3 GetPosition() =>
@ -414,6 +462,16 @@ public virtual void ResetState()
// so let's clear the buffers.
serverSnapshots.Clear();
clientSnapshots.Clear();
// set target to self if none yet
if (target == null) target = transform;
// Reset last position and rotation
target.GetPositionAndRotation(out lastPosition, out lastRotation);
// Reset velocity / angular velocity
velocity = Vector3.zero;
angularVelocity = Vector3.zero;
}
public virtual void Reset()

View File

@ -43,13 +43,15 @@ public class NetworkTransformReliable : NetworkTransformBase
protected TransformSnapshot last;
// update //////////////////////////////////////////////////////////////
void Update()
protected override void Update()
{
// if server then always sync to others.
if (isServer) UpdateServer();
// 'else if' because host mode shouldn't send anything to server.
// it is the server. don't overwrite anything there.
else if (isClient) UpdateClient();
base.Update();
}
void LateUpdate()

View File

@ -27,13 +27,15 @@ public class NetworkTransformUnreliable : NetworkTransformBase
// update //////////////////////////////////////////////////////////////
// Update applies interpolation
void Update()
protected override void Update()
{
if (isServer) UpdateServerInterpolation();
// for all other clients (and for local player if !authority),
// we need to apply snapshots from the buffer.
// 'else if' because host mode shouldn't interpolate client
else if (isClient && !IsClientWithAuthority) UpdateClientInterpolation();
base.Update();
}
// LateUpdate broadcasts.

View File

@ -2,7 +2,7 @@
using UnityEngine;
namespace Mirror
{
public class NetworkUsageGraph : BaseUIGraph
public class NetworkBandwidthGraph : BaseUIGraph
{
int dataIn;
int dataOut;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3c7a97355c25a2b4da731b53876f8a8b
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -26,7 +26,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 343546206307382570}
- {fileID: 343546206776216637}
@ -68,7 +67,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 343546206877774020}
m_RootOrder: 1
@ -101,7 +99,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -148,7 +145,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 343546206506823101}
m_RootOrder: 1
@ -181,7 +177,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -228,7 +223,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 343546205806955365}
m_RootOrder: 1
@ -261,7 +255,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -307,7 +300,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 343546205253700114}
- {fileID: 343546206801970585}
@ -355,7 +347,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 343546205212282745}
m_RootOrder: 0
@ -388,7 +379,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -430,7 +420,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 343546205496339525}
- {fileID: 343546206359818246}
@ -478,7 +467,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 343546205508279401}
m_RootOrder: 1
@ -511,7 +499,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -558,7 +545,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 343546205281663118}
m_RootOrder: 0
@ -591,7 +577,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -634,7 +619,6 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 343546206877774020}
m_RootOrder: 0
@ -667,7 +651,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.40392157}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -708,7 +691,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 343546206740227476}
- {fileID: 343546205394542243}
@ -748,7 +730,6 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 343546205634725308}
m_RootOrder: 0
@ -781,7 +762,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.40392157}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -822,7 +802,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 343546205523578646}
- {fileID: 343546206440079829}
@ -860,7 +839,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 343546206488145202}
- {fileID: 343546206326199842}
@ -898,7 +876,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 343546206737158417}
- {fileID: 343546205136049348}
@ -938,7 +915,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 343546206339761112}
m_RootOrder: 0
@ -971,7 +947,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 0.22745098}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -1013,7 +988,6 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 343546205212282745}
- {fileID: 343546205281663118}
@ -1051,7 +1025,6 @@ MonoBehaviour:
m_ChildControlHeight: 1
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!1 &343546206307382571
GameObject:
m_ObjectHideFlags: 0
@ -1080,7 +1053,6 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1738718049027005141}
m_RootOrder: 0
@ -1113,7 +1085,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -1156,7 +1127,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 343546205685920603}
m_RootOrder: 1
@ -1189,7 +1159,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -1235,7 +1204,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 343546205859589118}
- {fileID: 1738718049027005141}
@ -1303,7 +1271,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 343546205281663118}
m_RootOrder: 1
@ -1336,7 +1303,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -1383,7 +1349,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 343546205634725308}
m_RootOrder: 1
@ -1416,7 +1381,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -1463,7 +1427,6 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 343546205685920603}
m_RootOrder: 0
@ -1496,7 +1459,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.40392157}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -1538,7 +1500,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 343546206516923994}
- {fileID: 343546204890306330}
@ -1586,7 +1547,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 343546206506823101}
m_RootOrder: 0
@ -1619,7 +1579,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 1, b: 0, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -1662,7 +1621,6 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1738718049027005141}
m_RootOrder: 3
@ -1695,7 +1653,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -1742,7 +1699,6 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 343546205806955365}
m_RootOrder: 0
@ -1775,7 +1731,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.40392157}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -1818,7 +1773,6 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 343546205508279401}
m_RootOrder: 0
@ -1851,7 +1805,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.40392157}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -1892,7 +1845,6 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 343546205508279401}
- {fileID: 343546206877774020}
@ -1935,7 +1887,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 343546205212282745}
m_RootOrder: 1
@ -1968,7 +1919,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -2013,7 +1963,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 343546205500504724}
- {fileID: 343546204850636257}

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 3c7a97355c25a2b4da731b53876f8a8b
guid: a4ee3092d7c7f4a38a70b11014175ebd
PrefabImporter:
externalObjects: {}
userData:

View File

@ -28,7 +28,6 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 4620809971601425299}
m_RootOrder: 0
@ -61,7 +60,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.40392157}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -104,7 +102,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7987015295734336241}
m_RootOrder: 1
@ -137,7 +134,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -183,7 +179,6 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 6899184289734897349}
- {fileID: 942441613928011978}
@ -220,7 +215,6 @@ MonoBehaviour:
m_ChildControlHeight: 1
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!1 &1093758345687749999
GameObject:
m_ObjectHideFlags: 0
@ -247,7 +241,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 911697406546784338}
- {fileID: 2454008239292490697}
@ -285,7 +278,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1768608949435380201}
- {fileID: 1469817193488350550}
@ -327,7 +319,6 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7590176880698012387}
m_RootOrder: 0
@ -360,7 +351,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.40392157}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -401,7 +391,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 7889663160516621925}
- {fileID: 3705598884744263366}
@ -441,7 +430,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 942441613928011978}
m_RootOrder: 0
@ -474,7 +462,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0.9215687, b: 0.015686275, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -517,7 +504,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7590176880698012387}
m_RootOrder: 1
@ -550,7 +536,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -596,7 +581,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 908890067499602259}
- {fileID: 8083971487120669529}
@ -643,7 +627,6 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1056662130267328870}
- {fileID: 5294687292649652416}
@ -710,7 +693,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2684192023408130911}
m_RootOrder: 1
@ -743,7 +725,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -789,7 +770,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2203074428927526136}
- {fileID: 5372474103490645384}
@ -837,7 +817,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6982534731248530243}
m_RootOrder: 0
@ -870,7 +849,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 0.22745098}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -911,7 +889,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 5569695547238921462}
- {fileID: 4579137679805290761}
@ -949,7 +926,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2990412341526050050}
- {fileID: 4652558859609211497}
@ -987,7 +963,6 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2684192023408130911}
- {fileID: 7987015295734336241}
@ -1030,7 +1005,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 942441613928011978}
m_RootOrder: 1
@ -1063,7 +1037,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -1110,7 +1083,6 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7870100887797750244}
m_RootOrder: 0
@ -1143,7 +1115,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.40392157}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -1186,7 +1157,6 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7987015295734336241}
m_RootOrder: 0
@ -1219,7 +1189,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.40392157}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -1262,7 +1231,6 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5294687292649652416}
m_RootOrder: 0
@ -1295,7 +1263,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -1338,7 +1305,6 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2684192023408130911}
m_RootOrder: 0
@ -1371,7 +1337,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.40392157}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -1412,7 +1377,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 6658247662285819325}
- {fileID: 1217973610716945855}
@ -1452,7 +1416,6 @@ RectTransform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5294687292649652416}
m_RootOrder: 3
@ -1485,7 +1448,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -1532,7 +1494,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 4620809971601425299}
m_RootOrder: 1
@ -1565,7 +1526,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -1612,7 +1572,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7870100887797750244}
m_RootOrder: 1
@ -1645,7 +1604,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -1692,7 +1650,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6899184289734897349}
m_RootOrder: 1
@ -1725,7 +1682,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -1772,7 +1728,6 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6899184289734897349}
m_RootOrder: 0
@ -1805,7 +1760,6 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:

View File

@ -671,7 +671,24 @@ void OnDestroy()
// if an identity is still in .spawned, remove it too.
// 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

View File

@ -634,31 +634,6 @@ public void StopClient()
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>
// useful for dedicated servers.
// useful for headless benchmark clients.
@ -772,12 +747,41 @@ public static void ResetStatics()
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()
{
//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>
// set by NetworkManager when changing the scene.
// new clients will automatically load this scene.

View File

@ -55,7 +55,7 @@ void StartButtons()
// cant be a server in webgl build
if (GUILayout.Button("Single Player"))
{
NetworkServer.dontListen = true;
NetworkServer.listen = false;
manager.StartHost();
}
#else

View File

@ -62,6 +62,8 @@ public static class NetworkReaderExtensions
public static decimal ReadDecimal(this NetworkReader reader) => reader.ReadBlittable<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>
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
// fully serialize for NetworkMessages etc.
// 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)
{
// 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;
}
*/
public static T[] ReadArray<T>(this NetworkReader reader)
{

View File

@ -70,9 +70,16 @@ public static partial class NetworkServer
public static readonly Dictionary<uint, NetworkIdentity> spawned =
new Dictionary<uint, NetworkIdentity>();
/// <summary>Single player mode can use dontListen to not accept incoming connections</summary>
// see also: https://github.com/vis2k/Mirror/pull/2595
public static bool dontListen;
/// <summary>Single player mode can set listen=false to not accept incoming connections.</summary>
public static bool listen;
// DEPRECATED 2024-10-14
[Obsolete("NetworkServer.dontListen was replaced with NetworkServer.listen. The new value is the opposite, and avoids double negatives like 'dontListen=false'")]
public static bool dontListen
{
get => !listen;
set => listen = !value;
}
/// <summary>active checks if the server has been started either has standalone or as host server.</summary>
public static bool active { get; internal set; }
@ -137,7 +144,7 @@ public static void Listen(int maxConns)
maxConnections = maxConns;
// only start server if we want to listen
if (!dontListen)
if (listen)
{
Transport.active.ServerStart();
@ -241,7 +248,7 @@ public static void Shutdown()
}
// Reset all statics here....
dontListen = false;
listen = true;
isLoadingScene = false;
lastSendTime = 0;
actualTickRate = 0;
@ -658,7 +665,7 @@ static void OnTransportConnected(int connectionId)
static void OnTransportConnectedWithAddress(int connectionId, string clientAddress)
{
if (IsConnectionAllowed(connectionId))
if (IsConnectionAllowed(connectionId, clientAddress))
{
// create a connection
NetworkConnectionToClient conn = new NetworkConnectionToClient(connectionId, clientAddress);
@ -671,21 +678,28 @@ static void OnTransportConnectedWithAddress(int connectionId, string clientAddre
}
}
static bool IsConnectionAllowed(int connectionId)
static bool IsConnectionAllowed(int connectionId, string address)
{
// only accept connections while listening
if (!listen)
{
Debug.Log($"Server not listening, rejecting connectionId={connectionId} with address={address}");
return false;
}
// connectionId needs to be != 0 because 0 is reserved for local player
// note that some transports like kcp generate connectionId by
// hashing which can be < 0 as well, so we need to allow < 0!
if (connectionId == 0)
{
Debug.LogError($"Server.HandleConnect: invalid connectionId: {connectionId} . Needs to be != 0, because 0 is reserved for local player.");
Debug.LogError($"Server.HandleConnect: invalid connectionId={connectionId}. Needs to be != 0, because 0 is reserved for local player.");
return false;
}
// connectionId not in use yet?
if (connections.ContainsKey(connectionId))
{
Debug.LogError($"Server connectionId {connectionId} already in use...client will be kicked");
Debug.LogError($"Server connectionId={connectionId} already in use. Client with address={address} will be kicked");
return false;
}
@ -696,7 +710,7 @@ static bool IsConnectionAllowed(int connectionId)
// Transport can't do that)
if (connections.Count >= maxConnections)
{
Debug.LogError($"Server full, client {connectionId} will be kicked");
Debug.LogError($"Server full, client connectionId={connectionId} with address={address} will be kicked");
return false;
}

View File

@ -57,6 +57,8 @@ public static class NetworkWriterExtensions
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 WriteHalf(this NetworkWriter writer, Half value) => writer.WriteUShort(value._value);
public static void WriteString(this NetworkWriter writer, string value)
{
// 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
// fully serialize for NetworkMessages etc.
// 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)
// {
// // 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
// // (ushort vs. short / varuint vs. varint) etc.
// if (hashSet is null)
// {
// // most sizes are small, write size as VarUInt!
// Compression.CompressVarUInt(writer, 0u);
// //writer.WriteUInt(0);
// return;
// }
//
// // most sizes are small, write size as VarUInt!
// Compression.CompressVarUInt(writer, checked((uint)hashSet.Count) + 1u);
// //writer.WriteUInt(checked((uint)hashSet.Count) + 1u);
// foreach (T item in hashSet)
// writer.Write(item);
// }
// */
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
// (ushort vs. short / varuint vs. varint) etc.
if (hashSet is null)
{
// most sizes are small, write size as VarUInt!
Compression.CompressVarUInt(writer, 0u);
//writer.WriteUInt(0);
return;
}
// most sizes are small, write size as VarUInt!
Compression.CompressVarUInt(writer, checked((uint)hashSet.Count) + 1u);
//writer.WriteUInt(checked((uint)hashSet.Count) + 1u);
foreach (T item in hashSet)
writer.Write(item);
}
public static void WriteArray<T>(this NetworkWriter writer, T[] array)
{

View File

@ -15,6 +15,17 @@ public class SyncIDictionary<TKey, TValue> : SyncObject, IDictionary<TKey, TValu
/// <summary>This is called after the item is removed with TKey. TValue is the OLD item</summary>
public Action<TKey, TValue> OnRemove;
/// <summary>This is called before the data is cleared</summary>
public Action OnClear;
public enum Operation : byte
{
OP_ADD,
OP_SET,
OP_REMOVE,
OP_CLEAR
}
/// <summary>
/// This is called for all changes to the Dictionary.
/// <para>For OP_ADD, TValue is the NEW value of the entry.</para>
@ -23,9 +34,6 @@ public class SyncIDictionary<TKey, TValue> : SyncObject, IDictionary<TKey, TValu
/// </summary>
public Action<Operation, TKey, TValue> OnChange;
/// <summary>This is called before the data is cleared</summary>
public Action OnClear;
protected readonly IDictionary<TKey, TValue> objects;
public SyncIDictionary(IDictionary<TKey, TValue> objects)
@ -36,14 +44,6 @@ public SyncIDictionary(IDictionary<TKey, TValue> objects)
public int Count => objects.Count;
public bool IsReadOnly => !IsWritable();
public enum Operation : byte
{
OP_ADD,
OP_CLEAR,
OP_REMOVE,
OP_SET
}
struct Change
{
internal Operation operation;

View File

@ -6,6 +6,21 @@ namespace Mirror
{
public class SyncList<T> : SyncObject, IList<T>, IReadOnlyList<T>
{
/// <summary>This is called after the item is added with index</summary>
public Action<int> OnAdd;
/// <summary>This is called after the item is inserted with index</summary>
public Action<int> OnInsert;
/// <summary>This is called after the item is set with index and OLD Value</summary>
public Action<int, T> OnSet;
/// <summary>This is called after the item is removed with index and OLD Value</summary>
public Action<int, T> OnRemove;
/// <summary>This is called before the list is cleared so the list can be iterated</summary>
public Action OnClear;
public enum Operation : byte
{
OP_ADD,
@ -15,28 +30,22 @@ public enum Operation : byte
OP_CLEAR
}
/// <summary>This is called after the item is added with index</summary>
public Action<int> OnAdd;
/// <summary>This is called after the item is inserted with inedx</summary>
public Action<int> OnInsert;
/// <summary>This is called after the item is set with index and OLD Value</summary>
public Action<int, T> OnSet;
/// <summary>This is called after the item is removed with index and OLD Value</summary>
public Action<int, T> OnRemove;
/// <summary>
/// This is called for all changes to the List.
/// <para>For OP_ADD and OP_INSERT, T is the NEW value of the entry.</para>
/// <para>For OP_SET and OP_REMOVE, T is the OLD value of the entry.</para>
/// <para>For OP_CLEAR, T is default.</para>
/// </summary>
// TODO deprecate in favor of explicit Callback, later rename Callback to OnChange for consistency with other SyncCollections.
public Action<Operation, int, T> OnChange;
/// <summary>This is called before the list is cleared so the list can be iterated</summary>
public Action OnClear;
/// <summary>
/// This is called for all changes to the List.
/// Parameters: Operation, index, oldItem, newItem.
/// Sometimes we need both oldItem and newItem.
/// Keep for compatibility since 10 years of projects use this.
/// </summary>
public Action<Operation, int, T, T> Callback;
readonly IList<T> objects;
readonly IEqualityComparer<T> comparer;
@ -111,22 +120,27 @@ void AddOperation(Operation op, int itemIndex, T oldItem, T newItem, bool checkA
case Operation.OP_ADD:
OnAdd?.Invoke(itemIndex);
OnChange?.Invoke(op, itemIndex, newItem);
Callback?.Invoke(op, itemIndex, oldItem, newItem);
break;
case Operation.OP_INSERT:
OnInsert?.Invoke(itemIndex);
OnChange?.Invoke(op, itemIndex, newItem);
Callback?.Invoke(op, itemIndex, oldItem, newItem);
break;
case Operation.OP_SET:
OnSet?.Invoke(itemIndex, oldItem);
OnChange?.Invoke(op, itemIndex, oldItem);
Callback?.Invoke(op, itemIndex, oldItem, newItem);
break;
case Operation.OP_REMOVEAT:
OnRemove?.Invoke(itemIndex, oldItem);
OnChange?.Invoke(op, itemIndex, oldItem);
Callback?.Invoke(op, itemIndex, oldItem, newItem);
break;
case Operation.OP_CLEAR:
OnClear?.Invoke();
OnChange?.Invoke(op, itemIndex, default);
Callback?.Invoke(op, itemIndex, default, default);
break;
}
}

View File

@ -12,6 +12,16 @@ public class SyncSet<T> : SyncObject, ISet<T>
/// <summary>This is called after the item is removed. T is the OLD item</summary>
public Action<T> OnRemove;
/// <summary>This is called BEFORE the data is cleared</summary>
public Action OnClear;
public enum Operation : byte
{
OP_ADD,
OP_REMOVE,
OP_CLEAR
}
/// <summary>
/// This is called for all changes to the Set.
/// <para>For OP_ADD, T is the NEW value of the entry.</para>
@ -20,21 +30,11 @@ public class SyncSet<T> : SyncObject, ISet<T>
/// </summary>
public Action<Operation, T> OnChange;
/// <summary>This is called BEFORE the data is cleared</summary>
public Action OnClear;
protected readonly ISet<T> objects;
public int Count => objects.Count;
public bool IsReadOnly => !IsWritable();
public enum Operation : byte
{
OP_ADD,
OP_REMOVE,
OP_CLEAR
}
struct Change
{
internal Operation operation;

View File

@ -114,6 +114,18 @@ public static void SetPositionAndRotation(this Transform transform, Vector3 posi
transform.position = position;
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
// IPEndPoint address only to pretty string.

View 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;
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 70b5947c49174f3c90121edd21ea6b15
timeCreated: 1729783714

View File

@ -36,7 +36,7 @@ public abstract class Transport : MonoBehaviour
/// <summary>Is this transport available in the current platform?</summary>
public abstract bool Available();
/// <summary>Is this transported encrypted for secure communication?</summary>
/// <summary>Is this transport encrypted for secure communication?</summary>
public virtual bool IsEncrypted => false;
/// <summary>If encrypted, which cipher is used?</summary>
@ -196,8 +196,15 @@ public virtual void ServerLateUpdate() {}
/// <summary>Shut down the transport, both as client and server</summary>
public abstract void Shutdown();
/// <summary>Called by Unity when quitting. Inheriting Transports should call base for proper Shutdown.</summary>
public virtual void OnApplicationQuit()
// [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() {}
// fixes: https://github.com/MirrorNetworking/Mirror/issues/2802
public virtual void OnDestroy()
{
// stop transport (e.g. to shut down threads)
// (when pressing Stop in the Editor, Unity keeps threads alive

View File

@ -55,19 +55,28 @@ public static void OnPostProcessScene()
else
{
// there are two cases where sceneId == 0:
// * 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.
// if we have a prefab open in the prefab scene
string path = identity.gameObject.scene.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.");
EditorApplication.isPlaying = false;
#endif
}
// if an unopened scene needs resaving
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
// happen when trying to launch with invalid sceneIds.
EditorApplication.isPlaying = false;
// nothing good will happen when trying to launch with invalid sceneIds.
// show an error and stop playing immediately.
Debug.LogError($"Scene {path} needs to be opened and resaved, because the scene object {identity.name} has no valid sceneId yet.");
EditorApplication.isPlaying = false;
}
}
}
}

View File

@ -125,6 +125,13 @@ MethodReference GenerateReader(TypeReference variableReference, ref bool Weaving
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.
// fixes: https://github.com/MirrorNetworking/Mirror/issues/2939
else if (variableReference.IsDerivedFrom<NetworkBehaviour>() || variableReference.Is<NetworkBehaviour>())

View File

@ -126,6 +126,13 @@ MethodReference GenerateWriter(TypeReference variableReference, ref bool Weaving
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.
// fixes: https://github.com/MirrorNetworking/Mirror/issues/2939

View File

@ -130,7 +130,7 @@ MonoBehaviour:
syncMode: 0
syncInterval: 0.1
destinationScene:
startPosition: {x: 0, y: 0, z: 0}
startPosition: {x: 0, y: 1.02, z: 0}
label: {fileID: 8197110483235692531}
labelText:
--- !u!1 &5961932215084527574

View File

@ -197,7 +197,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 472411619}
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_Children: []
m_Father: {fileID: 1518259679}
@ -240,7 +240,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 493146027}
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_Children: []
m_Father: {fileID: 1518259679}
@ -397,7 +397,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1224119056}
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_Children: []
m_Father: {fileID: 1518259679}
@ -670,7 +670,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1513281386}
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_Children: []
m_Father: {fileID: 1518259679}
@ -712,7 +712,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1518259678}
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_Children:
- {fileID: 493146028}
@ -872,23 +872,13 @@ PrefabInstance:
- target: {fileID: 3141292696673982546, guid: c624c75494b4d7d4086b9212f897e56a,
type: 3}
propertyPath: sceneId
value: 1143465467
objectReference: {fileID: 0}
- target: {fileID: 3141292696673982546, guid: c624c75494b4d7d4086b9212f897e56a,
type: 3}
propertyPath: serverOnly
value: 0
value: 182638750
objectReference: {fileID: 0}
- target: {fileID: 5948271423698091598, guid: c624c75494b4d7d4086b9212f897e56a,
type: 3}
propertyPath: startPosition.x
value: -5
objectReference: {fileID: 0}
- target: {fileID: 5948271423698091598, guid: c624c75494b4d7d4086b9212f897e56a,
type: 3}
propertyPath: startPosition.y
value: 1.1
objectReference: {fileID: 0}
- target: {fileID: 5948271423698091598, guid: c624c75494b4d7d4086b9212f897e56a,
type: 3}
propertyPath: startPosition.z

View File

@ -132,7 +132,7 @@ PrefabInstance:
- target: {fileID: 1098173225717622921, guid: c624c75494b4d7d4086b9212f897e56a,
type: 3}
propertyPath: m_RootOrder
value: 3
value: 2
objectReference: {fileID: 0}
- target: {fileID: 1098173225717622921, guid: c624c75494b4d7d4086b9212f897e56a,
type: 3}
@ -199,21 +199,11 @@ PrefabInstance:
propertyPath: serverOnly
value: 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,
type: 3}
propertyPath: startPosition.x
value: 5
objectReference: {fileID: 0}
- target: {fileID: 5948271423698091598, guid: c624c75494b4d7d4086b9212f897e56a,
type: 3}
propertyPath: startPosition.y
value: 1.1
objectReference: {fileID: 0}
- target: {fileID: 5948271423698091598, guid: c624c75494b4d7d4086b9212f897e56a,
type: 3}
propertyPath: startPosition.z

View File

@ -406,7 +406,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 178547537}
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_Children: []
m_Father: {fileID: 1172568542}
@ -696,7 +696,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 652875644}
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_Children: []
m_Father: {fileID: 1172568542}
@ -739,7 +739,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 691846569}
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_Children: []
m_Father: {fileID: 1172568542}
@ -1842,8 +1842,6 @@ MonoBehaviour:
headlessStartMode: 1
editorAutoStart: 0
sendRate: 30
autoStartServerBuild: 0
autoConnectClientBuild: 0
offlineScene:
onlineScene:
offlineSceneLoadDelay: 0
@ -2065,7 +2063,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1816951099}
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_Children: []
m_Father: {fileID: 1172568542}

View File

@ -62,15 +62,6 @@ public override void LateUpdate()
base.LateUpdate();
}
/// <summary>
/// Runs on both Server and Client
/// </summary>
public override void OnDestroy()
{
base.OnDestroy();
//UnityEngine.Debug.Log("OnDestroy");
}
#endregion
#region Start & Stop
@ -87,10 +78,10 @@ public override void ConfigureHeadlessFrameRate()
/// <summary>
/// called when quitting the application by closing the window / pressing stop in the editor
/// </summary>
public override void OnApplicationQuit()
public override void OnDestroy()
{
base.OnApplicationQuit();
//UnityEngine.Debug.Log("OnApplicationQuit");
base.OnDestroy();
//UnityEngine.Debug.Log("OnDestroy");
}
#endregion

View File

@ -148,5 +148,5 @@ MonoBehaviour:
syncMode: 0
syncInterval: 0.1
speed: 1
movementProbability: 0.5
movementProbability: 0.1
movementDistance: 20

View File

@ -5,7 +5,13 @@ namespace Mirror.Examples.Benchmark
public class MonsterMovement : NetworkBehaviour
{
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;
bool moving;

View File

@ -6,6 +6,17 @@ public class PlayerMovement : NetworkBehaviour
{
public float speed = 5;
// naming for easier debugging
public override void OnStartClient()
{
name = $"Player[{netId}|{(isLocalPlayer ? "local" : "remote")}]";
}
public override void OnStartServer()
{
name = $"Player[{netId}|server]";
}
void Update()
{
if (!isLocalPlayer) return;

View File

@ -259,8 +259,6 @@ MonoBehaviour:
headlessStartMode: 1
editorAutoStart: 0
sendRate: 60
autoStartServerBuild: 0
autoConnectClientBuild: 0
offlineScene:
onlineScene:
offlineSceneLoadDelay: 0
@ -363,7 +361,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 204334129}
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_Children: []
m_Father: {fileID: 1445635740}
@ -406,7 +404,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 263230754}
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_Children: []
m_Father: {fileID: 1445635740}
@ -449,7 +447,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 290557149}
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_Children: []
m_Father: {fileID: 1445635740}
@ -584,7 +582,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 733367779}
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_Children: []
m_Father: {fileID: 1445635740}
@ -627,7 +625,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 990635329}
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_Children: []
m_Father: {fileID: 1445635740}
@ -735,7 +733,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1445635739}
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_Children:
- {fileID: 733367780}
@ -774,7 +772,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1760045336}
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_Children: []
m_Father: {fileID: 1445635740}
@ -817,7 +815,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1975674812}
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_Children: []
m_Father: {fileID: 1445635740}
@ -860,7 +858,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2127619491}
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_Children: []
m_Father: {fileID: 1445635740}

View File

@ -9,12 +9,13 @@ Material:
m_PrefabAsset: {fileID: 0}
m_Name: Ball
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_ShaderKeywords: _ALPHAPREMULTIPLY_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
@ -59,19 +60,19 @@ Material:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlend: 10
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _Mode: 3
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
- _ZWrite: 0
m_Colors:
- _Color: {r: 0.7924528, g: 0.078497685, b: 0.078497685, a: 1}
- _Color: {r: 1, g: 0, b: 0, a: 0.7529412}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View File

@ -9,12 +9,13 @@ Material:
m_PrefabAsset: {fileID: 0}
m_Name: Bat
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_ShaderKeywords: _ALPHAPREMULTIPLY_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
@ -59,19 +60,19 @@ Material:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlend: 10
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _Mode: 3
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
- _ZWrite: 0
m_Colors:
- _Color: {r: 0.06274474, g: 0.22154337, b: 0.8867924, a: 1}
- _Color: {r: 0, g: 0, b: 1, a: 0.7529412}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View File

@ -9,12 +9,13 @@ Material:
m_PrefabAsset: {fileID: 0}
m_Name: Box
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_ShaderKeywords: _ALPHAPREMULTIPLY_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
@ -59,19 +60,19 @@ Material:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlend: 10
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _Mode: 3
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
- _ZWrite: 0
m_Colors:
- _Color: {r: 0.03999205, g: 0.6981132, b: 0.0032929946, a: 1}
- _Color: {r: 0, g: 1, b: 0, a: 0.7529412}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View File

@ -191,15 +191,16 @@ MonoBehaviour:
offlineSceneLoadDelay: 0
transport: {fileID: 94711025}
networkAddress: localhost
maxConnections: 100
maxConnections: 2
disconnectInactiveConnections: 0
disconnectInactiveTimeout: 60
authenticator: {fileID: 0}
playerPrefab: {fileID: 7267698107325001584, guid: 0a718236edc07af46a9f3ebb74fd1e45,
type: 3}
autoCreatePlayer: 1
playerSpawnMethod: 0
spawnPrefabs: []
playerSpawnMethod: 1
spawnPrefabs:
- {fileID: 8373046805013990044, guid: 41c6c51270a8bab40b39ca7962e9ac6c, type: 3}
exceptionsDisconnect: 1
snapshotSettings:
bufferTimeMultiplier: 2
@ -335,6 +336,49 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &992559145
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 992559146}
- component: {fileID: 992559147}
m_Layer: 0
m_Name: SpawnPoint
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &992559146
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 992559145}
m_LocalRotation: {x: 0, y: -0.8191521, z: 0, w: 0.57357645}
m_LocalPosition: {x: 1.2, y: 0, z: 1.8}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1087861736}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: -110, z: 0}
--- !u!114 &992559147
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 992559145}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 41f84591ce72545258ea98cb7518d8b9, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1054605962
GameObject:
m_ObjectHideFlags: 0
@ -352,7 +396,7 @@ GameObject:
- component: {fileID: 1054605964}
- component: {fileID: 1054605963}
m_Layer: 0
m_Name: PlayArea
m_Name: Ground
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -432,8 +476,8 @@ MeshRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1054605962}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
@ -442,7 +486,7 @@ MeshRenderer:
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 6eb3f3ba66756364d8b94e662e7e8af5, type: 2}
- {fileID: 2100000, guid: 29b49c27a74f145918356859bd7af511, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -480,11 +524,86 @@ Transform:
m_GameObject: {fileID: 1054605962}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 5, y: 1, z: 5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1087861735
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1087861736}
m_Layer: 0
m_Name: Spawns
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1087861736
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1087861735}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1089501590}
- {fileID: 992559146}
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1089501589
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1089501590}
- component: {fileID: 1089501591}
m_Layer: 0
m_Name: SpawnPoint
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1089501590
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1089501589}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1087861736}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1089501591
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1089501589}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 41f84591ce72545258ea98cb7518d8b9, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1571122690
GameObject:
m_ObjectHideFlags: 0

View File

@ -27,8 +27,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8563961762736836479}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.2, y: 0.2, z: 0.2}
m_LocalPosition: {x: -0.05, y: 0, z: 0}
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
@ -49,8 +49,8 @@ MeshRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8563961762736836479}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1

View File

@ -27,8 +27,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6507540558446839548}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.1, y: 0.2, z: 0.1}
m_LocalPosition: {x: -0.025, y: 0.1, z: 0}
m_LocalScale: {x: 0.05, y: 0.2, z: 0.05}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
@ -49,8 +49,8 @@ MeshRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6507540558446839548}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1

View File

@ -27,8 +27,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7003386763226572670}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.2, y: 0.2, z: 0.2}
m_LocalPosition: {x: -0.05, y: 0, z: 0}
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
@ -49,8 +49,8 @@ MeshRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7003386763226572670}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1

View File

@ -1724,10 +1724,10 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8617929508499776844}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalRotation: {x: -0.5, y: 0.5, z: -0.5, w: 0.5}
m_LocalPosition: {x: 0.1, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1276535037084972472}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 180, y: 270, z: 90}

View File

@ -13,7 +13,7 @@ GameObject:
- component: {fileID: 1580898288973620588}
- component: {fileID: 68065165359339619}
m_Layer: 0
m_Name: PlayerPrefab
m_Name: Player
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0

View File

@ -14,7 +14,7 @@ GameObject:
- component: {fileID: 3436383402443096375}
- component: {fileID: 6259401778744657634}
m_Layer: 0
m_Name: SceneObjectPrefab
m_Name: SceneObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -59,9 +59,9 @@ Rigidbody:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8373046805013990044}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_Mass: 0.8
m_Drag: 0.5
m_AngularDrag: 0.8
m_UseGravity: 1
m_IsKinematic: 1
m_Interpolate: 0
@ -121,4 +121,6 @@ MonoBehaviour:
type: 3}
boxPrefab: {fileID: 7003386763226572670, guid: a4076fff9676bc243ae6d7d6c08341f3,
type: 3}
force: 1
direction: {x: 0, y: 0, z: 0}
equippedItem: 0

View File

@ -13,46 +13,19 @@ public enum EquippedItem : byte
public class PickupsDropsChilds : NetworkBehaviour
{
public GameObject sceneObjectPrefab;
[Header("Player Components")]
public GameObject rightHand;
[Header("Prefabs")]
public GameObject ballPrefab;
public GameObject batPrefab;
public GameObject boxPrefab;
public GameObject sceneObjectPrefab;
[SyncVar(hook = nameof(OnChangeEquipment))]
[Header("Diagnostics")]
[ReadOnly, SyncVar(hook = nameof(OnChangeEquipment))]
public EquippedItem equippedItem;
void OnChangeEquipment(EquippedItem oldEquippedItem, EquippedItem newEquippedItem)
{
StartCoroutine(ChangeEquipment(newEquippedItem));
}
// Since Destroy is delayed to the end of the current frame, we use a coroutine
// to clear out any child objects before instantiating the new one
IEnumerator ChangeEquipment(EquippedItem newEquippedItem)
{
while (rightHand.transform.childCount > 0)
{
Destroy(rightHand.transform.GetChild(0).gameObject);
yield return null;
}
switch (newEquippedItem)
{
case EquippedItem.ball:
Instantiate(ballPrefab, rightHand.transform);
break;
case EquippedItem.bat:
Instantiate(batPrefab, rightHand.transform);
break;
case EquippedItem.box:
Instantiate(boxPrefab, rightHand.transform);
break;
}
}
void Update()
{
if (!isLocalPlayer) return;
@ -70,23 +43,41 @@ void Update()
CmdDropItem();
}
void OnChangeEquipment(EquippedItem _, EquippedItem newEquippedItem)
{
StartCoroutine(ChangeEquipment());
}
// Since Destroy is delayed to the end of the current frame, we use a coroutine
// to clear out any child objects before instantiating the new one
IEnumerator ChangeEquipment()
{
while (rightHand.transform.childCount > 0)
{
Destroy(rightHand.transform.GetChild(0).gameObject);
yield return null;
}
switch (equippedItem)
{
case EquippedItem.ball:
Instantiate(ballPrefab, rightHand.transform);
break;
case EquippedItem.bat:
Instantiate(batPrefab, rightHand.transform);
break;
case EquippedItem.box:
Instantiate(boxPrefab, rightHand.transform);
break;
}
}
[Command]
void CmdChangeEquippedItem(EquippedItem selectedItem)
{
equippedItem = selectedItem;
}
// public because it's called from a script on the SceneObject
[Command]
public void CmdPickupItem(GameObject sceneObject)
{
// set the player's SyncVar so clients can show the equipped item
equippedItem = sceneObject.GetComponent<SceneObject>().equippedItem;
// Destroy the scene object
NetworkServer.Destroy(sceneObject);
}
[Command]
void CmdDropItem()
{
@ -100,17 +91,31 @@ void CmdDropItem()
SceneObject sceneObject = newSceneObject.GetComponent<SceneObject>();
// set the child object on the server
sceneObject.SetEquippedItem(equippedItem);
// set the SyncVar on the scene object for clients
// set the SyncVar on the scene object for clients to instantiate
sceneObject.equippedItem = equippedItem;
// set the direction to launch the scene object
sceneObject.direction = rightHand.transform.forward;
// set the player's SyncVar to nothing so clients will destroy the equipped child item
equippedItem = EquippedItem.nothing;
// set the child object on the server
sceneObject.SetEquippedItem();
// Spawn the scene object on the network for all to see
NetworkServer.Spawn(newSceneObject);
}
// public because it's called from a script on the SceneObject
[Command]
public void CmdPickupItem(GameObject sceneObject)
{
// set the player's SyncVar so clients can show the equipped item
equippedItem = sceneObject.GetComponent<SceneObject>().equippedItem;
// Destroy the scene object
NetworkServer.Destroy(sceneObject);
}
}
}

View File

@ -1,4 +1,4 @@
using System.Collections;
using System.Collections;
using UnityEngine;
namespace Mirror.Examples.PickupsDropsChilds
@ -6,50 +6,20 @@ namespace Mirror.Examples.PickupsDropsChilds
[RequireComponent(typeof(Rigidbody))]
public class SceneObject : NetworkBehaviour
{
[Header("Prefabs")]
public GameObject ballPrefab;
public GameObject batPrefab;
public GameObject boxPrefab;
[SyncVar(hook = nameof(OnChangeEquipment))]
[Header("Settings")]
[Range(0, 5)] public float force = 1;
[Header("Diagnostics")]
[ReadOnly] public Vector3 direction;
[ReadOnly, SyncVar(hook = nameof(OnChangeEquipment))]
public EquippedItem equippedItem;
void OnChangeEquipment(EquippedItem oldEquippedItem, EquippedItem newEquippedItem)
{
StartCoroutine(ChangeEquipment(newEquippedItem));
}
// Since Destroy is delayed to the end of the current frame, we use a coroutine
// to clear out any child objects before instantiating the new one
IEnumerator ChangeEquipment(EquippedItem newEquippedItem)
{
while (transform.childCount > 0)
{
Destroy(transform.GetChild(0).gameObject);
yield return null;
}
// Use the new value, not the SyncVar property value
SetEquippedItem(newEquippedItem);
}
// SetEquippedItem is called on the client from OnChangeEquipment (above),
// and on the server from CmdDropItem in the PlayerEquip script.
public void SetEquippedItem(EquippedItem newEquippedItem)
{
switch (newEquippedItem)
{
case EquippedItem.ball:
Instantiate(ballPrefab, transform);
break;
case EquippedItem.bat:
Instantiate(batPrefab, transform);
break;
case EquippedItem.box:
Instantiate(boxPrefab, transform);
break;
}
}
protected override void OnValidate()
{
if (Application.isPlaying) return;
@ -68,7 +38,7 @@ public override void OnStartServer()
if (TryGetComponent(out Rigidbody rb))
{
rb.isKinematic = false;
rb.AddForce(Vector3.forward, ForceMode.Impulse);
rb.AddForce(direction * force, ForceMode.Impulse);
}
}
@ -76,5 +46,41 @@ void OnMouseDown()
{
NetworkClient.localPlayer.GetComponent<PickupsDropsChilds>().CmdPickupItem(gameObject);
}
void OnChangeEquipment(EquippedItem _, EquippedItem newEquippedItem)
{
StartCoroutine(ChangeEquipment());
}
// Since Destroy is delayed to the end of the current frame, we use a coroutine
// to clear out any child objects before instantiating the new one
IEnumerator ChangeEquipment()
{
while (transform.childCount > 0)
{
Destroy(transform.GetChild(0).gameObject);
yield return null;
}
SetEquippedItem();
}
// SetEquippedItem is called on the client from OnChangeEquipment (above),
// and on the server from CmdDropItem in the PlayerEquip script.
public void SetEquippedItem()
{
switch (equippedItem)
{
case EquippedItem.ball:
Instantiate(ballPrefab, transform);
break;
case EquippedItem.bat:
Instantiate(batPrefab, transform);
break;
case EquippedItem.box:
Instantiate(boxPrefab, transform);
break;
}
}
}
}

View File

@ -0,0 +1,474 @@
%YAML 1.1
%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
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5048467161036537608}
- component: {fileID: 7612349963074522185}
- component: {fileID: 3334477149274362705}
m_Layer: 0
m_Name: Visor
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5048467161036537608
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3564599214188516024}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0.39999998, z: 0.5}
m_LocalScale: {x: 0.5, y: 0.1, z: 0.2}
m_Children: []
m_Father: {fileID: 4320229852458648655}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &7612349963074522185
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3564599214188516024}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &3334477149274362705
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3564599214188516024}
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: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, 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: 0
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!1 &6908139674379992817
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4320229852458648655}
- component: {fileID: 7269450925790386019}
- component: {fileID: 1803642612145923671}
m_Layer: 0
m_Name: Capsule
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4320229852458648655
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6908139674379992817}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 5048467161036537608}
m_Father: {fileID: 5650773562400175449}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &7269450925790386019
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6908139674379992817}
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &1803642612145923671
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6908139674379992817}
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: 2100000, guid: 792117fe9a386a8489e8010bec746339, type: 2}
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: 0
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!1 &7197623925735895267
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5650773562400175449}
- component: {fileID: 3870420104013059684}
- component: {fileID: 4272311354144086857}
- component: {fileID: 6897869481335892641}
- component: {fileID: 6441507759764929271}
- component: {fileID: 706935836448234532}
- component: {fileID: 4932227711505240966}
- component: {fileID: 8229469515647906458}
m_Layer: 0
m_Name: PlayerRBReliable
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5650773562400175449
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7197623925735895267}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1.1, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 4320229852458648655}
- {fileID: 8070823805368028938}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!136 &3870420104013059684
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7197623925735895267}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.5
m_Height: 2
m_Direction: 1
m_Center: {x: 0, y: 0, z: 0}
--- !u!54 &4272311354144086857
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7197623925735895267}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 1
m_IsKinematic: 1
m_Interpolate: 1
m_Constraints: 112
m_CollisionDetection: 3
--- !u!114 &6897869481335892641
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7197623925735895267}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9b91ecbcc199f4492b9a91e820070131, type: 3}
m_Name:
m_EditorClassIdentifier:
sceneId: 0
_assetId: 3568813205
serverOnly: 0
visibility: 0
hasSpawned: 0
--- !u!114 &6441507759764929271
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7197623925735895267}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a91a718a70d01b347b75cb768a6f1a92, type: 3}
m_Name:
m_EditorClassIdentifier:
syncDirection: 0
syncMode: 0
syncInterval: 0
color:
serializedVersion: 2
rgba: 4278190080
--- !u!114 &706935836448234532
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7197623925735895267}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 71ac1e35462ffad469e77d1c2fe6c9f3, type: 3}
m_Name:
m_EditorClassIdentifier:
syncDirection: 0
syncMode: 0
syncInterval: 0
offset: {x: 0, y: 4, z: -12}
rotation: {x: 15, y: 0, z: 0}
--- !u!114 &4932227711505240966
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7197623925735895267}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8ff3ba0becae47b8b9381191598957c8, type: 3}
m_Name:
m_EditorClassIdentifier:
syncDirection: 1
syncMode: 0
syncInterval: 0
target: {fileID: 5650773562400175449}
syncPosition: 1
syncRotation: 1
syncScale: 0
onlySyncOnChange: 1
compressRotation: 1
interpolatePosition: 1
interpolateRotation: 1
interpolateScale: 1
coordinateSpace: 0
timelineOffset: 0
showGizmos: 0
showOverlay: 0
overlayColor: {r: 0, g: 0, b: 0, a: 0.5}
onlySyncOnChangeCorrectionMultiplier: 2
rotationSensitivity: 0.01
positionPrecision: 0.01
scalePrecision: 0.01
--- !u!114 &8229469515647906458
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7197623925735895267}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0336d1bd689de45418c08c76ae66e503, type: 3}
m_Name:
m_EditorClassIdentifier:
syncDirection: 0
syncMode: 0
syncInterval: 0
rigidBody: {fileID: 4272311354144086857}
capsuleCollider: {fileID: 3870420104013059684}
ControllerUIPrefab: {fileID: 1328287033780775043, guid: 5caaf0d5754a64f4080f0c8b55c0b03d,
type: 3}
moveKeys:
Forward: 119
Back: 115
StrafeLeft: 97
StrafeRight: 100
TurnLeft: 113
TurnRight: 101
Jump: 32
optionsKeys:
MouseSteer: 109
AutoRun: 114
ToggleUI: 117
controlOptions: 4
maxMoveSpeed: 8
inputSensitivity: 2
inputGravity: 2
maxTurnSpeed: 100
turnAcceleration: 3
initialJumpSpeed: 2.5
maxJumpSpeed: 3.5
jumpAcceleration: 4
runtimeData:
_horizontal: 0
_vertical: 0
_turnSpeed: 0
_jumpSpeed: 0
_animVelocity: 0
_animRotation: 0
_mouseInputX: 0
_mouseSensitivity: 0
_groundState: 0
_direction: {x: 0, y: 0, z: 0}
_velocity: {x: 0, y: 0, z: 0}
_controllerUI: {fileID: 0}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 51b55303800297f4ba210567adf65d62
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,474 @@
%YAML 1.1
%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
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6265883749291389483}
- component: {fileID: 8745807705742672234}
- component: {fileID: 4520865791365521010}
m_Layer: 0
m_Name: Visor
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6265883749291389483
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2414815785185615771}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0.39999998, z: 0.5}
m_LocalScale: {x: 0.5, y: 0.1, z: 0.2}
m_Children: []
m_Father: {fileID: 3102887894851733868}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &8745807705742672234
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2414815785185615771}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &4520865791365521010
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2414815785185615771}
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: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, 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: 0
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!1 &5703107844171822034
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3102887894851733868}
- component: {fileID: 8365824619968961088}
- component: {fileID: 719719793260653428}
m_Layer: 0
m_Name: Capsule
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3102887894851733868
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5703107844171822034}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 6265883749291389483}
m_Father: {fileID: 6814142693731383418}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &8365824619968961088
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5703107844171822034}
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &719719793260653428
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5703107844171822034}
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: 2100000, guid: 792117fe9a386a8489e8010bec746339, type: 2}
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: 0
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!1 &8293447860930641344
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6814142693731383418}
- component: {fileID: 2687902018279037767}
- component: {fileID: 3148414963753227882}
- component: {fileID: 5710847519792162690}
- component: {fileID: 5305226192869963732}
- component: {fileID: 1816266031544717575}
- component: {fileID: 1100861297868964075}
- component: {fileID: 3894195534993113074}
m_Layer: 0
m_Name: PlayerRBUnreliable
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6814142693731383418
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8293447860930641344}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1.1, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 3102887894851733868}
- {fileID: 4129545300081926521}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!136 &2687902018279037767
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8293447860930641344}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.5
m_Height: 2
m_Direction: 1
m_Center: {x: 0, y: 0, z: 0}
--- !u!54 &3148414963753227882
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8293447860930641344}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 1
m_IsKinematic: 1
m_Interpolate: 1
m_Constraints: 112
m_CollisionDetection: 3
--- !u!114 &5710847519792162690
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8293447860930641344}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9b91ecbcc199f4492b9a91e820070131, type: 3}
m_Name:
m_EditorClassIdentifier:
sceneId: 0
_assetId: 1425781377
serverOnly: 0
visibility: 0
hasSpawned: 0
--- !u!114 &5305226192869963732
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8293447860930641344}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a91a718a70d01b347b75cb768a6f1a92, type: 3}
m_Name:
m_EditorClassIdentifier:
syncDirection: 0
syncMode: 0
syncInterval: 0
color:
serializedVersion: 2
rgba: 4278190080
--- !u!114 &1816266031544717575
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8293447860930641344}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 71ac1e35462ffad469e77d1c2fe6c9f3, type: 3}
m_Name:
m_EditorClassIdentifier:
syncDirection: 0
syncMode: 0
syncInterval: 0
offset: {x: 0, y: 4, z: -12}
rotation: {x: 15, y: 0, z: 0}
--- !u!114 &1100861297868964075
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8293447860930641344}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a553cb17010b2403e8523b558bffbc14, type: 3}
m_Name:
m_EditorClassIdentifier:
syncDirection: 1
syncMode: 0
syncInterval: 0
target: {fileID: 6814142693731383418}
syncPosition: 1
syncRotation: 1
syncScale: 0
onlySyncOnChange: 1
compressRotation: 1
interpolatePosition: 1
interpolateRotation: 1
interpolateScale: 1
coordinateSpace: 0
timelineOffset: 0
showGizmos: 0
showOverlay: 0
overlayColor: {r: 0, g: 0, b: 0, a: 0.5}
bufferResetMultiplier: 3
positionSensitivity: 0.01
rotationSensitivity: 0.01
scaleSensitivity: 0.01
--- !u!114 &3894195534993113074
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8293447860930641344}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 60cbbdae6551c7b4395e1bd09e2ff3ea, type: 3}
m_Name:
m_EditorClassIdentifier:
syncDirection: 0
syncMode: 0
syncInterval: 0
rigidBody: {fileID: 3148414963753227882}
capsuleCollider: {fileID: 2687902018279037767}
ControllerUIPrefab: {fileID: 1328287033780775043, guid: 5caaf0d5754a64f4080f0c8b55c0b03d,
type: 3}
moveKeys:
Forward: 119
Back: 115
StrafeLeft: 97
StrafeRight: 100
TurnLeft: 113
TurnRight: 101
Jump: 32
optionsKeys:
MouseSteer: 109
AutoRun: 114
ToggleUI: 117
controlOptions: 4
maxMoveSpeed: 8
inputSensitivity: 2
inputGravity: 2
maxTurnSpeed: 100
turnAcceleration: 3
initialJumpSpeed: 2.5
maxJumpSpeed: 3.5
jumpAcceleration: 4
runtimeData:
_horizontal: 0
_vertical: 0
_turnSpeed: 0
_jumpSpeed: 0
_animVelocity: 0
_animRotation: 0
_mouseInputX: 0
_mouseSensitivity: 0
_groundState: 0
_direction: {x: 0, y: 0, z: 0}
_velocity: {x: 0, y: 0, z: 0}
_controllerUI: {fileID: 0}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6cd3cc8651287ef4a950692d79f015f3
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -79,6 +79,112 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 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
GameObject:
m_ObjectHideFlags: 0
@ -195,6 +301,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 3834521907656645861}
- {fileID: 1545974004720046327}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View File

@ -71,14 +71,6 @@ public override void 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
#region Scene Management

View File

@ -198,8 +198,8 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 361955662}
m_LocalRotation: {x: 0.08715574, y: -0, z: -0, w: 0.9961947}
m_LocalPosition: {x: 0, y: 4.08, z: -8}
m_LocalRotation: {x: 0.15731035, y: 0.072513655, z: -0.011583021, w: 0.98481524}
m_LocalPosition: {x: -402.78363, y: 31.230488, z: -13.799797}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
@ -378,7 +378,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 856494733}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 2, z: 20}
m_LocalPosition: {x: 0, y: 2, z: -200}
m_LocalScale: {x: 4, y: 4, z: 4}
m_Children: []
m_Father: {fileID: 0}
@ -420,13 +420,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 890531170}
m_LocalRotation: {x: 0, y: 0.38268343, z: 0, w: 0.92387956}
m_LocalPosition: {x: -14, y: 5, z: -14}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -325, y: 11.02, z: -6}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 45, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &980545347
GameObject:
m_ObjectHideFlags: 0
@ -463,13 +463,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 980545347}
m_LocalRotation: {x: 0, y: 0.92387956, z: 0, w: 0.38268343}
m_LocalPosition: {x: -14, y: 5, z: 14}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -325, y: 11.02, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 135, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1175360880
GameObject:
m_ObjectHideFlags: 0
@ -506,13 +506,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1175360880}
m_LocalRotation: {x: 0, y: -0.38268343, z: 0, w: 0.92387956}
m_LocalPosition: {x: 14, y: 5, z: -14}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -325, y: 11.02, z: -14}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: -45, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1177316161
GameObject:
m_ObjectHideFlags: 0
@ -524,6 +524,7 @@ GameObject:
- component: {fileID: 1177316164}
- component: {fileID: 1177316163}
- component: {fileID: 1177316162}
- component: {fileID: 1177316165}
m_Layer: 0
m_Name: Terrain
m_TagString: Untagged
@ -589,6 +590,22 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 2
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
GameObject:
m_ObjectHideFlags: 0
@ -625,13 +642,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1708370876}
m_LocalRotation: {x: 0, y: -0.92387956, z: 0, w: 0.38268343}
m_LocalPosition: {x: 14, y: 5, z: 14}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -325, y: 11.02, z: -18}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: -135, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2078663351
GameObject:
m_ObjectHideFlags: 0

View File

@ -159,6 +159,112 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 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
GameObject:
m_ObjectHideFlags: 0
@ -195,6 +301,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 3834521907656645861}
- {fileID: 8679949096303753939}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View File

@ -38,6 +38,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 702109291309605218}
- {fileID: 1245118046271587945}
- {fileID: 8174595063106582951}
m_Father: {fileID: 0}
m_RootOrder: 0
@ -197,7 +198,6 @@ MonoBehaviour:
maxTurnSpeed: 100
turnAcceleration: 3
runtimeData:
_horizontal: 0
_vertical: 0
_turnSpeed: 0
_animVelocity: 0
@ -328,6 +328,112 @@ MonoBehaviour:
rotationSensitivity: 0.01
positionPrecision: 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
GameObject:
m_ObjectHideFlags: 0
@ -359,7 +465,7 @@ Transform:
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
m_Children: []
m_Father: {fileID: 4659514702152478195}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!23 &4153780752967283830
MeshRenderer:
@ -446,6 +552,11 @@ PrefabInstance:
propertyPath: m_Name
value: BasePrefab
objectReference: {fileID: 0}
- target: {fileID: 3638700596990361445, guid: dad07e68d3659e6439279d0d4110cf4c,
type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3638700596990361445, guid: dad07e68d3659e6439279d0d4110cf4c,
type: 3}
propertyPath: m_LocalPosition.x

View File

@ -38,6 +38,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 702109291309605218}
- {fileID: 3980373565918037634}
- {fileID: 8174595063106582951}
m_Father: {fileID: 0}
m_RootOrder: 0
@ -197,7 +198,6 @@ MonoBehaviour:
maxTurnSpeed: 100
turnAcceleration: 3
runtimeData:
_horizontal: 0
_vertical: 0
_turnSpeed: 0
_animVelocity: 0
@ -328,6 +328,112 @@ MonoBehaviour:
positionSensitivity: 0.01
rotationSensitivity: 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
GameObject:
m_ObjectHideFlags: 0
@ -359,7 +465,7 @@ Transform:
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
m_Children: []
m_Father: {fileID: 4659514702152478195}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!23 &4153780752967283830
MeshRenderer:
@ -446,6 +552,11 @@ PrefabInstance:
propertyPath: m_Name
value: BasePrefab
objectReference: {fileID: 0}
- target: {fileID: 3638700596990361445, guid: dad07e68d3659e6439279d0d4110cf4c,
type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3638700596990361445, guid: dad07e68d3659e6439279d0d4110cf4c,
type: 3}
propertyPath: m_LocalPosition.x

View File

@ -239,7 +239,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 204334129}
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_Children: []
m_Father: {fileID: 1445635740}
@ -282,7 +282,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 263230754}
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_Children: []
m_Father: {fileID: 1445635740}
@ -391,7 +391,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 290557149}
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_Children: []
m_Father: {fileID: 1445635740}
@ -434,7 +434,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 733367779}
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_Children: []
m_Father: {fileID: 1445635740}
@ -477,7 +477,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 990635329}
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_Children: []
m_Father: {fileID: 1445635740}
@ -743,7 +743,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1445635739}
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_Children:
- {fileID: 733367780}
@ -782,7 +782,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1760045336}
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_Children: []
m_Father: {fileID: 1445635740}
@ -825,7 +825,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1975674812}
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_Children: []
m_Father: {fileID: 1445635740}
@ -868,7 +868,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2127619491}
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_Children: []
m_Father: {fileID: 1445635740}

View File

@ -24,34 +24,29 @@ protected override void OnValidate()
[ServerCallback]
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Player"))
ClaimPrize(other.gameObject);
}
// Set up physics layers to prevent this from being called by non-players
// and eliminate the need for a tag check here.
if (!other.CompareTag("Player")) return;
[ServerCallback]
void ClaimPrize(GameObject player)
{
if (available)
{
// This is a fast switch to prevent two players claiming the prize in a bang-bang close contest for it.
// First hit turns it off, pending the object being destroyed a few frames later.
// This is a fast switch to prevent two players claiming the prize in a bang-bang close contest for it.
// First to trigger turns it off, pending the object being destroyed a few frames later.
if (!available)
return;
else
available = false;
Color32 color = randomColor.color;
// Calculate the points from the color...lighter scores higher as the average approaches 255
// UnityEngine.Color RGB values are byte 0 to 255
uint points = (uint)((randomColor.color.r + randomColor.color.g + randomColor.color.b) / 3);
// calculate the points from the color ... lighter scores higher as the average approaches 255
// UnityEngine.Color RGB values are float fractions of 255
uint points = (uint)(((color.r) + (color.g) + (color.b)) / 3);
// award the points via SyncVar on Player's PlayerScore
other.GetComponent<PlayerScore>().score += points;
// award the points via SyncVar on the PlayerController
player.GetComponent<PlayerScore>().score += points;
// spawn a replacement
Spawner.SpawnReward();
// spawn a replacement
Spawner.SpawnReward();
// destroy this one
NetworkServer.Destroy(gameObject);
}
// destroy this one
NetworkServer.Destroy(gameObject);
}
}
}

View File

@ -147,7 +147,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 12226146}
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_Children: []
m_Father: {fileID: 4239341309712137294}
@ -282,7 +282,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 386825728}
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_Children: []
m_Father: {fileID: 4239341309712137294}
@ -390,7 +390,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 781619875}
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_Children: []
m_Father: {fileID: 4239341309712137294}
@ -583,7 +583,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1695890598}
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_Children: []
m_Father: {fileID: 4239341309712137294}

View File

@ -13,7 +13,7 @@ OcclusionCullingSettings:
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 10
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
@ -43,7 +43,8 @@ RenderSettings:
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
serializedVersion: 11
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
@ -66,6 +67,9 @@ LightmapSettings:
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 0
@ -94,13 +98,13 @@ LightmapSettings:
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 1064449595}
m_UseShadowmask: 1
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 3
serializedVersion: 2
agentTypeID: 0
agentRadius: 2
agentHeight: 3.5
@ -113,9 +117,7 @@ NavMeshSettings:
cellSize: 0.6666667
manualTileSize: 0
tileSize: 256
buildHeightMesh: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
accuratePlacement: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 23800000, guid: c772aa575956c59478e2d55eb019e17a, type: 2}
@ -151,17 +153,9 @@ Camera:
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_FocusDistance: 10
m_FocalLength: 50
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
@ -195,13 +189,12 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 88936773}
serializedVersion: 2
m_LocalRotation: {x: 0.3420201, y: 0, z: 0, w: 0.9396927}
m_LocalPosition: {x: 0, y: 20, z: -30}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 40, y: 0, z: 0}
--- !u!114 &88936778
MonoBehaviour:
@ -244,13 +237,12 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 251893064}
serializedVersion: 2
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: -135, z: 0}
--- !u!114 &251893066
MonoBehaviour:
@ -288,13 +280,12 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 535739935}
serializedVersion: 2
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: -45, z: 0}
--- !u!114 &535739937
MonoBehaviour:
@ -308,66 +299,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 41f84591ce72545258ea98cb7518d8b9, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!850595691 &1064449595
LightingSettings:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Settings.lighting
serializedVersion: 8
m_EnableBakedLightmaps: 0
m_EnableRealtimeLightmaps: 0
m_RealtimeEnvironmentLighting: 1
m_BounceScale: 1
m_AlbedoBoost: 1
m_IndirectOutputScale: 1
m_UsingShadowmask: 1
m_BakeBackend: 1
m_LightmapMaxSize: 1024
m_LightmapSizeFixed: 0
m_UseMipmapLimits: 1
m_BakeResolution: 40
m_Padding: 2
m_LightmapCompression: 3
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAO: 0
m_MixedBakeMode: 2
m_LightmapsBakeMode: 1
m_FilterMode: 1
m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0}
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_RealtimeResolution: 2
m_ForceWhiteAlbedo: 0
m_ForceUpdates: 0
m_PVRCulling: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVREnvironmentSampleCount: 512
m_PVREnvironmentReferencePointCount: 2048
m_LightProbeSampleCountMultiplier: 4
m_PVRBounces: 2
m_PVRMinBounces: 2
m_PVREnvironmentImportanceSampling: 0
m_PVRFilteringMode: 2
m_PVRDenoiserTypeDirect: 0
m_PVRDenoiserTypeIndirect: 0
m_PVRDenoiserTypeAO: 0
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_RespectSceneVisibilityWhenBakingGI: 0
--- !u!1 &1107091652
GameObject:
m_ObjectHideFlags: 0
@ -378,8 +309,8 @@ GameObject:
m_Component:
- component: {fileID: 1107091656}
- component: {fileID: 1107091655}
- component: {fileID: 1107091654}
- component: {fileID: 1107091653}
- component: {fileID: 1107091654}
m_Layer: 0
m_Name: Ground
m_TagString: Untagged
@ -398,14 +329,10 @@ MeshRenderer:
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
@ -430,7 +357,6 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!64 &1107091654
MeshCollider:
m_ObjectHideFlags: 0
@ -439,17 +365,9 @@ MeshCollider:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1107091652}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 5
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
@ -468,13 +386,12 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1107091652}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 4, y: 1, z: 4}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1282001517
GameObject:
@ -503,13 +420,12 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1282001517}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1282001519
MonoBehaviour:
@ -542,17 +458,17 @@ MonoBehaviour:
headlessStartMode: 1
editorAutoStart: 0
sendRate: 30
autoStartServerBuild: 0
autoConnectClientBuild: 0
offlineScene:
onlineScene:
offlineSceneLoadDelay: 0
transport: {fileID: 1282001521}
networkAddress: localhost
maxConnections: 100
disconnectInactiveConnections: 0
disconnectInactiveTimeout: 60
authenticator: {fileID: 0}
playerPrefab: {fileID: 1916082411674582, guid: 6f43bf5488a7443d19ab2a83c6b91f35, type: 3}
playerPrefab: {fileID: 1916082411674582, guid: 6f43bf5488a7443d19ab2a83c6b91f35,
type: 3}
autoCreatePlayer: 1
playerSpawnMethod: 1
spawnPrefabs:
@ -641,13 +557,12 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1458789072}
serializedVersion: 2
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 135, z: 0}
--- !u!114 &1458789074
MonoBehaviour:
@ -685,13 +600,12 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1501912662}
serializedVersion: 2
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 45, z: 0}
--- !u!114 &1501912664
MonoBehaviour:
@ -730,8 +644,9 @@ Light:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2054208274}
m_Enabled: 1
serializedVersion: 11
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1
m_Range: 10
@ -780,7 +695,6 @@ Light:
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &2054208276
@ -790,23 +704,10 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2054208274}
serializedVersion: 2
m_LocalRotation: {x: 0.10938167, y: 0.8754261, z: -0.40821788, w: 0.23456976}
m_LocalPosition: {x: 0, y: 10, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 50, y: 150, z: 0}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 2054208276}
- {fileID: 1107091656}
- {fileID: 88936777}
- {fileID: 1282001518}
- {fileID: 251893065}
- {fileID: 535739936}
- {fileID: 1458789073}
- {fileID: 1501912663}

View File

@ -22,14 +22,25 @@ public class Tank : NetworkBehaviour
[Header("Stats")]
[SyncVar] public int health = 5;
// naming for easier debugging
public override void OnStartClient()
{
name = $"Player[{netId}|{(isLocalPlayer ? "local" : "remote")}]";
}
public override void OnStartServer()
{
name = $"Player[{netId}|server]";
}
void Update()
{
// always update health bar.
// (SyncVar hook would only update on clients, not on server)
healthBar.text = new string('-', health);
// take input from focused window only
if(!Application.isFocused) return;
if(!Application.isFocused) return;
// movement for local player
if (isLocalPlayer)

View File

@ -4,7 +4,7 @@ namespace Mirror.Examples.Common.Controllers
{
[AddComponentMenu("")]
[DisallowMultipleComponent]
public class ContollerUIBase : MonoBehaviour
public class ControllerUIBase : MonoBehaviour
{
// Returns a string representation of a KeyCode that is more suitable

View File

@ -6,7 +6,7 @@ namespace Mirror.Examples.Common.Controllers.Flyer
{
[AddComponentMenu("")]
[DisallowMultipleComponent]
public class FlyerControllerUI : ContollerUIBase
public class FlyerControllerUI : ControllerUIBase
{
[Serializable]
public struct MoveTexts

View File

@ -6,7 +6,7 @@ namespace Mirror.Examples.Common.Controllers.Player
{
[AddComponentMenu("")]
[DisallowMultipleComponent]
public class PlayerControllerUI : ContollerUIBase
public class PlayerControllerUI : ControllerUIBase
{
[Serializable]
public struct MoveTexts

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 047a5014adf04914f9ffded62a715e39
guid: 42188a14ef528ec489da28afb66db6fa
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -0,0 +1,505 @@
using System;
using UnityEngine;
using UnityEngine.Serialization;
namespace Mirror.Examples.Common.Controllers.Player
{
[AddComponentMenu("")]
[RequireComponent(typeof(Rigidbody))]
[RequireComponent(typeof(CapsuleCollider))]
[RequireComponent(typeof(NetworkIdentity))]
[DisallowMultipleComponent]
public class PlayerControllerRBBase : NetworkBehaviour
{
const float BASE_DPI = 96f;
public enum GroundState : byte { Grounded, Jumping, Falling }
[Serializable]
public struct MoveKeys
{
public KeyCode Forward;
public KeyCode Back;
public KeyCode StrafeLeft;
public KeyCode StrafeRight;
public KeyCode TurnLeft;
public KeyCode TurnRight;
public KeyCode Jump;
}
[Serializable]
public struct OptionsKeys
{
public KeyCode MouseSteer;
public KeyCode AutoRun;
public KeyCode ToggleUI;
}
[Flags]
public enum ControlOptions : byte
{
None,
MouseSteer = 1 << 0,
AutoRun = 1 << 1,
ShowUI = 1 << 2
}
[Header("Avatar Components")]
public Rigidbody rigidBody;
public CapsuleCollider capsuleCollider;
[Header("User Interface")]
public GameObject ControllerUIPrefab;
[Header("Configuration")]
[SerializeField]
public MoveKeys moveKeys = new MoveKeys
{
Forward = KeyCode.W,
Back = KeyCode.S,
StrafeLeft = KeyCode.A,
StrafeRight = KeyCode.D,
TurnLeft = KeyCode.Q,
TurnRight = KeyCode.E,
Jump = KeyCode.Space,
};
[SerializeField]
public OptionsKeys optionsKeys = new OptionsKeys
{
MouseSteer = KeyCode.M,
AutoRun = KeyCode.R,
ToggleUI = KeyCode.U
};
[Space(5)]
public ControlOptions controlOptions = ControlOptions.ShowUI;
[Header("Movement")]
[Range(0, 20)]
[FormerlySerializedAs("moveSpeedMultiplier")]
[Tooltip("Speed in meters per second")]
public float maxMoveSpeed = 8f;
// Replacement for Sensitvity from Input Settings.
[Range(0, 10f)]
[Tooltip("Sensitivity factors into accelleration")]
public float inputSensitivity = 2f;
// Replacement for Gravity from Input Settings.
[Range(0, 10f)]
[Tooltip("Gravity factors into decelleration")]
public float inputGravity = 2f;
[Header("Turning")]
[Range(0, 300f)]
[Tooltip("Max Rotation in degrees per second")]
public float maxTurnSpeed = 100f;
[Range(0, 10f)]
[FormerlySerializedAs("turnDelta")]
[Tooltip("Rotation acceleration in degrees per second squared")]
public float turnAcceleration = 3f;
[Header("Jumping")]
[Range(0, 10f)]
[Tooltip("Initial jump speed in meters per second")]
public float initialJumpSpeed = 2.5f;
[Range(0, 10f)]
[Tooltip("Maximum jump speed in meters per second")]
public float maxJumpSpeed = 3.5f;
[Range(0, 10f)]
[FormerlySerializedAs("jumpDelta")]
[Tooltip("Jump acceleration in meters per second squared")]
public float jumpAcceleration = 4f;
// Runtime data in a struct so it can be folded up in inspector
[Serializable]
public struct RuntimeData
{
[ReadOnly, SerializeField, Range(-1f, 1f)] float _horizontal;
[ReadOnly, SerializeField, Range(-1f, 1f)] float _vertical;
[ReadOnly, SerializeField, Range(-300f, 300f)] float _turnSpeed;
[ReadOnly, SerializeField, Range(-10f, 10f)] float _jumpSpeed;
[ReadOnly, SerializeField, Range(-1.5f, 1.5f)] float _animVelocity;
[ReadOnly, SerializeField, Range(-1.5f, 1.5f)] float _animRotation;
[ReadOnly, SerializeField, Range(-1f, 1f)] float _mouseInputX;
[ReadOnly, SerializeField, Range(0, 30f)] float _mouseSensitivity;
[ReadOnly, SerializeField] GroundState _groundState;
[ReadOnly, SerializeField] Vector3 _direction;
[ReadOnly, SerializeField] Vector3Int _velocity;
[ReadOnly, SerializeField] GameObject _controllerUI;
#region Properties
public float horizontal
{
get => _horizontal;
internal set => _horizontal = value;
}
public float vertical
{
get => _vertical;
internal set => _vertical = value;
}
public float turnSpeed
{
get => _turnSpeed;
internal set => _turnSpeed = value;
}
public float jumpSpeed
{
get => _jumpSpeed;
internal set => _jumpSpeed = value;
}
public float animVelocity
{
get => _animVelocity;
internal set => _animVelocity = value;
}
public float animRotation
{
get => _animRotation;
internal set => _animRotation = value;
}
public float mouseInputX
{
get => _mouseInputX;
internal set => _mouseInputX = value;
}
public float mouseSensitivity
{
get => _mouseSensitivity;
internal set => _mouseSensitivity = value;
}
public GroundState groundState
{
get => _groundState;
internal set => _groundState = value;
}
public Vector3 direction
{
get => _direction;
internal set => _direction = value;
}
public Vector3Int velocity
{
get => _velocity;
internal set => _velocity = value;
}
public GameObject controllerUI
{
get => _controllerUI;
internal set => _controllerUI = value;
}
#endregion
}
[Header("Diagnostics")]
public RuntimeData runtimeData;
#region Network Setup
protected override void OnValidate()
{
// Skip if Editor is in Play mode
if (Application.isPlaying) return;
base.OnValidate();
Reset();
}
void Reset()
{
if (rigidBody == null)
rigidBody = GetComponent<Rigidbody>();
if (capsuleCollider == null)
capsuleCollider = GetComponent<CapsuleCollider>();
// Configure Rigidbody
rigidBody.useGravity = true;
rigidBody.interpolation = RigidbodyInterpolation.Interpolate;
rigidBody.collisionDetectionMode = CollisionDetectionMode.ContinuousSpeculative;
rigidBody.isKinematic = true;
// Freeze rotation on X and Z axes, but allow rotation on Y axis
rigidBody.constraints = RigidbodyConstraints.FreezeRotation;
#if UNITY_EDITOR
// For convenience in the examples, we use the GUID of the PlayerControllerUI
// to find the correct prefab in the Mirror/Examples/_Common/Controllers folder.
// This avoids conflicts with user-created prefabs that may have the same name
// and avoids polluting the user's project with Resources.
// This is not recommended for production code...use Resources.Load or AssetBundles instead.
if (ControllerUIPrefab == null)
{
string path = UnityEditor.AssetDatabase.GUIDToAssetPath("5caaf0d5754a64f4080f0c8b55c0b03d");
ControllerUIPrefab = UnityEditor.AssetDatabase.LoadAssetAtPath<GameObject>(path);
}
#endif
this.enabled = false;
}
void OnDisable()
{
runtimeData.horizontal = 0f;
runtimeData.vertical = 0f;
runtimeData.turnSpeed = 0f;
}
public override void OnStartAuthority()
{
// Calculate DPI-aware sensitivity
float dpiScale = (Screen.dpi > 0) ? (Screen.dpi / BASE_DPI) : 1f;
runtimeData.mouseSensitivity = turnAcceleration * dpiScale;
SetCursor(controlOptions.HasFlag(ControlOptions.MouseSteer));
rigidBody.isKinematic = false;
rigidBody.collisionDetectionMode = CollisionDetectionMode.Continuous;
this.enabled = true;
}
public override void OnStopAuthority()
{
this.enabled = false;
rigidBody.collisionDetectionMode = CollisionDetectionMode.ContinuousSpeculative;
rigidBody.isKinematic = true;
SetCursor(false);
}
public override void OnStartLocalPlayer()
{
if (ControllerUIPrefab != null)
runtimeData.controllerUI = Instantiate(ControllerUIPrefab);
if (runtimeData.controllerUI != null)
{
if (runtimeData.controllerUI.TryGetComponent(out PlayerControllerRBUI canvasControlPanel))
canvasControlPanel.Refresh(moveKeys, optionsKeys);
runtimeData.controllerUI.SetActive(controlOptions.HasFlag(ControlOptions.ShowUI));
}
}
public override void OnStopLocalPlayer()
{
if (runtimeData.controllerUI != null)
Destroy(runtimeData.controllerUI);
runtimeData.controllerUI = null;
}
#endregion
void Update()
{
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()
{
if (optionsKeys.MouseSteer != KeyCode.None && Input.GetKeyUp(optionsKeys.MouseSteer))
{
controlOptions ^= ControlOptions.MouseSteer;
SetCursor(controlOptions.HasFlag(ControlOptions.MouseSteer));
}
if (optionsKeys.AutoRun != KeyCode.None && Input.GetKeyUp(optionsKeys.AutoRun))
controlOptions ^= ControlOptions.AutoRun;
if (optionsKeys.ToggleUI != KeyCode.None && Input.GetKeyUp(optionsKeys.ToggleUI))
{
controlOptions ^= ControlOptions.ShowUI;
if (runtimeData.controllerUI != null)
runtimeData.controllerUI.SetActive(controlOptions.HasFlag(ControlOptions.ShowUI));
}
}
void SetCursor(bool locked)
{
Cursor.lockState = locked ? CursorLockMode.Locked : CursorLockMode.None;
Cursor.visible = !locked;
}
// Turning works while airborne...feature?
void HandleTurning(float deltaTime)
{
float targetTurnSpeed = 0f;
// TurnLeft and TurnRight cancel each other out, reducing targetTurnSpeed to zero.
if (moveKeys.TurnLeft != KeyCode.None && Input.GetKey(moveKeys.TurnLeft))
targetTurnSpeed -= maxTurnSpeed;
if (moveKeys.TurnRight != KeyCode.None && Input.GetKey(moveKeys.TurnRight))
targetTurnSpeed += maxTurnSpeed;
// 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 (targetTurnSpeed != 0f || !controlOptions.HasFlag(ControlOptions.AutoRun))
runtimeData.turnSpeed = Mathf.MoveTowards(runtimeData.turnSpeed, targetTurnSpeed, turnAcceleration * maxTurnSpeed * deltaTime);
//transform.Rotate(0f, runtimeData.turnSpeed * fixedDeltaTime, 0f);
transform.Rotate(transform.up, runtimeData.turnSpeed * deltaTime, Space.World);
}
void HandleMouseSteer(float deltaTime)
{
// Accumulate mouse input over time
runtimeData.mouseInputX += Input.GetAxisRaw("Mouse X") * runtimeData.mouseSensitivity;
// Clamp the accumulator to simulate key press behavior
runtimeData.mouseInputX = Mathf.Clamp(runtimeData.mouseInputX, -1f, 1f);
// Calculate target turn speed
float targetTurnSpeed = runtimeData.mouseInputX * maxTurnSpeed;
// Use the same acceleration logic as HandleTurning
runtimeData.turnSpeed = Mathf.MoveTowards(runtimeData.turnSpeed, targetTurnSpeed, runtimeData.mouseSensitivity * maxTurnSpeed * deltaTime);
// Apply rotation
//transform.Rotate(0f, runtimeData.turnSpeed * fixedDeltaTime, 0f);
transform.Rotate(transform.up, runtimeData.turnSpeed * deltaTime, Space.World);
runtimeData.mouseInputX = Mathf.MoveTowards(runtimeData.mouseInputX, 0f, runtimeData.mouseSensitivity * deltaTime);
}
void HandleJumping(float deltaTime)
{
if (runtimeData.groundState != GroundState.Falling && moveKeys.Jump != KeyCode.None && Input.GetKey(moveKeys.Jump))
{
if (runtimeData.groundState != GroundState.Jumping)
{
runtimeData.groundState = GroundState.Jumping;
runtimeData.jumpSpeed = initialJumpSpeed;
}
else if (runtimeData.jumpSpeed < maxJumpSpeed)
{
// Increase jumpSpeed using a square root function for a fast start and slow finish
float jumpProgress = (runtimeData.jumpSpeed - initialJumpSpeed) / (maxJumpSpeed - initialJumpSpeed);
runtimeData.jumpSpeed += (jumpAcceleration * Mathf.Sqrt(1 - jumpProgress)) * deltaTime;
}
if (runtimeData.jumpSpeed >= maxJumpSpeed)
{
runtimeData.jumpSpeed = maxJumpSpeed;
runtimeData.groundState = GroundState.Falling;
}
}
else if (runtimeData.groundState != GroundState.Grounded)
{
runtimeData.groundState = GroundState.Falling;
runtimeData.jumpSpeed = Mathf.Min(runtimeData.jumpSpeed, maxJumpSpeed);
runtimeData.jumpSpeed += Physics.gravity.y * deltaTime;
}
else
// maintain small downward speed for when falling off ledges
runtimeData.jumpSpeed = Physics.gravity.y * deltaTime;
}
void HandleMove(float deltaTime)
{
// Initialize target movement variables
float targetMoveX = 0f;
float targetMoveZ = 0f;
// Check for WASD key presses and adjust target movement variables accordingly
if (moveKeys.Forward != KeyCode.None && Input.GetKey(moveKeys.Forward)) targetMoveZ = 1f;
if (moveKeys.Back != KeyCode.None && Input.GetKey(moveKeys.Back)) targetMoveZ = -1f;
if (moveKeys.StrafeLeft != KeyCode.None && Input.GetKey(moveKeys.StrafeLeft)) targetMoveX = -1f;
if (moveKeys.StrafeRight != KeyCode.None && Input.GetKey(moveKeys.StrafeRight)) targetMoveX = 1f;
if (targetMoveX == 0f)
{
if (!controlOptions.HasFlag(ControlOptions.AutoRun))
runtimeData.horizontal = Mathf.MoveTowards(runtimeData.horizontal, targetMoveX, inputGravity * deltaTime);
}
else
runtimeData.horizontal = Mathf.MoveTowards(runtimeData.horizontal, targetMoveX, inputSensitivity * deltaTime);
if (targetMoveZ == 0f)
{
if (!controlOptions.HasFlag(ControlOptions.AutoRun))
runtimeData.vertical = Mathf.MoveTowards(runtimeData.vertical, targetMoveZ, inputGravity * deltaTime);
}
else
runtimeData.vertical = Mathf.MoveTowards(runtimeData.vertical, targetMoveZ, inputSensitivity * deltaTime);
}
void ApplyMove(float fixedDeltaTime)
{
// Handle horizontal movement
runtimeData.direction = new Vector3(runtimeData.horizontal, 0f, runtimeData.vertical);
runtimeData.direction = Vector3.ClampMagnitude(runtimeData.direction, 1f);
runtimeData.direction = transform.TransformDirection(runtimeData.direction);
runtimeData.direction *= maxMoveSpeed;
// Apply horizontal movement
rigidBody.MovePosition(rigidBody.position + runtimeData.direction * fixedDeltaTime);
// Handle vertical movement (jumping and gravity)
#if UNITY_6000_0_OR_NEWER
Vector3 verticalMovement = rigidBody.linearVelocity;
#else
Vector3 verticalMovement = rigidBody.velocity;
#endif
verticalMovement.y = runtimeData.jumpSpeed;
// Apply gravity
if (runtimeData.groundState != GroundState.Grounded)
verticalMovement.y += Physics.gravity.y * fixedDeltaTime;
// 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);
#endif
}
}
}

View File

@ -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:

View File

@ -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 { }
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0336d1bd689de45418c08c76ae66e503
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 7453abfe9e8b2c04a8a47eb536fe21eb, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,51 @@
using System;
using UnityEngine;
using UnityEngine.UI;
namespace Mirror.Examples.Common.Controllers.Player
{
[AddComponentMenu("")]
[DisallowMultipleComponent]
public class PlayerControllerRBUI : ControllerUIBase
{
[Serializable]
public struct MoveTexts
{
public Text keyTextTurnLeft;
public Text keyTextForward;
public Text keyTextTurnRight;
public Text keyTextStrafeLeft;
public Text keyTextBack;
public Text keyTextStrafeRight;
public Text keyTextJump;
}
[Serializable]
public struct OptionsTexts
{
public Text keyTextMouseSteer;
public Text keyTextAutoRun;
public Text keyTextToggleUI;
}
[SerializeField] MoveTexts moveTexts;
[SerializeField] OptionsTexts optionsTexts;
public void Refresh(PlayerControllerRBBase.MoveKeys moveKeys, PlayerControllerRBBase.OptionsKeys optionsKeys)
{
// Movement Keys
moveTexts.keyTextTurnLeft.text = GetKeyText(moveKeys.TurnLeft);
moveTexts.keyTextForward.text = GetKeyText(moveKeys.Forward);
moveTexts.keyTextTurnRight.text = GetKeyText(moveKeys.TurnRight);
moveTexts.keyTextStrafeLeft.text = GetKeyText(moveKeys.StrafeLeft);
moveTexts.keyTextBack.text = GetKeyText(moveKeys.Back);
moveTexts.keyTextStrafeRight.text = GetKeyText(moveKeys.StrafeRight);
moveTexts.keyTextJump.text = GetKeyText(moveKeys.Jump);
// Options Keys
optionsTexts.keyTextMouseSteer.text = GetKeyText(optionsKeys.MouseSteer);
optionsTexts.keyTextAutoRun.text = GetKeyText(optionsKeys.AutoRun);
optionsTexts.keyTextToggleUI.text = GetKeyText(optionsKeys.ToggleUI);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5b3ad79b59b8ecf4691d945429efae18
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 7453abfe9e8b2c04a8a47eb536fe21eb, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5caaf0d5754a64f4080f0c8b55c0b03d
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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 { }
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 60cbbdae6551c7b4395e1bd09e2ff3ea
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 7453abfe9e8b2c04a8a47eb536fe21eb, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -6,7 +6,7 @@ namespace Mirror.Examples.Common.Controllers.Tank
{
[AddComponentMenu("")]
[DisallowMultipleComponent]
public class TankControllerUI : ContollerUIBase
public class TankControllerUI : ControllerUIBase
{
[Serializable]
public struct MoveTexts

View File

@ -6,7 +6,7 @@ namespace Mirror.Examples.Common.Controllers.Tank
{
[AddComponentMenu("")]
[DisallowMultipleComponent]
public class TurretUI : ContollerUIBase
public class TurretUI : ControllerUIBase
{
[Serializable]
public struct MoveTexts

View File

@ -8,7 +8,7 @@ Material:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Robot_Color
m_Shader: {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
m_Shader: {fileID: 2, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
@ -24,7 +24,7 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 2800000, guid: a1454d7237641fa49a7f66d6bee624ad, type: 3}
m_Texture: {fileID: 2800000, guid: 7bf5087089ac3424a982003c10dda35f, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
@ -32,7 +32,7 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 1fbb41709a1d9334696860db720026e5, type: 3}
m_Texture: {fileID: 2800000, guid: fa652271323864a648c14b00ef5c677b, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 KiB

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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:

View 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;
}
}
}

View 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:

View File

@ -19,11 +19,6 @@ void Awake()
mainCam = Camera.main;
}
void OnDisable()
{
//Debug.Log("PlayerCamera.OnDisable");
}
public override void OnStartLocalPlayer()
{
if (mainCam != null)
@ -38,16 +33,46 @@ public override void OnStartLocalPlayer()
Debug.LogWarning("PlayerCamera: Could not find a camera in scene with 'MainCamera' tag.");
}
void OnApplicationQuit()
{
//Debug.Log("PlayerCamera.OnApplicationQuit");
ReleaseCamera();
}
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)
{
//Debug.Log("PlayerCamera.ReleaseCamera");
mainCam.transform.SetParent(null);
SceneManager.MoveGameObjectToScene(mainCam.gameObject, SceneManager.GetActiveScene());
mainCam.orthographic = true;
mainCam.orthographicSize = 15f;
mainCam.transform.localPosition = new Vector3(0f, 70f, 0f);
mainCam.transform.localEulerAngles = new Vector3(90f, 0f, 0f);
if (mainCam.gameObject.scene != SceneManager.GetActiveScene())
SceneManager.MoveGameObjectToScene(mainCam.gameObject, SceneManager.GetActiveScene());
mainCam = null;
}
}
}

View File

@ -21,8 +21,8 @@ void SetColor(Color32 _, Color32 newColor)
public override void OnStartServer()
{
// Only set the color once. Players may be respawned,
// and we don't want to keep changing their colors.
// Only set the color once. Players / objects may be unspawned and
// respawned and we don't want to keep changing their colors.
if (color == Color.black)
color = Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f);
}

Some files were not shown because too many files have changed in this diff Show More