diff --git a/unity/Assets/CroquetJS/guardians/Actors.js b/unity/Assets/CroquetJS/guardians/Actors.js index a06aadf..fd94198 100644 --- a/unity/Assets/CroquetJS/guardians/Actors.js +++ b/unity/Assets/CroquetJS/guardians/Actors.js @@ -4,7 +4,7 @@ // The flat world is placed on a Perlin noise generated surface in the view, but all interactions including // driving and collisions are computed in 2D. -import { Constants, Actor, mix, AM_Spatial, AM_Behavioral, v3_add, v3_sub, UserManager, User, AM_Avatar, q_axisAngle, v3_normalize, v3_rotate, AM_Grid, AM_OnGrid } from "@croquet/worldcore-kernel"; +import { Constants, Actor, mix, AM_Spatial, AM_Behavioral, AM_Drivable, v3_add, v3_sub, UserManager, User, q_axisAngle, v3_normalize, v3_rotate, AM_Grid, AM_OnGrid } from "@croquet/worldcore-kernel"; import { GameModelRoot } from "@croquet/game-models"; Constants.versionBump = 0; // change this to force model to be rebuilt @@ -243,10 +243,10 @@ MissileActor.register('MissileActor'); //------------------------------------------------------------------------------------------ //-- AvatarActor --------------------------------------------------------------------------- -// This is you. Most of the control code for the avatar is in the pawn in Avatar.js. +// This is you. Most of the control code for the avatar is on the C# side. //------------------------------------------------------------------------------------------ -class AvatarActor extends mix(Actor).with(AM_Spatial, AM_Avatar, AM_OnGrid) { +class AvatarActor extends mix(Actor).with(AM_Spatial, AM_Drivable, AM_OnGrid) { get pawn() { return "AvatarPawn" } get gamePawnType() { return "tank" } diff --git a/unity/Assets/Plugins.meta b/unity/Assets/Plugins.meta deleted file mode 100644 index af52ea3..0000000 --- a/unity/Assets/Plugins.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 6333dea60a7214dbd905da218f948b1d -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/unity/Assets/Plugins/websocket-sharp-LICENSE.txt b/unity/Assets/Plugins/websocket-sharp-LICENSE.txt deleted file mode 100644 index fb05297..0000000 --- a/unity/Assets/Plugins/websocket-sharp-LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2010-2023 sta.blockhead - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/unity/Assets/Plugins/websocket-sharp-LICENSE.txt.meta b/unity/Assets/Plugins/websocket-sharp-LICENSE.txt.meta deleted file mode 100644 index 8ce2326..0000000 --- a/unity/Assets/Plugins/websocket-sharp-LICENSE.txt.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 73d889852548945cbb08fc881d6e724a -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/unity/Assets/Plugins/websocket-sharp.dll b/unity/Assets/Plugins/websocket-sharp.dll deleted file mode 100644 index 27e2f7f..0000000 Binary files a/unity/Assets/Plugins/websocket-sharp.dll and /dev/null differ diff --git a/unity/Assets/Plugins/websocket-sharp.dll.meta b/unity/Assets/Plugins/websocket-sharp.dll.meta deleted file mode 100644 index 504b4c6..0000000 --- a/unity/Assets/Plugins/websocket-sharp.dll.meta +++ /dev/null @@ -1,33 +0,0 @@ -fileFormatVersion: 2 -guid: d071fe538cbd24bd5ab0d885e0b95290 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Any: - second: - enabled: 1 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - Windows Store Apps: WindowsStoreApps - second: - enabled: 0 - settings: - CPU: AnyCPU - userData: - assetBundleName: - assetBundleVariant: diff --git a/unity/Assets/Prefabs/Tank/Tank.prefab b/unity/Assets/Prefabs/Tank/Tank.prefab index f655131..386df2a 100644 --- a/unity/Assets/Prefabs/Tank/Tank.prefab +++ b/unity/Assets/Prefabs/Tank/Tank.prefab @@ -54,7 +54,7 @@ MonoBehaviour: defaultActorClass: mixins: - Smoothed - - Avatar + - Drivable staticProperties: - colorIndex watchedProperties: [] diff --git a/unity/Assets/Scenes/Guardians.unity b/unity/Assets/Scenes/Guardians.unity index 7952b9c..7833e96 100644 --- a/unity/Assets/Scenes/Guardians.unity +++ b/unity/Assets/Scenes/Guardians.unity @@ -322,7 +322,7 @@ GameObject: type: 3} m_PrefabInstance: {fileID: 1711147094} m_PrefabAsset: {fileID: 0} ---- !u!114 &127994058 +--- !u!114 &127994059 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -331,10 +331,10 @@ MonoBehaviour: m_GameObject: {fileID: 127994054} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 28b46b536afa74ea5aacf53a0241e66c, type: 3} + m_Script: {fileID: 11500000, guid: 7913adbd782fa42ceb85aef558596f54, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &127994059 +--- !u!114 &127994060 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -343,10 +343,10 @@ MonoBehaviour: m_GameObject: {fileID: 127994054} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7913adbd782fa42ceb85aef558596f54, type: 3} + m_Script: {fileID: 11500000, guid: e126d841f13fa49678dac14addec6e6e, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &127994060 +--- !u!114 &127994061 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -355,10 +355,12 @@ MonoBehaviour: m_GameObject: {fileID: 127994054} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: e126d841f13fa49678dac14addec6e6e, type: 3} + m_Script: {fileID: 11500000, guid: 102e0a86589084572930d87fc4be9b31, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &127994061 + assetManifestString: + addressablesReady: 0 +--- !u!114 &127994065 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -367,11 +369,9 @@ MonoBehaviour: m_GameObject: {fileID: 127994054} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 102e0a86589084572930d87fc4be9b31, type: 3} + m_Script: {fileID: 11500000, guid: 7a238f45135c044cfbbb9aebd81da8de, type: 3} m_Name: m_EditorClassIdentifier: - assetManifestString: - addressablesReady: 0 --- !u!1 &150207625 GameObject: m_ObjectHideFlags: 0 diff --git a/unity/Assets/Scenes/SessionChooser.unity b/unity/Assets/Scenes/SessionChooser.unity index 65341c7..95c6f0e 100644 --- a/unity/Assets/Scenes/SessionChooser.unity +++ b/unity/Assets/Scenes/SessionChooser.unity @@ -1297,7 +1297,7 @@ GameObject: type: 3} m_PrefabInstance: {fileID: 1305840559} m_PrefabAsset: {fileID: 0} ---- !u!114 &1305840561 +--- !u!114 &1305840562 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -1306,10 +1306,10 @@ MonoBehaviour: m_GameObject: {fileID: 1305840560} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 28b46b536afa74ea5aacf53a0241e66c, type: 3} + m_Script: {fileID: 11500000, guid: 7913adbd782fa42ceb85aef558596f54, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &1305840562 +--- !u!114 &1305840563 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -1318,10 +1318,10 @@ MonoBehaviour: m_GameObject: {fileID: 1305840560} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 7913adbd782fa42ceb85aef558596f54, type: 3} + m_Script: {fileID: 11500000, guid: e126d841f13fa49678dac14addec6e6e, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &1305840563 +--- !u!114 &1305840564 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -1330,10 +1330,12 @@ MonoBehaviour: m_GameObject: {fileID: 1305840560} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: e126d841f13fa49678dac14addec6e6e, type: 3} + m_Script: {fileID: 11500000, guid: 102e0a86589084572930d87fc4be9b31, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &1305840564 + assetManifestString: + addressablesReady: 0 +--- !u!114 &1305840565 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -1342,11 +1344,9 @@ MonoBehaviour: m_GameObject: {fileID: 1305840560} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 102e0a86589084572930d87fc4be9b31, type: 3} + m_Script: {fileID: 11500000, guid: 7a238f45135c044cfbbb9aebd81da8de, type: 3} m_Name: m_EditorClassIdentifier: - assetManifestString: - addressablesReady: 0 --- !u!1 &1947875638 GameObject: m_ObjectHideFlags: 0 diff --git a/unity/Assets/Scripts/AssignFollowCamTarget.cs b/unity/Assets/Scripts/AssignFollowCamTarget.cs index 30da0a1..370d9db 100644 --- a/unity/Assets/Scripts/AssignFollowCamTarget.cs +++ b/unity/Assets/Scripts/AssignFollowCamTarget.cs @@ -9,12 +9,24 @@ public class AssignFollowCamTarget : MonoBehaviour void Awake() { - Croquet.Subscribe("croquet", "sceneRunning", CroquetSceneRunning); + // in case the scene is reloaded, make sure the original camera lives on + // and that no duplicate camera - with duplicate subscriptions - is started up. + GameObject[] objs = GameObject.FindGameObjectsWithTag("MainCamera"); + if (objs.Length > 1) + { + Destroy(gameObject); + } + else + { + DontDestroyOnLoad(gameObject); + + Croquet.Subscribe("croquet", "sceneRunning", CroquetSceneRunning); + } } void Update() { - CroquetAvatarComponent a = CroquetAvatarSystem.Instance.GetActiveAvatarComponent(); + CroquetDrivableComponent a = CroquetDrivableSystem.Instance.GetActiveDrivableComponent(); if ( a != null) { diff --git a/unity/Assets/Scripts/RaiseAlignToTerrain.cs b/unity/Assets/Scripts/RaiseAlignToTerrain.cs index 0a6fc68..b53621d 100644 --- a/unity/Assets/Scripts/RaiseAlignToTerrain.cs +++ b/unity/Assets/Scripts/RaiseAlignToTerrain.cs @@ -96,7 +96,7 @@ void Align() if (objectIsStatic) { int croquetHandle = gameObject.GetComponent().croquetHandle; - CroquetSpatialSystem.Instance.SnapObjectTo(croquetHandle, transform.position, transform.rotation); + CroquetSpatialSystem.Instance.DrivePawn(croquetHandle, transform.position, transform.rotation); } } } diff --git a/unity/Assets/Scripts/moveAround.cs b/unity/Assets/Scripts/moveAround.cs index 214b66f..e9761f0 100644 --- a/unity/Assets/Scripts/moveAround.cs +++ b/unity/Assets/Scripts/moveAround.cs @@ -15,7 +15,7 @@ public class moveAround : MonoBehaviour, ICroquetDriven // private float computedSpeed; private int croquetHandle; - private CroquetAvatarComponent avatarComponent; + private CroquetDrivableComponent drivableComponent; private GameState gameState; private float lastShootTime = 0; @@ -34,12 +34,12 @@ void Start() public void PawnInitializationComplete() { croquetHandle = gameObject.GetComponent().croquetHandle; - avatarComponent = gameObject.GetComponent(); + drivableComponent = gameObject.GetComponent(); } void Update() { - if (avatarComponent == null) return; + if (drivableComponent == null) return; if (gameState == null) { @@ -52,7 +52,7 @@ void Update() if (gameState == null) return; } - if (CroquetAvatarSystem.Instance.GetActiveAvatarComponent() == avatarComponent && !gameState.gameEnded) + if (CroquetDrivableSystem.Instance.GetActiveDrivableComponent() == drivableComponent && !gameState.gameEnded) { // it's the active avatar, and we're live in a game - so perhaps moving, perhaps shooting float horizontal = Input.GetAxis("Horizontal"); @@ -73,8 +73,8 @@ void Update() AlignWithTerrain(); - CroquetSpatialSystem.Instance.SnapObjectTo(croquetHandle, transform.position, transform.rotation); - CroquetSpatialSystem.Instance.SnapObjectInCroquet(croquetHandle, transform.position, transform.rotation); + CroquetSpatialSystem.Instance.DrivePawn(croquetHandle, transform.position, transform.rotation); + CroquetSpatialSystem.Instance.DriveActor(croquetHandle, false, transform.position, transform.rotation); positionHasBeenInitialized = true; } diff --git a/unity/Packages/manifest.json b/unity/Packages/manifest.json index 7572c55..72d4f9f 100644 --- a/unity/Packages/manifest.json +++ b/unity/Packages/manifest.json @@ -4,8 +4,7 @@ "com.unity.addressables": "1.19.19", "com.unity.collab-proxy": "2.0.0", "com.unity.ide.rider": "3.0.18", - "com.unity.ide.visualstudio": "2.0.17", - "com.unity.ide.vscode": "1.2.5", + "com.unity.ide.visualstudio": "2.0.22", "com.unity.inputsystem": "1.5.0", "com.unity.postprocessing": "3.2.2", "com.unity.render-pipelines.universal": "12.1.10", @@ -15,7 +14,7 @@ "com.unity.toolchain.macos-arm64-linux-x86_64": "1.0.1", "com.unity.ugui": "1.0.0", "com.unity.visualscripting": "1.8.0", - "io.croquet.multiplayer": "https://github.com/croquet/croquet-for-unity-package.git#v0.9.0", + "io.croquet.multiplayer": "https://github.com/croquet/croquet-for-unity-package.git#v0.9.3", "net.gree.unity-webview": "https://github.com/gree/unity-webview.git?path=/dist/package-nofragment", "com.unity.modules.ai": "1.0.0", "com.unity.modules.androidjni": "1.0.0", diff --git a/unity/Packages/packages-lock.json b/unity/Packages/packages-lock.json index 1b5f99c..c028780 100644 --- a/unity/Packages/packages-lock.json +++ b/unity/Packages/packages-lock.json @@ -53,7 +53,7 @@ "url": "https://packages.unity.com" }, "com.unity.ide.visualstudio": { - "version": "2.0.17", + "version": "2.0.22", "depth": 0, "source": "registry", "dependencies": { @@ -61,13 +61,6 @@ }, "url": "https://packages.unity.com" }, - "com.unity.ide.vscode": { - "version": "1.2.5", - "depth": 0, - "source": "registry", - "dependencies": {}, - "url": "https://packages.unity.com" - }, "com.unity.inputsystem": { "version": "1.5.0", "depth": 0, @@ -215,21 +208,21 @@ "url": "https://packages.unity.com" }, "io.croquet.multiplayer": { - "version": "https://github.com/croquet/croquet-for-unity-package.git#v0.9.0", + "version": "https://github.com/croquet/croquet-for-unity-package.git#v0.9.3", "depth": 0, "source": "git", "dependencies": { "com.unity.addressables": "1.19.19", "com.unity.inputsystem": "1.5.0" }, - "hash": "9bddf70f2e43a0ef777ac04e8fcf6a15bfcc322e" + "hash": "bbee80e755e85fbc0ec84fe4d02682df676d650f" }, "net.gree.unity-webview": { "version": "https://github.com/gree/unity-webview.git?path=/dist/package-nofragment", "depth": 0, "source": "git", "dependencies": {}, - "hash": "3647674386e3c844aa416fc744905b8286c56616" + "hash": "ac07c49acc27e72b2939c4be70bd5d05b1308855" }, "com.unity.modules.ai": { "version": "1.0.0", diff --git a/unity/ProjectSettings/ProjectSettings.asset b/unity/ProjectSettings/ProjectSettings.asset index 830da6c..869d503 100644 --- a/unity/ProjectSettings/ProjectSettings.asset +++ b/unity/ProjectSettings/ProjectSettings.asset @@ -134,7 +134,7 @@ PlayerSettings: 16:10: 1 16:9: 1 Others: 1 - bundleVersion: 1.3 + bundleVersion: 1.4 preloadedAssets: [] metroInputSource: 0 wsaTransparentSwapchain: 0