From 3fdfff5e6ae5b2840e25f6f94f3d5acb1fd32696 Mon Sep 17 00:00:00 2001 From: SilasPeters <69711739+SilasPeters@users.noreply.github.com> Date: Sun, 23 Jun 2024 20:35:33 +0200 Subject: [PATCH 1/8] test: GamePlayTests --- .../Assets/Materials/Colors/Dark Blue Mat.mat | 2 +- .../Assets/Prefabs/Enemies/Melee Enemy.prefab | 26 +- .../Prefabs/Enemies/Ranged Enemy.prefab | 37 +- .../Prefabs/Enemies/Target Dummy.prefab | 32 +- .../Assets/Prefabs/Items/EndItem.prefab | 7 +- .../Assets/Prefabs/Items/HealthPotion.prefab | 23 +- .../Assets/Prefabs/Items/RagePotion.prefab | 27 +- .../Assets/Prefabs/Items/ammo.prefab | 17 +- .../Assets/Prefabs/Items/key_gold.prefab | 4 +- .../Assets/Prefabs/Items/key_silver.prefab | 4 +- .../Player/GameplayTestPlayer Variant.prefab | 128 ++ .../GameplayTestPlayer Variant.prefab.meta | 7 + aplib.net-demo/Assets/Scenes/Main.unity | 6 +- .../Scenes/TestScenes/GameplayTestScene.unity | 1578 +++++++++++++++++ .../TestScenes/GameplayTestScene.unity.meta | 7 + .../GameplayTestScene.meta} | 2 +- .../GameplayTestSceneGridConfig.asset | 19 + .../GameplayTestSceneGridConfig.asset.meta | 8 + .../GameplayTestSceneItems.asset | 21 + .../GameplayTestSceneItems.asset.meta | 8 + .../GameplayTestSceneSpawnableEnemies.asset | 19 + ...meplayTestSceneSpawnableEnemies.asset.meta | 8 + aplib.net-demo/Assets/Scripts/Doors/Door.cs | 2 +- .../Scripts/Entities/Enemy/AbstractEnemy.cs | 2 + .../Scripts/Entities/Player/PlayerLogic.cs | 1 + .../Scripts/Entities/Weapons/MeleeWeapon.cs | 2 + .../Scripts/Entities/Weapons/RangedWeapon.cs | 2 + .../Assets/Scripts/Inventory/AmmoPouch.cs | 2 + .../Assets/Scripts/Inventory/Inventory.cs | 9 +- .../Assets/Scripts/Inventory/KeyRing.cs | 2 +- .../Assets/Scripts/Items/BeforeDestroyKey.cs | 4 +- .../Assets/Scripts/Items/HealthPotion.cs | 1 + .../Testing/AplibTests/GameplayTests.cs | 615 +++++++ .../Testing/AplibTests/GameplayTests.cs.meta | 3 + .../ProjectSettings/EditorBuildSettings.asset | 3 + .../ProjectSettings/TagManager.asset | 4 +- 36 files changed, 2589 insertions(+), 53 deletions(-) create mode 100644 aplib.net-demo/Assets/Prefabs/Player/GameplayTestPlayer Variant.prefab create mode 100644 aplib.net-demo/Assets/Prefabs/Player/GameplayTestPlayer Variant.prefab.meta create mode 100644 aplib.net-demo/Assets/Scenes/TestScenes/GameplayTestScene.unity create mode 100644 aplib.net-demo/Assets/Scenes/TestScenes/GameplayTestScene.unity.meta rename aplib.net-demo/Assets/{Scenes/TestScenes/PathfindingTests.meta => ScriptableObjects/GameplayTestScene.meta} (77%) create mode 100644 aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneGridConfig.asset create mode 100644 aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneGridConfig.asset.meta create mode 100644 aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneItems.asset create mode 100644 aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneItems.asset.meta create mode 100644 aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneSpawnableEnemies.asset create mode 100644 aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneSpawnableEnemies.asset.meta create mode 100644 aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs create mode 100644 aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs.meta diff --git a/aplib.net-demo/Assets/Materials/Colors/Dark Blue Mat.mat b/aplib.net-demo/Assets/Materials/Colors/Dark Blue Mat.mat index 4866a0d7..3e9f3934 100644 --- a/aplib.net-demo/Assets/Materials/Colors/Dark Blue Mat.mat +++ b/aplib.net-demo/Assets/Materials/Colors/Dark Blue Mat.mat @@ -127,7 +127,7 @@ Material: - _ZWrite: 1 m_Colors: - _BaseColor: {r: 0.068629384, g: 0.45377085, b: 0.7132075, a: 1} - - _Color: {r: 0.06862936, g: 0.45377082, b: 0.7132074, a: 1} + - _Color: {r: 0.06862936, g: 0.45377082, b: 0.7132075, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} m_BuildTextureStacks: [] diff --git a/aplib.net-demo/Assets/Prefabs/Enemies/Melee Enemy.prefab b/aplib.net-demo/Assets/Prefabs/Enemies/Melee Enemy.prefab index f2cd8fa0..ee1bdb0a 100644 --- a/aplib.net-demo/Assets/Prefabs/Enemies/Melee Enemy.prefab +++ b/aplib.net-demo/Assets/Prefabs/Enemies/Melee Enemy.prefab @@ -12,7 +12,7 @@ GameObject: - component: {fileID: 1838458184815239845} - component: {fileID: 6516424735887955547} - component: {fileID: 4699750310654139305} - m_Layer: 0 + m_Layer: 9 m_Name: Backpack m_TagString: Untagged m_Icon: {fileID: 0} @@ -114,7 +114,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 3212545280367042832} - m_Layer: 0 + m_Layer: 9 m_Name: Melee Enemy m_TagString: Enemy m_Icon: {fileID: 0} @@ -150,7 +150,7 @@ GameObject: - component: {fileID: 2782046694569076020} - component: {fileID: 642655613463434214} - component: {fileID: 651504648538957622} - m_Layer: 0 + m_Layer: 9 m_Name: Helmet m_TagString: Untagged m_Icon: {fileID: 0} @@ -256,7 +256,7 @@ GameObject: - component: {fileID: 5602802504363056583} - component: {fileID: 7899826361134525688} - component: {fileID: 8053776582894441421} - m_Layer: 0 + m_Layer: 9 m_Name: Body m_TagString: Untagged m_Icon: {fileID: 0} @@ -339,7 +339,7 @@ GameObject: - component: {fileID: 2421439936109808733} - component: {fileID: 7470707171072187346} - component: {fileID: 1453002998476168155} - m_Layer: 0 + m_Layer: 9 m_Name: Visor m_TagString: Enemy m_Icon: {fileID: 0} @@ -432,7 +432,7 @@ GameObject: - component: {fileID: 3100105480385092635} - component: {fileID: 756077488521599464} - component: {fileID: 230777658592993480} - m_Layer: 0 + m_Layer: 9 m_Name: Melee Enemy Body m_TagString: Enemy m_Icon: {fileID: 0} @@ -777,7 +777,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 434714157860638611} - m_Layer: 0 + m_Layer: 9 m_Name: Visual m_TagString: Untagged m_Icon: {fileID: 0} @@ -813,7 +813,7 @@ GameObject: m_Component: - component: {fileID: 8182048024137378992} - component: {fileID: 4796441169114859087} - m_Layer: 0 + m_Layer: 9 m_Name: Spawn Area m_TagString: Untagged m_Icon: {fileID: 0} @@ -860,11 +860,21 @@ PrefabInstance: propertyPath: m_Name value: MeleeWeapon objectReference: {fileID: 0} + - target: {fileID: 2293369615819988566, guid: c935b7bf63614054ea51bfd5123b9904, + type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} - target: {fileID: 4693412011037971015, guid: c935b7bf63614054ea51bfd5123b9904, type: 3} propertyPath: _entitySound value: objectReference: {fileID: 7116717931493397264} + - target: {fileID: 5064525661200628015, guid: c935b7bf63614054ea51bfd5123b9904, + type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} - target: {fileID: 7069036620070996254, guid: c935b7bf63614054ea51bfd5123b9904, type: 3} propertyPath: m_LocalPosition.x diff --git a/aplib.net-demo/Assets/Prefabs/Enemies/Ranged Enemy.prefab b/aplib.net-demo/Assets/Prefabs/Enemies/Ranged Enemy.prefab index 3bb5ea8c..c9bed01f 100644 --- a/aplib.net-demo/Assets/Prefabs/Enemies/Ranged Enemy.prefab +++ b/aplib.net-demo/Assets/Prefabs/Enemies/Ranged Enemy.prefab @@ -9,7 +9,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 3696028094173018888} - m_Layer: 0 + m_Layer: 9 m_Name: Visual m_TagString: Untagged m_Icon: {fileID: 0} @@ -46,7 +46,7 @@ GameObject: - component: {fileID: 941527993150852492} - component: {fileID: 7978339044951059778} - component: {fileID: 1558264426942698920} - m_Layer: 0 + m_Layer: 9 m_Name: Backpack m_TagString: Enemy m_Icon: {fileID: 0} @@ -149,7 +149,7 @@ GameObject: m_Component: - component: {fileID: 6903289118291040228} - component: {fileID: 3563055558079486355} - m_Layer: 7 + m_Layer: 9 m_Name: SpawnArea m_TagString: Untagged m_Icon: {fileID: 0} @@ -194,7 +194,7 @@ GameObject: - component: {fileID: 5864263658997149716} - component: {fileID: 8636375922128820597} - component: {fileID: 7138030975460049954} - m_Layer: 0 + m_Layer: 9 m_Name: Body m_TagString: Untagged m_Icon: {fileID: 0} @@ -287,7 +287,7 @@ GameObject: - component: {fileID: 3754003638518537202} - component: {fileID: 2502524366878355291} - component: {fileID: 142685328840719027} - m_Layer: 0 + m_Layer: 9 m_Name: Ranged Enemy Body m_TagString: Enemy m_Icon: {fileID: 0} @@ -632,7 +632,7 @@ GameObject: m_Component: - component: {fileID: 8488767769105598618} - component: {fileID: 1948759600369383589} - m_Layer: 0 + m_Layer: 9 m_Name: EnemyAmmoPouch m_TagString: Untagged m_Icon: {fileID: 0} @@ -667,6 +667,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: maxAmmoCount: 2000 + _currentAmmoCount: 0 --- !u!1 &6630535104659245811 GameObject: m_ObjectHideFlags: 0 @@ -678,7 +679,7 @@ GameObject: - component: {fileID: 8164520581160558319} - component: {fileID: 8552330508886415421} - component: {fileID: 2271626697261335243} - m_Layer: 0 + m_Layer: 9 m_Name: Visor m_TagString: Enemy m_Icon: {fileID: 0} @@ -759,7 +760,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1714929719199334556} - m_Layer: 0 + m_Layer: 9 m_Name: Ranged Enemy m_TagString: Enemy m_Icon: {fileID: 0} @@ -797,6 +798,16 @@ PrefabInstance: propertyPath: m_Name value: Crossbow objectReference: {fileID: 0} + - target: {fileID: 91225418248312668, guid: a32b9718dd054174cb328e71472939bb, + type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 263138273581502346, guid: a32b9718dd054174cb328e71472939bb, + type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} - target: {fileID: 3765763061320875848, guid: a32b9718dd054174cb328e71472939bb, type: 3} propertyPath: m_LocalPosition.x @@ -877,6 +888,16 @@ PrefabInstance: propertyPath: _entitySound value: objectReference: {fileID: 5007256389150739156} + - target: {fileID: 7857465376940653296, guid: a32b9718dd054174cb328e71472939bb, + type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} + - target: {fileID: 8898976936436749179, guid: a32b9718dd054174cb328e71472939bb, + type: 3} + propertyPath: m_Layer + value: 9 + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] diff --git a/aplib.net-demo/Assets/Prefabs/Enemies/Target Dummy.prefab b/aplib.net-demo/Assets/Prefabs/Enemies/Target Dummy.prefab index 07b75ed2..2ee59c6f 100644 --- a/aplib.net-demo/Assets/Prefabs/Enemies/Target Dummy.prefab +++ b/aplib.net-demo/Assets/Prefabs/Enemies/Target Dummy.prefab @@ -12,7 +12,7 @@ GameObject: - component: {fileID: 941527993150852492} - component: {fileID: 7978339044951059778} - component: {fileID: 1558264426942698920} - m_Layer: 0 + m_Layer: 9 m_Name: Backpack m_TagString: Untagged m_Icon: {fileID: 0} @@ -115,7 +115,7 @@ GameObject: m_Component: - component: {fileID: 6903289118291040228} - component: {fileID: 3563055558079486355} - m_Layer: 7 + m_Layer: 9 m_Name: SpawnArea m_TagString: Untagged m_Icon: {fileID: 0} @@ -170,7 +170,8 @@ GameObject: - component: {fileID: 3330466833410674930} - component: {fileID: 98459274967107310} - component: {fileID: 4500473103708748035} - m_Layer: 0 + - component: {fileID: 142685328840719027} + m_Layer: 9 m_Name: Target Dummy Body m_TagString: Enemy m_Icon: {fileID: 0} @@ -517,6 +518,27 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: _pointAmount: 15 +--- !u!95 &142685328840719027 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5361096258398959275} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 0} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 --- !u!1 &6630535104659245811 GameObject: m_ObjectHideFlags: 0 @@ -528,7 +550,7 @@ GameObject: - component: {fileID: 8164520581160558319} - component: {fileID: 8552330508886415421} - component: {fileID: 2271626697261335243} - m_Layer: 0 + m_Layer: 9 m_Name: Visor m_TagString: Enemy m_Icon: {fileID: 0} @@ -609,7 +631,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1714929719199334556} - m_Layer: 0 + m_Layer: 9 m_Name: Target Dummy m_TagString: Enemy m_Icon: {fileID: 0} diff --git a/aplib.net-demo/Assets/Prefabs/Items/EndItem.prefab b/aplib.net-demo/Assets/Prefabs/Items/EndItem.prefab index 1d7413e8..9a2f86b1 100644 --- a/aplib.net-demo/Assets/Prefabs/Items/EndItem.prefab +++ b/aplib.net-demo/Assets/Prefabs/Items/EndItem.prefab @@ -14,7 +14,7 @@ GameObject: - component: {fileID: 6476791847648061540} - component: {fileID: 8353329355836069700} - component: {fileID: 1579793037850114028} - m_Layer: 0 + m_Layer: 8 m_Name: EndItem m_TagString: Untagged m_Icon: {fileID: 0} @@ -197,6 +197,11 @@ PrefabInstance: propertyPath: m_Name value: bottle objectReference: {fileID: 0} + - target: {fileID: 919132149155446097, guid: 1575f63c98da02142b31eee0b014b4bd, + type: 3} + propertyPath: m_Layer + value: 8 + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] diff --git a/aplib.net-demo/Assets/Prefabs/Items/HealthPotion.prefab b/aplib.net-demo/Assets/Prefabs/Items/HealthPotion.prefab index a5f2b97f..06b968a6 100644 --- a/aplib.net-demo/Assets/Prefabs/Items/HealthPotion.prefab +++ b/aplib.net-demo/Assets/Prefabs/Items/HealthPotion.prefab @@ -13,7 +13,7 @@ GameObject: - component: {fileID: 6644890811013382080} - component: {fileID: 4103969277828004525} - component: {fileID: 5869530656772040234} - m_Layer: 0 + m_Layer: 8 m_Name: HealthPotion m_TagString: Untagged m_Icon: {fileID: 0} @@ -115,7 +115,7 @@ GameObject: - component: {fileID: 6670878522597935835} - component: {fileID: 8999004444325526567} - component: {fileID: 4987933222704678392} - m_Layer: 0 + m_Layer: 8 m_Name: Sphere m_TagString: Untagged m_Icon: {fileID: 0} @@ -196,7 +196,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 7171588121974554467} - m_Layer: 0 + m_Layer: 8 m_Name: Visual m_TagString: Untagged m_Icon: {fileID: 0} @@ -232,7 +232,7 @@ GameObject: - component: {fileID: 7773310571775737343} - component: {fileID: 2428910288225605675} - component: {fileID: 2429067011553723039} - m_Layer: 0 + m_Layer: 8 m_Name: Cylinder m_TagString: Untagged m_Icon: {fileID: 0} @@ -317,6 +317,11 @@ PrefabInstance: propertyPath: m_LocalPosition.y value: -1.49 objectReference: {fileID: 0} + - target: {fileID: 2535984516990917545, guid: 87c08e6a1147c904688ab4d0293a148f, + type: 3} + propertyPath: m_Layer + value: 8 + objectReference: {fileID: 0} - target: {fileID: 6140845518465948779, guid: 87c08e6a1147c904688ab4d0293a148f, type: 3} propertyPath: InitialModule.startColor.maxColor.b @@ -337,6 +342,11 @@ PrefabInstance: propertyPath: m_Name value: Sparkle objectReference: {fileID: 0} + - target: {fileID: 6891417323614499024, guid: 87c08e6a1147c904688ab4d0293a148f, + type: 3} + propertyPath: m_Layer + value: 8 + objectReference: {fileID: 0} - target: {fileID: 7703119434909318981, guid: 87c08e6a1147c904688ab4d0293a148f, type: 3} propertyPath: InitialModule.startColor.maxColor.b @@ -352,6 +362,11 @@ PrefabInstance: propertyPath: InitialModule.startColor.maxColor.r value: 0.9811321 objectReference: {fileID: 0} + - target: {fileID: 7774401939041117516, guid: 87c08e6a1147c904688ab4d0293a148f, + type: 3} + propertyPath: m_Layer + value: 8 + objectReference: {fileID: 0} - target: {fileID: 8890594247681875335, guid: 87c08e6a1147c904688ab4d0293a148f, type: 3} propertyPath: m_LocalPosition.x diff --git a/aplib.net-demo/Assets/Prefabs/Items/RagePotion.prefab b/aplib.net-demo/Assets/Prefabs/Items/RagePotion.prefab index 187a80a7..aff0f6d5 100644 --- a/aplib.net-demo/Assets/Prefabs/Items/RagePotion.prefab +++ b/aplib.net-demo/Assets/Prefabs/Items/RagePotion.prefab @@ -9,7 +9,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 236269495344624752} - m_Layer: 0 + m_Layer: 8 m_Name: Visual m_TagString: Untagged m_Icon: {fileID: 0} @@ -47,7 +47,7 @@ GameObject: - component: {fileID: 7254837903529196898} - component: {fileID: 651583779531181676} - component: {fileID: 311518670303769755} - m_Layer: 0 + m_Layer: 8 m_Name: RagePotion m_TagString: Untagged m_Icon: {fileID: 0} @@ -99,10 +99,10 @@ MonoBehaviour: usesAddedPerPickup: 1 stackable: 1 iconTexture: {fileID: 2800000, guid: 8776ae5840f8fa34a9cbccde118a7447, type: 3} + k__BackingField: 100 + k__BackingField: 3 _rageEffect: {fileID: 3304836780114962783, guid: 3d4710cf4b8c52043810ead0a07ac077, type: 3} - _damageIncreasePercentage: 100 - _duration: 5 --- !u!136 &651583779531181676 CapsuleCollider: m_ObjectHideFlags: 0 @@ -150,7 +150,7 @@ GameObject: - component: {fileID: 834675318684735680} - component: {fileID: 3117512285125855760} - component: {fileID: 5766229891270093329} - m_Layer: 0 + m_Layer: 8 m_Name: Sphere m_TagString: Untagged m_Icon: {fileID: 0} @@ -233,7 +233,7 @@ GameObject: - component: {fileID: 8877922690678864324} - component: {fileID: 242196645751314309} - component: {fileID: 3826728026736348835} - m_Layer: 0 + m_Layer: 8 m_Name: Cylinder m_TagString: Untagged m_Icon: {fileID: 0} @@ -313,11 +313,21 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 236269495344624752} m_Modifications: + - target: {fileID: 784051329186727236, guid: e4f79bfb2b941f24593e90489f32f65a, + type: 3} + propertyPath: m_Layer + value: 8 + objectReference: {fileID: 0} - target: {fileID: 3304836780114962783, guid: e4f79bfb2b941f24593e90489f32f65a, type: 3} propertyPath: m_Name value: Rage Potion Effect objectReference: {fileID: 0} + - target: {fileID: 3304836780114962783, guid: e4f79bfb2b941f24593e90489f32f65a, + type: 3} + propertyPath: m_Layer + value: 8 + objectReference: {fileID: 0} - target: {fileID: 3442880854253061514, guid: e4f79bfb2b941f24593e90489f32f65a, type: 3} propertyPath: looping @@ -373,6 +383,11 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 4001595041567843263, guid: e4f79bfb2b941f24593e90489f32f65a, + type: 3} + propertyPath: m_Layer + value: 8 + objectReference: {fileID: 0} - target: {fileID: 4999304191273588321, guid: e4f79bfb2b941f24593e90489f32f65a, type: 3} propertyPath: looping diff --git a/aplib.net-demo/Assets/Prefabs/Items/ammo.prefab b/aplib.net-demo/Assets/Prefabs/Items/ammo.prefab index 8d0c8ba9..17dec68b 100644 --- a/aplib.net-demo/Assets/Prefabs/Items/ammo.prefab +++ b/aplib.net-demo/Assets/Prefabs/Items/ammo.prefab @@ -12,7 +12,7 @@ GameObject: - component: {fileID: 613643261442037262} - component: {fileID: 8493416388406199735} - component: {fileID: 5496850465089770890} - m_Layer: 0 + m_Layer: 8 m_Name: ammo m_TagString: Untagged m_Icon: {fileID: 0} @@ -165,11 +165,26 @@ PrefabInstance: propertyPath: m_ConstrainProportionsScale value: 1 objectReference: {fileID: 0} + - target: {fileID: -910168554888888556, guid: 285b1f302aa1d3b4fae59dab02c0bba3, + type: 3} + propertyPath: m_Layer + value: 8 + objectReference: {fileID: 0} - target: {fileID: 919132149155446097, guid: 285b1f302aa1d3b4fae59dab02c0bba3, type: 3} propertyPath: m_Name value: ammo_sniper objectReference: {fileID: 0} + - target: {fileID: 919132149155446097, guid: 285b1f302aa1d3b4fae59dab02c0bba3, + type: 3} + propertyPath: m_Layer + value: 8 + objectReference: {fileID: 0} + - target: {fileID: 4607668393258877731, guid: 285b1f302aa1d3b4fae59dab02c0bba3, + type: 3} + propertyPath: m_Layer + value: 8 + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] diff --git a/aplib.net-demo/Assets/Prefabs/Items/key_gold.prefab b/aplib.net-demo/Assets/Prefabs/Items/key_gold.prefab index 486e5741..5b2db529 100644 --- a/aplib.net-demo/Assets/Prefabs/Items/key_gold.prefab +++ b/aplib.net-demo/Assets/Prefabs/Items/key_gold.prefab @@ -15,7 +15,7 @@ GameObject: - component: {fileID: 4679408664850541634} - component: {fileID: 5177959914744329809} - component: {fileID: 8840974988088408524} - m_Layer: 0 + m_Layer: 8 m_Name: pPlane3 m_TagString: Key m_Icon: {fileID: 0} @@ -159,7 +159,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 462124} - m_Layer: 0 + m_Layer: 8 m_Name: key_gold m_TagString: Untagged m_Icon: {fileID: 0} diff --git a/aplib.net-demo/Assets/Prefabs/Items/key_silver.prefab b/aplib.net-demo/Assets/Prefabs/Items/key_silver.prefab index 290cf345..71947d70 100644 --- a/aplib.net-demo/Assets/Prefabs/Items/key_silver.prefab +++ b/aplib.net-demo/Assets/Prefabs/Items/key_silver.prefab @@ -15,7 +15,7 @@ GameObject: - component: {fileID: 6409961272102491702} - component: {fileID: 7006872941668042291} - component: {fileID: 7992882045921714637} - m_Layer: 0 + m_Layer: 8 m_Name: pPlane3 m_TagString: Key m_Icon: {fileID: 0} @@ -159,7 +159,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 469694} - m_Layer: 0 + m_Layer: 8 m_Name: key_silver m_TagString: Untagged m_Icon: {fileID: 0} diff --git a/aplib.net-demo/Assets/Prefabs/Player/GameplayTestPlayer Variant.prefab b/aplib.net-demo/Assets/Prefabs/Player/GameplayTestPlayer Variant.prefab new file mode 100644 index 00000000..27f0b194 --- /dev/null +++ b/aplib.net-demo/Assets/Prefabs/Player/GameplayTestPlayer Variant.prefab @@ -0,0 +1,128 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &4687173262610002045 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 298035875008089756, guid: 6de475068fb9685f5b9e0d862a17164d, + type: 3} + propertyPath: _respawnPointTransform + value: + objectReference: {fileID: 0} + - target: {fileID: 2494580339719843002, guid: 6de475068fb9685f5b9e0d862a17164d, + type: 3} + propertyPath: m_LocalPosition.y + value: 0.31 + objectReference: {fileID: 0} + - target: {fileID: 2921083464024424325, guid: 6de475068fb9685f5b9e0d862a17164d, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2921083464024424325, guid: 6de475068fb9685f5b9e0d862a17164d, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2921083464024424325, guid: 6de475068fb9685f5b9e0d862a17164d, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2921083464024424325, guid: 6de475068fb9685f5b9e0d862a17164d, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2921083464024424325, guid: 6de475068fb9685f5b9e0d862a17164d, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2921083464024424325, guid: 6de475068fb9685f5b9e0d862a17164d, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2921083464024424325, guid: 6de475068fb9685f5b9e0d862a17164d, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2921083464024424325, guid: 6de475068fb9685f5b9e0d862a17164d, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2921083464024424325, guid: 6de475068fb9685f5b9e0d862a17164d, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2921083464024424325, guid: 6de475068fb9685f5b9e0d862a17164d, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3723996573660343771, guid: 6de475068fb9685f5b9e0d862a17164d, + type: 3} + propertyPath: m_Layer + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4910639222740258081, guid: 6de475068fb9685f5b9e0d862a17164d, + type: 3} + propertyPath: m_Layer + value: 7 + objectReference: {fileID: 0} + - target: {fileID: 5310360537016108786, guid: 6de475068fb9685f5b9e0d862a17164d, + type: 3} + propertyPath: _respawnOnDeath + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7094757464770899253, guid: 6de475068fb9685f5b9e0d862a17164d, + type: 3} + propertyPath: m_Layer + value: 7 + objectReference: {fileID: 0} + - target: {fileID: 7716492017067657420, guid: 6de475068fb9685f5b9e0d862a17164d, + type: 3} + propertyPath: m_Name + value: GameplayTestPlayer Variant + objectReference: {fileID: 0} + - target: {fileID: 8219978807336969005, guid: 6de475068fb9685f5b9e0d862a17164d, + type: 3} + propertyPath: m_Layer + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: + - {fileID: 9043309328163239787, guid: 6de475068fb9685f5b9e0d862a17164d, type: 3} + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 7716492017067657420, guid: 6de475068fb9685f5b9e0d862a17164d, + type: 3} + insertIndex: -1 + addedObject: {fileID: 9189447023483187060} + m_SourcePrefab: {fileID: 100100000, guid: 6de475068fb9685f5b9e0d862a17164d, type: 3} +--- !u!1 &3033829265845483697 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 7716492017067657420, guid: 6de475068fb9685f5b9e0d862a17164d, + type: 3} + m_PrefabInstance: {fileID: 4687173262610002045} + m_PrefabAsset: {fileID: 0} +--- !u!114 &9189447023483187060 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3033829265845483697} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c40037f0467b7354cb74596b58e852e9, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/aplib.net-demo/Assets/Prefabs/Player/GameplayTestPlayer Variant.prefab.meta b/aplib.net-demo/Assets/Prefabs/Player/GameplayTestPlayer Variant.prefab.meta new file mode 100644 index 00000000..8e229508 --- /dev/null +++ b/aplib.net-demo/Assets/Prefabs/Player/GameplayTestPlayer Variant.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: daa471e72a9a4461d8931f3af139c914 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/aplib.net-demo/Assets/Scenes/Main.unity b/aplib.net-demo/Assets/Scenes/Main.unity index d29dfc92..d8403073 100644 --- a/aplib.net-demo/Assets/Scenes/Main.unity +++ b/aplib.net-demo/Assets/Scenes/Main.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1} + m_IndirectSpecularColor: {r: 0.18029143, g: 0.22572419, b: 0.30693057, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -175,7 +175,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: emptyInventoryImage: {fileID: 2800000, guid: 8d003bcfe1c8c044893bf31bdf72fba7, type: 3} - inventoryObject: {fileID: 134152953} _inventorySize: 4 --- !u!114 &134152956 MonoBehaviour: @@ -225,6 +224,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: maxAmmoCount: 0 + _currentAmmoCount: 0 --- !u!1 &276800704 GameObject: m_ObjectHideFlags: 0 @@ -1537,7 +1537,7 @@ Camera: m_Depth: -1 m_CullingMask: serializedVersion: 2 - m_Bits: 119 + m_Bits: 887 m_RenderingPath: -1 m_TargetTexture: {fileID: 0} m_TargetDisplay: 0 diff --git a/aplib.net-demo/Assets/Scenes/TestScenes/GameplayTestScene.unity b/aplib.net-demo/Assets/Scenes/TestScenes/GameplayTestScene.unity new file mode 100644 index 00000000..29dd29f5 --- /dev/null +++ b/aplib.net-demo/Assets/Scenes/TestScenes/GameplayTestScene.unity @@ -0,0 +1,1578 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.18029143, g: 0.22572419, b: 0.30693057, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + 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: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 3 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + buildHeightMesh: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &134152953 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 134152954} + - component: {fileID: 134152957} + - component: {fileID: 134152956} + - component: {fileID: 134152955} + - component: {fileID: 134152958} + m_Layer: 5 + m_Name: InventoryObject + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &134152954 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 134152953} + 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: 1151453251} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.05, y: 0.1} + m_AnchorMax: {x: 0.05, y: 0.1} + m_AnchoredPosition: {x: 65, y: 30} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &134152955 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 134152953} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 85e7a85c2cfe201479ec25b65f90f668, type: 3} + m_Name: + m_EditorClassIdentifier: + emptyInventoryImage: {fileID: 2800000, guid: 8d003bcfe1c8c044893bf31bdf72fba7, type: 3} + _inventorySize: 4 +--- !u!114 &134152956 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 134152953} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: + 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: + m_Calls: [] + m_Texture: {fileID: 0} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 +--- !u!222 &134152957 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 134152953} + m_CullTransparentMesh: 1 +--- !u!114 &134152958 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 134152953} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3c43b04ec1fb42d99a32ba831149d1ad, type: 3} + m_Name: + m_EditorClassIdentifier: + maxAmmoCount: 0 + _currentAmmoCount: 0 +--- !u!1 &276800704 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 276800705} + - component: {fileID: 276800707} + - component: {fileID: 276800706} + m_Layer: 5 + m_Name: Horizontal + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &276800705 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 276800704} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.23, y: 0.04, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1515546305} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &276800706 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 276800704} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19245279, g: 0.19245279, b: 0.19245279, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &276800707 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 276800704} + m_CullTransparentMesh: 1 +--- !u!1 &343009575 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 343009577} + - component: {fileID: 343009576} + m_Layer: 0 + m_Name: Spawn Area + m_TagString: Respawn + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &343009576 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 343009575} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0ae00a4f201e1f04fb8326947466f4d9, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &343009577 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 343009575} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 1.73, z: 0} + m_LocalScale: {x: 3, y: 1.5099, z: 3} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &400258524 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 400258525} + - component: {fileID: 400258526} + m_Layer: 5 + m_Name: KeyRingObject + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &400258525 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 400258524} + 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: 1151453251} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -439.49997, y: -217.33331} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &400258526 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 400258524} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 50faf2387a65b49408705dcb20039fbb, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &410545195 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 410545198} + - component: {fileID: 410545197} + m_Layer: 0 + m_Name: Environment + m_TagString: Environment + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &410545197 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 410545195} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7a5ac11cc976e418e8d13136b07e1f52, type: 3} + m_Name: + m_EditorClassIdentifier: + m_AgentTypeID: 0 + m_CollectObjects: 0 + m_Size: {x: 10, y: 10, z: 10} + m_Center: {x: 0, y: 2, z: 0} + m_LayerMask: + serializedVersion: 2 + m_Bits: 64 + m_UseGeometry: 1 + m_DefaultArea: 0 + m_GenerateLinks: 0 + m_IgnoreNavMeshAgent: 1 + m_IgnoreNavMeshObstacle: 1 + m_OverrideTileSize: 0 + m_TileSize: 256 + m_OverrideVoxelSize: 0 + m_VoxelSize: 0.33333334 + m_MinRegionArea: 2 + m_NavMeshData: {fileID: 0} + m_BuildHeightMesh: 0 +--- !u!4 &410545198 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 410545195} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 22.48278, y: -13.592977, z: 34.27834} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 773537169} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &533088676 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 533088679} + - component: {fileID: 533088678} + - component: {fileID: 533088677} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &533088677 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 533088676} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Version: 3 + m_UsePipelineSettings: 1 + m_AdditionalLightsShadowResolutionTier: 2 + m_LightLayerMask: 1 + m_RenderingLayers: 1 + m_CustomShadowLayers: 0 + m_ShadowLayerMask: 1 + m_ShadowRenderingLayers: 1 + m_LightCookieSize: {x: 1, y: 1} + m_LightCookieOffset: {x: 0, y: 0} + m_SoftShadowQuality: 0 +--- !u!108 &533088678 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 533088676} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + 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 &533088679 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 533088676} + serializedVersion: 2 + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &773537168 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 773537169} + - component: {fileID: 773537170} + - component: {fileID: 773537174} + - component: {fileID: 773537173} + - component: {fileID: 773537172} + - component: {fileID: 773537171} + m_Layer: 0 + m_Name: LevelGeneration + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &773537169 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 773537168} + 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: 410545198} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &773537170 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 773537168} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7fb243c2a22e4440b79804abb380999b, type: 3} + m_Name: + m_EditorClassIdentifier: + _gridConfig: {fileID: 11400000, guid: 2c3eb6cef5158fed19828ffaf389558a, type: 2} + _startRoomMat: {fileID: 2100000, guid: f778c1623601f9a49bae03f91296af4f, type: 2} +--- !u!114 &773537171 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 773537168} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 535fefb0b92d5a344b634ca0a3472e01, type: 3} + m_Name: + m_EditorClassIdentifier: + _spawnableEnemies: {fileID: 11400000, guid: 40e49307d90b9f18584860020252be7e, type: 2} +--- !u!114 &773537172 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 773537168} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4cac02a263e74762b9ef9d6d43fd7b85, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &773537173 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 773537168} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8366bd27287d4220a09e6d3e8d715bbe, type: 3} + m_Name: + m_EditorClassIdentifier: + _roomObjects: {fileID: 11400000, guid: 9962865d7cc12a74abe02efdb8b7d072, type: 2} + _spawnableItems: {fileID: 11400000, guid: c2fd3fee1a07b770bbeb9303a1403a48, type: 2} + _doorPrefab: {fileID: 5163913735208331690, guid: 68173a35499684249a46fbd42c360c6c, + type: 3} + _keyPrefab: {fileID: 155280, guid: 41d1cac196452694fb10f2476db79e6e, type: 3} + _teleporterPrefab: {fileID: 4524489543751428694, guid: 1c88f3319232dace09ca6eab36996fbc, + type: 3} + _endItemPrefab: {fileID: 7440915271667399624, guid: 5dee1bd433f382645b25c03046c94f10, + type: 3} + _endRoomMat: {fileID: 2100000, guid: d8e9a1c487e0d7d4c881fce470e9d9a8, type: 2} +--- !u!114 &773537174 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 773537168} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5b442616a9cd449993876de7096f51bc, type: 3} + m_Name: + m_EditorClassIdentifier: + k__BackingField: 16 + k__BackingField: 16 +--- !u!1 &953365985 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 953365987} + - component: {fileID: 953365988} + - component: {fileID: 953365989} + m_Layer: 0 + m_Name: Win Area + m_TagString: Win + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &953365987 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 953365985} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: 0} + m_LocalScale: {x: 16, y: 1, z: 16} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &953365988 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 953365985} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b687a99ae5a24d93bda55097ba092eae, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!65 &953365989 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 953365985} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 1 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!1 &1020104602 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1020104603} + m_Layer: 0 + m_Name: --- Rendering --- + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1020104603 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1020104602} + 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1070132887 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1070132888} + - component: {fileID: 1070132890} + - component: {fileID: 1070132889} + m_Layer: 5 + m_Name: Vertical + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1070132888 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1070132887} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.03, y: 0.23, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1515546305} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1070132889 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1070132887} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19245279, g: 0.19245279, b: 0.19245279, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &1070132890 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1070132887} + m_CullTransparentMesh: 1 +--- !u!1 &1117530211 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1117530212} + m_Layer: 0 + m_Name: --- Managers --- + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1117530212 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1117530211} + 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1151453247 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1151453251} + - component: {fileID: 1151453250} + - component: {fileID: 1151453249} + - component: {fileID: 1151453248} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1151453248 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1151453247} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &1151453249 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1151453247} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!223 &1151453250 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1151453247} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 + m_AdditionalShaderChannelsFlag: 0 + m_UpdateRectTransformForStandalone: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &1151453251 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1151453247} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1515546305} + - {fileID: 134152954} + - {fileID: 400258525} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!1001 &1369696248 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 5428293656682211247, guid: b79bbb0a3d2ffcb4aa0928662237d729, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5428293656682211247, guid: b79bbb0a3d2ffcb4aa0928662237d729, + type: 3} + propertyPath: m_LocalPosition.y + value: 2.87 + objectReference: {fileID: 0} + - target: {fileID: 5428293656682211247, guid: b79bbb0a3d2ffcb4aa0928662237d729, + type: 3} + propertyPath: m_LocalPosition.z + value: -6.5 + objectReference: {fileID: 0} + - target: {fileID: 5428293656682211247, guid: b79bbb0a3d2ffcb4aa0928662237d729, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5428293656682211247, guid: b79bbb0a3d2ffcb4aa0928662237d729, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5428293656682211247, guid: b79bbb0a3d2ffcb4aa0928662237d729, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5428293656682211247, guid: b79bbb0a3d2ffcb4aa0928662237d729, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5428293656682211247, guid: b79bbb0a3d2ffcb4aa0928662237d729, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5428293656682211247, guid: b79bbb0a3d2ffcb4aa0928662237d729, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5428293656682211247, guid: b79bbb0a3d2ffcb4aa0928662237d729, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7571218878679606617, guid: b79bbb0a3d2ffcb4aa0928662237d729, + type: 3} + propertyPath: m_Name + value: FollowTargetCamera + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: b79bbb0a3d2ffcb4aa0928662237d729, type: 3} +--- !u!1 &1426663000 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1426663001} + m_Layer: 0 + m_Name: ' ' + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1426663001 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1426663000} + 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1515546304 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1515546305} + m_Layer: 5 + m_Name: Crosshairs + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1515546305 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1515546304} + 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: 276800705} + - {fileID: 1070132888} + m_Father: {fileID: 1151453251} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &1640919098 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1640919099} + m_Layer: 0 + m_Name: ' ' + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1640919099 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1640919098} + 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1961987804 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1961987806} + - component: {fileID: 1961987805} + m_Layer: 0 + m_Name: MouseLock + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1961987805 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1961987804} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 050f3baec8542fa4ea6c967dc6e56d43, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &1961987806 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1961987804} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 24, y: 4.5, z: -2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &1983316115 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 2233488958082696340, guid: b03f7be5d32ac274fbab6571b0457b2b, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4740716142168693208, guid: b03f7be5d32ac274fbab6571b0457b2b, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5966613522712250741, guid: b03f7be5d32ac274fbab6571b0457b2b, + type: 3} + propertyPath: m_LocalPosition.x + value: 7.1080685 + objectReference: {fileID: 0} + - target: {fileID: 5966613522712250741, guid: b03f7be5d32ac274fbab6571b0457b2b, + type: 3} + propertyPath: m_LocalPosition.y + value: 4.1421885 + objectReference: {fileID: 0} + - target: {fileID: 5966613522712250741, guid: b03f7be5d32ac274fbab6571b0457b2b, + type: 3} + propertyPath: m_LocalPosition.z + value: 724.6157 + objectReference: {fileID: 0} + - target: {fileID: 5966613522712250741, guid: b03f7be5d32ac274fbab6571b0457b2b, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5966613522712250741, guid: b03f7be5d32ac274fbab6571b0457b2b, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5966613522712250741, guid: b03f7be5d32ac274fbab6571b0457b2b, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5966613522712250741, guid: b03f7be5d32ac274fbab6571b0457b2b, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5966613522712250741, guid: b03f7be5d32ac274fbab6571b0457b2b, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5966613522712250741, guid: b03f7be5d32ac274fbab6571b0457b2b, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5966613522712250741, guid: b03f7be5d32ac274fbab6571b0457b2b, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7991159288807452301, guid: b03f7be5d32ac274fbab6571b0457b2b, + type: 3} + propertyPath: m_Name + value: GameCanvas + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: b03f7be5d32ac274fbab6571b0457b2b, type: 3} +--- !u!1 &2067055330 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2067055336} + - component: {fileID: 2067055335} + - component: {fileID: 2067055334} + - component: {fileID: 2067055333} + - component: {fileID: 2067055332} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &2067055332 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2067055330} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 72ece51f2901e7445ab60da3685d6b5f, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ShowDebugText: 0 + m_ShowCameraFrustum: 1 + m_IgnoreTimeScale: 1 + m_WorldUpOverride: {fileID: 0} + m_UpdateMethod: 2 + m_BlendUpdateMethod: 1 + m_DefaultBlend: + m_Style: 1 + m_Time: 2 + m_CustomCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_CustomBlends: {fileID: 0} + m_CameraCutEvent: + m_PersistentCalls: + m_Calls: [] + m_CameraActivatedEvent: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &2067055333 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2067055330} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_RenderShadows: 1 + m_RequiresDepthTextureOption: 2 + m_RequiresOpaqueTextureOption: 2 + m_CameraType: 0 + m_Cameras: [] + m_RendererIndex: -1 + m_VolumeLayerMask: + serializedVersion: 2 + m_Bits: 1 + m_VolumeTrigger: {fileID: 0} + m_VolumeFrameworkUpdateModeOption: 2 + m_RenderPostProcessing: 0 + m_Antialiasing: 0 + m_AntialiasingQuality: 2 + m_StopNaN: 0 + m_Dithering: 0 + m_ClearDepth: 1 + m_AllowXRRendering: 1 + m_AllowHDROutput: 1 + m_UseScreenCoordOverride: 0 + m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0} + m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} + m_RequiresDepthTexture: 0 + m_RequiresColorTexture: 0 + m_Version: 2 + m_TaaSettings: + quality: 3 + frameInfluence: 0.1 + jitterScale: 1 + mipBias: 0 + varianceClampScale: 0.9 + contrastAdaptiveSharpening: 0 +--- !u!81 &2067055334 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2067055330} + m_Enabled: 1 +--- !u!20 &2067055335 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2067055330} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + 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_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.1 + far clip plane: 5000 + field of view: 80 + orthographic: 0 + orthographic size: 10 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 887 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &2067055336 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2067055330} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 2.87, z: -6.5} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 22.289, z: 0} +--- !u!1 &2078410557 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2078410558} + m_Layer: 0 + m_Name: --- World --- + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2078410558 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2078410557} + 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &3767734957354793281 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 3033829265845483697, guid: daa471e72a9a4461d8931f3af139c914, + type: 3} + propertyPath: m_Name + value: Player + objectReference: {fileID: 0} + - target: {fileID: 7603741728161566712, guid: daa471e72a9a4461d8931f3af139c914, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7603741728161566712, guid: daa471e72a9a4461d8931f3af139c914, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7603741728161566712, guid: daa471e72a9a4461d8931f3af139c914, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7603741728161566712, guid: daa471e72a9a4461d8931f3af139c914, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7603741728161566712, guid: daa471e72a9a4461d8931f3af139c914, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7603741728161566712, guid: daa471e72a9a4461d8931f3af139c914, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7603741728161566712, guid: daa471e72a9a4461d8931f3af139c914, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7603741728161566712, guid: daa471e72a9a4461d8931f3af139c914, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7603741728161566712, guid: daa471e72a9a4461d8931f3af139c914, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7603741728161566712, guid: daa471e72a9a4461d8931f3af139c914, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7827721042410576718, guid: daa471e72a9a4461d8931f3af139c914, + type: 3} + propertyPath: _spawnArea + value: + objectReference: {fileID: 343009576} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: daa471e72a9a4461d8931f3af139c914, type: 3} +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 1020104603} + - {fileID: 2067055336} + - {fileID: 1369696248} + - {fileID: 533088679} + - {fileID: 1640919099} + - {fileID: 1117530212} + - {fileID: 1983316115} + - {fileID: 1961987806} + - {fileID: 1426663001} + - {fileID: 2078410558} + - {fileID: 410545198} + - {fileID: 3767734957354793281} + - {fileID: 1151453251} + - {fileID: 343009577} + - {fileID: 953365987} diff --git a/aplib.net-demo/Assets/Scenes/TestScenes/GameplayTestScene.unity.meta b/aplib.net-demo/Assets/Scenes/TestScenes/GameplayTestScene.unity.meta new file mode 100644 index 00000000..13e5be43 --- /dev/null +++ b/aplib.net-demo/Assets/Scenes/TestScenes/GameplayTestScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2b3f85a86977b9b0b824a76151fe31a1 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/aplib.net-demo/Assets/Scenes/TestScenes/PathfindingTests.meta b/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene.meta similarity index 77% rename from aplib.net-demo/Assets/Scenes/TestScenes/PathfindingTests.meta rename to aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene.meta index cd6cb1f0..e16a1a04 100644 --- a/aplib.net-demo/Assets/Scenes/TestScenes/PathfindingTests.meta +++ b/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 42f6eeb55dd2f3448b6d02212bb3814a +guid: 64501162de616ee7ab6a7e69c9d9ef72 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneGridConfig.asset b/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneGridConfig.asset new file mode 100644 index 00000000..932669d5 --- /dev/null +++ b/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneGridConfig.asset @@ -0,0 +1,19 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: caf8976215a2fea43905fbca9883432f, type: 3} + m_Name: GameplayTestSceneGridConfig + m_EditorClassIdentifier: + UseSeed: 1 + Seed: 1988492683 + GridWidthX: 5 + GridWidthZ: 5 + AmountOfRooms: 3 diff --git a/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneGridConfig.asset.meta b/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneGridConfig.asset.meta new file mode 100644 index 00000000..536283ff --- /dev/null +++ b/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneGridConfig.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2c3eb6cef5158fed19828ffaf389558a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneItems.asset b/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneItems.asset new file mode 100644 index 00000000..3d6d765c --- /dev/null +++ b/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneItems.asset @@ -0,0 +1,21 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8b6127cdc9197ae42b9b7c028ac59472, type: 3} + m_Name: GameplayTestSceneItems + m_EditorClassIdentifier: + k__BackingField: + - Item: {fileID: 1402688592469580382, guid: 18fad5aa543620b449decf03a229c586, type: 3} + Count: 2 + - Item: {fileID: 3783921441781814114, guid: 5924d3f50fb1bb146897ba52aa3d7a49, type: 3} + Count: 2 + - Item: {fileID: 7560215300223784918, guid: 59f68fe0a7bd5554baaf1d43a0849f57, type: 3} + Count: 2 diff --git a/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneItems.asset.meta b/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneItems.asset.meta new file mode 100644 index 00000000..02f3853f --- /dev/null +++ b/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneItems.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c2fd3fee1a07b770bbeb9303a1403a48 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneSpawnableEnemies.asset b/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneSpawnableEnemies.asset new file mode 100644 index 00000000..545026cd --- /dev/null +++ b/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneSpawnableEnemies.asset @@ -0,0 +1,19 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc2faddc161663044bf4eb96b70992b3, type: 3} + m_Name: GameplayTestSceneSpawnableEnemies + m_EditorClassIdentifier: + k__BackingField: + - Enemy: {fileID: 2514419866930457234, guid: 86a0d3ee5ff10dd4b93454ad023e838c, type: 3} + Count: 6 + - Enemy: {fileID: 7480288689146226739, guid: 2c5efd8328b8ecd4b83cbacb8142ac3e, type: 3} + Count: 5 diff --git a/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneSpawnableEnemies.asset.meta b/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneSpawnableEnemies.asset.meta new file mode 100644 index 00000000..be7abb0c --- /dev/null +++ b/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneSpawnableEnemies.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 40e49307d90b9f18584860020252be7e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/aplib.net-demo/Assets/Scripts/Doors/Door.cs b/aplib.net-demo/Assets/Scripts/Doors/Door.cs index 3f88e52b..1a0be6ee 100644 --- a/aplib.net-demo/Assets/Scripts/Doors/Door.cs +++ b/aplib.net-demo/Assets/Scripts/Doors/Door.cs @@ -67,7 +67,7 @@ private void OnTriggerEnter(Collider collidingObject) /// /// The key that is being checked for the same ID as the door /// True if key id is the same as door id otherwise false. - public bool TryOpenDoor(Key key) => key.Id == DoorId; + public bool KeyMatchesDoor(Key key) => key.Id == DoorId; /// /// Opens the door by destroying the game object. diff --git a/aplib.net-demo/Assets/Scripts/Entities/Enemy/AbstractEnemy.cs b/aplib.net-demo/Assets/Scripts/Entities/Enemy/AbstractEnemy.cs index 354fa7fd..2569e6a8 100644 --- a/aplib.net-demo/Assets/Scripts/Entities/Enemy/AbstractEnemy.cs +++ b/aplib.net-demo/Assets/Scripts/Entities/Enemy/AbstractEnemy.cs @@ -9,6 +9,8 @@ [RequireComponent(typeof(Animator))] public abstract class AbstractEnemy : MonoBehaviour { + public bool IsTriggered() => _canMove; + /// /// The amount of damage the enemy deals to the player. /// diff --git a/aplib.net-demo/Assets/Scripts/Entities/Player/PlayerLogic.cs b/aplib.net-demo/Assets/Scripts/Entities/Player/PlayerLogic.cs index 14f89f31..44e6c91b 100644 --- a/aplib.net-demo/Assets/Scripts/Entities/Player/PlayerLogic.cs +++ b/aplib.net-demo/Assets/Scripts/Entities/Player/PlayerLogic.cs @@ -14,6 +14,7 @@ public class PlayerLogic : MonoBehaviour private bool _respawnOnDeath = true; private HealthComponent _healthComponent; private RespawnableComponent _respawnableComponent; + public Vector3 EyesPosition => transform.position + new Vector3(0, 1, 0); /// diff --git a/aplib.net-demo/Assets/Scripts/Entities/Weapons/MeleeWeapon.cs b/aplib.net-demo/Assets/Scripts/Entities/Weapons/MeleeWeapon.cs index c5803699..7d57752b 100644 --- a/aplib.net-demo/Assets/Scripts/Entities/Weapons/MeleeWeapon.cs +++ b/aplib.net-demo/Assets/Scripts/Entities/Weapons/MeleeWeapon.cs @@ -17,6 +17,8 @@ public class MeleeWeapon : Weapon [SerializeField] private float _height = 4; + public float Range => _height; + /// /// The radius of the hitzone in world units. /// The two spheres that define the hitzone have the same radius. diff --git a/aplib.net-demo/Assets/Scripts/Entities/Weapons/RangedWeapon.cs b/aplib.net-demo/Assets/Scripts/Entities/Weapons/RangedWeapon.cs index 8323a65f..031ccda7 100644 --- a/aplib.net-demo/Assets/Scripts/Entities/Weapons/RangedWeapon.cs +++ b/aplib.net-demo/Assets/Scripts/Entities/Weapons/RangedWeapon.cs @@ -20,6 +20,8 @@ public class RangedWeapon : Weapon [SerializeField] private int _range = 50; + public int Range => _range; + [SerializeField] private AmmoPouch _ammoPouch; diff --git a/aplib.net-demo/Assets/Scripts/Inventory/AmmoPouch.cs b/aplib.net-demo/Assets/Scripts/Inventory/AmmoPouch.cs index 82590e71..49e2b708 100644 --- a/aplib.net-demo/Assets/Scripts/Inventory/AmmoPouch.cs +++ b/aplib.net-demo/Assets/Scripts/Inventory/AmmoPouch.cs @@ -13,7 +13,9 @@ public class AmmoPouch : MonoBehaviour [SerializeField] public int maxAmmoCount; + [SerializeField] private int _currentAmmoCount; + public int CurrentAmmoCount => _currentAmmoCount; private void Start() => _currentAmmoCount = maxAmmoCount; diff --git a/aplib.net-demo/Assets/Scripts/Inventory/Inventory.cs b/aplib.net-demo/Assets/Scripts/Inventory/Inventory.cs index 1b401ac3..152f09a4 100644 --- a/aplib.net-demo/Assets/Scripts/Inventory/Inventory.cs +++ b/aplib.net-demo/Assets/Scripts/Inventory/Inventory.cs @@ -1,4 +1,5 @@ using Assets.Scripts.Items; +using System; using System.Collections.Generic; using System.Linq; using UnityEngine; @@ -15,11 +16,6 @@ public class Inventory : MonoBehaviour /// public Texture emptyInventoryImage; - /// - /// The canvas object that holds the inventory. - /// - public GameObject inventoryObject; - [SerializeField] private float _inventorySize = 4; private AmmoPouch _ammoPouch; @@ -139,9 +135,12 @@ public void DisplayItem() => _inventoryIndicator.texture = /// The name of the item to check for. /// True if the item is in the inventory, otherwise false. public bool ContainsItem(string queryName) => _itemList.Any(i => i.name == queryName); + public bool ContainsItem() => _itemList.Any(i => i is T); /// /// Returns the amount of item uses left in every item in the inventory. /// public int UnusedItems() => _itemList.Sum(item => item.uses); + + public Item EquippedItem => _itemList.Peek(); } diff --git a/aplib.net-demo/Assets/Scripts/Inventory/KeyRing.cs b/aplib.net-demo/Assets/Scripts/Inventory/KeyRing.cs index 54e7bdf6..3676c9fe 100644 --- a/aplib.net-demo/Assets/Scripts/Inventory/KeyRing.cs +++ b/aplib.net-demo/Assets/Scripts/Inventory/KeyRing.cs @@ -23,7 +23,7 @@ public class KeyRing : MonoBehaviour /// True if the correct key is present otherwise False. public bool KeyQuery(Door door) { - Key key = _keyRing.Find(door.TryOpenDoor); + Key key = _keyRing.Find(door.KeyMatchesDoor); return _keyRing.Remove(key); } diff --git a/aplib.net-demo/Assets/Scripts/Items/BeforeDestroyKey.cs b/aplib.net-demo/Assets/Scripts/Items/BeforeDestroyKey.cs index 4d8b9af9..5ff2807a 100644 --- a/aplib.net-demo/Assets/Scripts/Items/BeforeDestroyKey.cs +++ b/aplib.net-demo/Assets/Scripts/Items/BeforeDestroyKey.cs @@ -6,7 +6,7 @@ namespace Assets.Scripts.Items { /// - /// Attach this class to make object pickupable. + /// Performs logic belonging to when this key is picked up, such as communicating to the NavMesh that the door is open. /// [RequireComponent(typeof(Key))] public class BeforeDestroyKey : MonoBehaviour @@ -20,7 +20,7 @@ public void Awake() if (!key) throw new UnityException("Key not found!"); GameObject[] gameObjects = GameObject.FindGameObjectsWithTag("Door"); - GameObject door = gameObjects.FirstOrDefault(go => go.GetComponent().TryOpenDoor(key)); + GameObject door = gameObjects.FirstOrDefault(go => go.GetComponent().KeyMatchesDoor(key)); if (!door) throw new UnityException("Door not found!"); diff --git a/aplib.net-demo/Assets/Scripts/Items/HealthPotion.cs b/aplib.net-demo/Assets/Scripts/Items/HealthPotion.cs index b65fe1cd..485d7f60 100644 --- a/aplib.net-demo/Assets/Scripts/Items/HealthPotion.cs +++ b/aplib.net-demo/Assets/Scripts/Items/HealthPotion.cs @@ -30,6 +30,7 @@ public override void UseItem() base.UseItem(); _playerHealth.IncreaseHealth(_healAmount); Instantiate(_playerEffect, _playerHealth.transform); + Debug.Log($"Healed player with {_healAmount}"); } } } diff --git a/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs b/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs new file mode 100644 index 00000000..80841d71 --- /dev/null +++ b/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs @@ -0,0 +1,615 @@ +using Aplib.Core; +using Aplib.Core.Agents; +using Aplib.Core.Belief.Beliefs; +using Aplib.Core.Belief.BeliefSets; +using Aplib.Core.Desire.DesireSets; +using Aplib.Core.Desire.Goals; +using Aplib.Core.Desire.GoalStructures; +using Aplib.Core.Intent.Actions; +using Aplib.Core.Intent.Tactics; +using Aplib.Integrations.Unity; +using Aplib.Integrations.Unity.Actions; +using Assets.Scripts.Items; +using Entities.Weapons; +using NUnit.Framework; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using UnityEngine; +using UnityEngine.AI; +using UnityEngine.SceneManagement; +using UnityEngine.TestTools; +using static Aplib.Core.Combinators; +using Goal = Aplib.Core.Desire.Goals.Goal; +using Action = Aplib.Core.Intent.Actions.Action; +using Tactic = Aplib.Core.Intent.Tactics.Tactic; +using FirstOfTactic = Aplib.Core.Intent.Tactics.FirstOfTactic; +using PrimitiveTactic = Aplib.Core.Intent.Tactics.PrimitiveTactic; +using GoalStructure = Aplib.Core.Desire.GoalStructures.GoalStructure; +using SequentialGoalStructure = Aplib.Core.Desire.GoalStructures.SequentialGoalStructure; +using DesireSet = Aplib.Core.Desire.DesireSets.DesireSet; +using BdiAgent = Aplib.Core.Agents.BdiAgent; +using TransformPathfinderAction = Aplib.Integrations.Unity.Actions.TransformPathfinderAction; +using IGoalStructure = Aplib.Core.Desire.GoalStructures.IGoalStructure; +using InterruptGuard = System.Func; + +namespace Testing.AplibTests +{ + // The realistic gameplay, ordered on priority: + // - If health below 60% and have health potion, use it + // + // - Determine which enemy to engage, IF at least one is visible + // - Given a list of all visible enemies and their distances to the player, determine enemy to focus X: + // - group by [close melee enemy, crossbow enemy, distanced melee enemy] + // - take group I = 0 + // - If low on health, filter over untriggered enemies (do not attack them) + // - sort within group on distance (but inverted sort for crossbow enemy) + // - take first enemy within group, else increment I + // + // - React to enemy X: + // - IF X is distanced melee enemy AND ((rage potion is visible AND do not possess rage) OR (healing potion is visible AND health is low)) THEN do not attack but get that item // Implies no crossbow enemy is visible + // - ELSE IF X is crossbow enemy AND X is has targeted THEN dodge sideways + // - ELSE IF X is crossbow enemy AND Bullets are visible AND bullets closer than 1/3th of enemy distance AND and low on bullets THEN go get bullets + // - ELSE: // attack + // - IF in range of enemy, AND possess rage potion AND rage not applied, THEN use rage potion + // - ELSE Attack X with: crossbow IF possess arrows AND X is out of melee range AND (X is crossbow enemy OR (X is melee AND many bullets)), ELSE melee + // + // - Gather first one of [healing > rage > bullets] when visible + // + // - Navigate towards [next key > end item > start room] + + public class GameplayBeliefSet : BeliefSet + { + public const string EndItemName = "The Eternal Elixir"; + + /// The inventory in the scene. + public readonly Belief Inventory = + new(GameObject.Find("InventoryObject").GetComponent(), x => x); + + /// The rigidbody of the player. + public readonly Belief PlayerRigidBody = new( + GameObject.Find("Player").GetComponent(), x => x); + + public readonly Belief PlayerRotation = new( + GameObject.Find("PlayerRotation"), x => x); + + public readonly Belief PlayerHealthPercentage = new( + GameObject.Find("Player").GetComponent(), x => (float)x.Health / x.MaxHealth * 100); + + public readonly Belief VisibleHealthPotions = new( + new ItemsAndPlayerEyesReference + { + ItemsObject = GameObject.Find("Items"), + Player = GameObject.Find("Player").GetComponent() + }, + referenceTo => referenceTo.ItemsObject.GetComponentsInChildren() + .Where(item => ItemVisibleFrom(item, referenceTo.Player.EyesPosition, out _)) + .ToArray()); + + public readonly Belief VisibleRagePotions = new( + new ItemsAndPlayerEyesReference + { + ItemsObject = GameObject.Find("Items"), + Player = GameObject.Find("Player").GetComponent() + }, + referenceTo => referenceTo.ItemsObject.GetComponentsInChildren() + .Where(item => ItemVisibleFrom(item, referenceTo.Player.EyesPosition, out _)) + .ToArray()); + + public readonly Belief VisibleAmmo = new( + new ItemsAndPlayerEyesReference + { + ItemsObject = GameObject.Find("Items"), + Player = GameObject.Find("Player").GetComponent() + }, + referenceTo => referenceTo.ItemsObject.GetComponentsInChildren() + .Select(item => ItemVisibleFrom(item, referenceTo.Player.EyesPosition, out float distance) + ? (item, distance) : (null, 0f)) + .Where(x => x.item != null) + .ToArray()); + + public readonly Belief VisibleKeys = new( + new ItemsAndPlayerEyesReference + { + ItemsObject = GameObject.Find("LevelGeneration"), + Player = GameObject.Find("Player").GetComponent() + }, + referenceTo => referenceTo.ItemsObject.GetComponentsInChildren() + .Select(item => ItemVisibleFrom(item, referenceTo.Player.EyesPosition, out float distance) + ? (item, distance) : (null, 0f)) + .Where(x => x.item != null) + .ToArray()); + + public readonly Belief AnyItemIsVisible = new( + new ItemsAndPlayerEyesReference + { + ItemsObject = GameObject.Find("LevelGeneration"), + Player = GameObject.Find("Player").GetComponent() + }, + referenceTo => referenceTo.ItemsObject.GetComponentsInChildren() + .Any(item => ItemVisibleFrom(item, referenceTo.Player.EyesPosition, out _))); + + /// The position of the next key to obtain to reach the end room. + public readonly Belief, Vector3> TargetKeyPosition = new( + GameObject.FindGameObjectsWithTag("Key").Where(x => x != null), keys => + { + Vector3 playerPosition = GameObject.Find("Player").GetComponent().position; + NavMeshPath path = new(); + + // Find the first key that is reachable. + foreach (GameObject key in keys) + { + NavMesh.CalculatePath(playerPosition, key.transform.position, NavMesh.AllAreas, path); + if (path.status is NavMeshPathStatus.PathComplete) + return key.transform.position; + } + + // If no key is reachable, return Vector3.zero. + return Vector3.zero; + }); + + /// The position to which the player must navigate in order to fetch the end item. + public readonly Belief EndItemPosition = new( + GameObject.Find(EndItemName), x => x.transform.position, + () => !GameObject.Find("InventoryObject").GetComponent().ContainsItem(EndItemName)); + + /// The position of where the player started + public readonly Belief WinAreaPosition = new( + GameObject.FindWithTag("Win").transform, x => x.position); + + + private static bool ItemVisibleFrom(Item item, Vector3 origin, out float itemDistance) + => IsVisibleFrom(item.transform.position, origin, ~LayerMask.GetMask("PlayerSelf", "Item", "Ignore Raycast"), out itemDistance); + + private static bool EnemyVisibleFrom(AbstractEnemy enemy, Vector3 origin, out float enemyDistance) + => IsVisibleFrom(enemy.transform.position, origin, ~LayerMask.GetMask("PlayerSelf", "Enemy", "Ignore Raycast"), out enemyDistance); + + private static bool IsVisibleFrom(Vector3 target, Vector3 origin, LayerMask layerMask, out float enemyDistance) + { + enemyDistance = Vector3.Distance(origin, target); + + if (!Physics.Raycast(origin, target - origin, out _, enemyDistance, layerMask)) + return true; // Visible, nothing in the way + + enemyDistance = 0; + return false; // Something is in the way + + } + + /// Merely here to simplify types above + public class ItemsAndPlayerEyesReference + { + public GameObject ItemsObject; + public PlayerLogic Player; + } + + + /// Determines which enemies are visible and recognizable by the player. + public readonly + Belief + VisibleEnemies = new( + new EnemiesObjectAndPlayerEyesReference + { + EnemiesObject = GameObject.Find("Enemies"), + Player = GameObject.Find("Player").GetComponent() + }, + referenceTo => referenceTo.EnemiesObject.GetComponentsInChildren() + .Select(enemy => EnemyVisibleFrom(enemy, referenceTo.Player.EyesPosition, out float distance) + ? (enemy, distance) + : (null, 0f)) + .Where(x => x.enemy != null) + .Aggregate((new AbstractEnemy[] {}, new float[] {}), (acc, x) + => (acc.Item1.Append(x.enemy).ToArray(), acc.Item2.Append(x.distance).ToArray()))); + + public readonly Belief AnyEnemyVisible = new( + new EnemiesObjectAndPlayerEyesReference + { + EnemiesObject = GameObject.Find("Enemies"), + Player = GameObject.Find("Player").GetComponent() + }, + referenceTo => referenceTo.EnemiesObject.GetComponentsInChildren() + .Any(enemy => EnemyVisibleFrom(enemy, referenceTo.Player.EyesPosition, out _))); + + /// + /// Determines which enemy to focus on, based on the visible enemies and their distances. + /// + public AbstractEnemy DetermineEnemyToFocus(out float distance) // TODO move this to a Belief of its own for caching + { + (AbstractEnemy[] enemies, float[] distances) = VisibleEnemies.Observation; + if (enemies.Length == 0) + { + distance = 0; + return null; // No enemies in sight + } + + // Group and prioritize by [close melee enemy > crossbow enemy > distanced melee enemy] + List[] groupedEnemies = { new(), new(), new() }; + for (int i = 0; i < enemies.Length; i++) + { + int enemyPriority = enemies[i] switch + { + MeleeEnemy when distances[i] < 5 => 0, + RangedEnemy => 1, + _ => 2 + }; + groupedEnemies[enemyPriority].Add(i); + } + + // Determine enemy to focus + for (int i = 0; i < groupedEnemies.Length; i++) + { + IEnumerable group = groupedEnemies[i]; + if (!group.Any()) continue; + + // If low on health, filter over untriggered enemies (do not attack them) + if (PlayerHealthPercentage.Observation < 30) + { + group = group.Where(enemyIndex => !enemies[enemyIndex].IsTriggered()); + } + + // Ranged enemies further away should be targeted first + int enemyToFocusIndex = group + .OrderBy(enemyIndex => distances[enemyIndex] * (enemies[enemyIndex] is RangedEnemy ? -1 : 1)) + .First(); + distance = distances[enemyToFocusIndex]; + return enemies[enemyToFocusIndex]; + } + + distance = 0; + return null; + } + + public readonly Belief AmmoCount = new( + GameObject.Find("EquipmentInventory").GetComponent(), x => x.CurrentAmmoCount); + + public readonly Belief MeleeWeapon = new( + GameObject.Find("Player").GetComponentInChildren(true), x => x); + + public readonly Belief RangedWeapon = new( + GameObject.Find("Player").GetComponentInChildren(true), x => x); + + public readonly Belief EquipmentInventory = new( + GameObject.Find("EquipmentInventory").GetComponent(), x => x); + + /// Merely here to simplify types above + public class EnemiesObjectAndPlayerEyesReference + { + public GameObject EnemiesObject; + public PlayerLogic Player; + } + } + + public class GameplayTests + { + private const string _sceneName = "GameplayTestScene"; + + [SetUp] + public void SetUp() + { + Debug.Log($"Starting '{nameof(GameplayTests)}'"); + SceneManager.LoadScene(_sceneName); + } + + /// + /// Given that the smart agent mimics realistic gameplay, + /// When the agent is tasked to complete the game from start to end, + /// The game must be winnable. + /// + /// An IEnumerator usable to iterate the test. + [UnityTest] + [Timeout(300000)] + public IEnumerator RealisticGameplayCanWinTheGame() + { + // Arrange + InputManager.Instance.enabled = false; + GameplayBeliefSet mainBeliefSet = new(); + + Action mark = new(_ => Debug.Log("MARK")); + Action mark2 = new(_ => Debug.Log("MARK2")); + Tactic markT = new PrimitiveTactic(mark, _ => true); + Tactic markT2 = new PrimitiveTactic(mark2, _ => true); + Goal markGoal = new(mark.Lift(), _ => false); + Goal markGoal2 = new(mark2.Lift(), _ => false); + bool smort = true; + + Action smartMark = new(_ => Debug.Log("SMART MARK")); + Goal smartMarkGoal = new(smartMark.Lift(), _ => smort = !smort); + bool smort2 = true; + Action smartMark2 = new(_ => Debug.Log("SMART MARK 2")); + Goal smartMarkGoal2 = new(smartMark2.Lift(), _ => smort2 = !smort2); + + + Action rotateInventory = new(beliefSet => beliefSet.Inventory.Observation.SwitchItem()); + // TODO Assumes the item is in the inventory + Goal equipHealingPotion = new(rotateInventory.Lift(), + beliefSet => beliefSet.Inventory.Observation.EquippedItem is HealthPotion); + // TODO Assumes the item is in the inventory + PrimitiveTactic equipRagePotion = new(rotateInventory, + beliefSet => beliefSet.Inventory.Observation.EquippedItem is not RagePotion); + + Action useEquippedItemAction = new(beliefSet => + { + // Debug.Log("Using item"); + beliefSet.Inventory.Observation.ActivateItem(); + }); + bool hasNotYetUsedEquippedItem = true; + bool hasUsedEquippedItem = false; + PrimitiveTactic useEquippedItemTactic = new(useEquippedItemAction, + _ => hasNotYetUsedEquippedItem = !hasNotYetUsedEquippedItem); + Goal useEquippedItemGoal = new(useEquippedItemAction.Lift(), + _ => hasUsedEquippedItem = !hasUsedEquippedItem); + + SequentialGoalStructure restoreHealth = Seq(equipHealingPotion.Lift(), useEquippedItemGoal.Lift()); + Tactic useRagePotion = FirstOf(equipRagePotion, useEquippedItemTactic); // TODO probleem dat SEQ hier nodig was? + + + GameObject[] keys = GameObject.FindGameObjectsWithTag("Key"); + foreach (GameObject key in keys) key.AddComponent(); + + TransformPathfinderAction moveToElixir = new( + beliefSet => beliefSet.PlayerRigidBody, + beliefSet => beliefSet.EndItemPosition, + 0.3f + ); + + TransformPathfinderAction moveToNextKeyAction = new( + beliefSet => beliefSet.PlayerRigidBody, + beliefSet => beliefSet.TargetKeyPosition, + 0.3f + ); + + TransformPathfinderAction moveToWinAreaAction = new( + beliefSet => beliefSet.PlayerRigidBody, + beliefSet => beliefSet.WinAreaPosition, + 0.3f + ); + + Goal moveToElixirGoal = new(moveToElixir.Lift(), endItemPickedUpPredicate); + Goal moveToNextKeyGoal = new(moveToNextKeyAction.Lift(), endItemReachablePredicate); + Goal moveToWinArea = new(moveToWinAreaAction.Lift(), playerIsInWinAreaPredicate); + + GoalStructure fetchElixir = Seq(moveToNextKeyGoal.Lift(), moveToElixirGoal.Lift(), moveToWinArea.Lift()); + + TransformPathfinderAction moveToVisibleHealthPotionAction = new( + beliefSet => beliefSet.PlayerRigidBody, + beliefSet => beliefSet.VisibleHealthPotions.Observation + .Select(x => x.transform.position) + .OrderBy(x => Vector3.Distance(x, beliefSet.PlayerRigidBody.Observation.position)) // TODO distance is already calculated + .First(), + 0.3f); + TransformPathfinderAction moveToVisibleRagePotionAction = new( + beliefSet => beliefSet.PlayerRigidBody, + beliefSet => beliefSet.VisibleRagePotions.Observation + .Select(x => x.transform.position) + .OrderBy(x => Vector3.Distance(x, beliefSet.PlayerRigidBody.Observation.position)) + .First(), + 0.3f); + TransformPathfinderAction moveToVisibleAmmoAction = new( + beliefSet => beliefSet.PlayerRigidBody, + beliefSet => beliefSet.VisibleAmmo.Observation + .Select(x => x.item.transform.position) + .OrderBy(x => Vector3.Distance(x, beliefSet.PlayerRigidBody.Observation.position)) + .First(), + 0.3f); + TransformPathfinderAction moveToVisibleKeyAction = new( + beliefSet => beliefSet.PlayerRigidBody, + beliefSet => beliefSet.VisibleKeys.Observation + .Select(x => x.item.transform.position) + .OrderBy(x => Vector3.Distance(x, beliefSet.PlayerRigidBody.Observation.position)) + .First(), + 0.3f); + + PrimitiveTactic pickUpVisibleHealthPotion = new(moveToVisibleHealthPotionAction, + beliefSet => beliefSet.VisibleHealthPotions.Observation.Length != 0); + PrimitiveTactic pickUpVisibleRagePotion = new(moveToVisibleRagePotionAction, + beliefSet => beliefSet.VisibleRagePotions.Observation.Length != 0); + PrimitiveTactic pickUpVisibleAmmo = new(moveToVisibleAmmoAction, + beliefSet => beliefSet.VisibleAmmo.Observation.Length != 0); + PrimitiveTactic pickUpVisibleKey = new(moveToVisibleKeyAction, + beliefSet => beliefSet.VisibleKeys.Observation.Length != 0); + + Tactic fetchPotionIfDistancedMelee = FirstOf(guard: beliefSet => + beliefSet.DetermineEnemyToFocus(out float distance) is MeleeEnemy && distance > 5 && + ((!beliefSet.Inventory.Observation.ContainsItem() && + beliefSet.VisibleRagePotions.Observation.Length != 0) || + (beliefSet.PlayerHealthPercentage.Observation < 30 && + beliefSet.VisibleHealthPotions.Observation.Length != 0)), + pickUpVisibleHealthPotion, pickUpVisibleRagePotion); + + Action stepAsideRightAction = new(beliefSet => + { + Debug.Log("Dodging right!"); + Rigidbody playerRigidBody = beliefSet.PlayerRigidBody; + playerRigidBody.AddForce(playerRigidBody.transform.right * 10, ForceMode.VelocityChange); + }); + Action stepAsideLeftAction = new(beliefSet => + { + Debug.Log("Dodging left!"); + Rigidbody playerRigidBody = beliefSet.PlayerRigidBody; + playerRigidBody.AddForce(playerRigidBody.transform.right * -10, ForceMode.VelocityChange); + }); + PrimitiveTactic stepAsideLeft = new(stepAsideLeftAction, beliefSet => + { + Rigidbody playerRigidBody = beliefSet.PlayerRigidBody; + + Vector3 left = playerRigidBody.transform.TransformDirection(Vector3.left); + return Physics.Raycast(playerRigidBody.transform.position, left, 0.5f, + ~LayerMask.GetMask("PlayerSelf", "Item", "Ignore Raycast")); // Whether something is on the left, but not the player or items + }); + PrimitiveTactic stepAsideRight = new(stepAsideRightAction, beliefSet => + { + Rigidbody playerRigidBody = beliefSet.PlayerRigidBody; + + Vector3 left = playerRigidBody.transform.TransformDirection(Vector3.right); + return Physics.Raycast(playerRigidBody.transform.position, left, 0.5f, + ~LayerMask.GetMask("PlayerSelf", "Item", "Ignore Raycast")); // Whether something is on the left, but not the player or items + }); + + Tactic dodgeCrossbow = FirstOf(guard: beliefSet => + { + AbstractEnemy enemy = beliefSet.DetermineEnemyToFocus(out _); + return enemy is RangedEnemy && enemy.IsTriggered(); + }, + stepAsideLeft, stepAsideRight); + + Tactic fetchAmmo = FirstOf(guard: beliefSet => + { + AbstractEnemy enemy = beliefSet.DetermineEnemyToFocus(out float enemyDistance); + + return enemy is RangedEnemy + && beliefSet.AmmoCount < 4 + && beliefSet.VisibleAmmo.Observation.Length != 0 + && beliefSet.VisibleAmmo.Observation.Min(x => x.distance) < enemyDistance / 3; + }, + pickUpVisibleAmmo); + + Tactic useRagePotionIfUseful = FirstOf(guard: + beliefSet => beliefSet.DetermineEnemyToFocus(out float enemyDistance) != null + && enemyDistance < 7 + && beliefSet.Inventory.Observation.ContainsItem(), + useRagePotion); + + Action aimAndHitEnemyAction = new(beliefSet => + { + Transform playerRotation = beliefSet.PlayerRotation.Observation.transform; + Vector3 enemyPosition = beliefSet.DetermineEnemyToFocus(out _).transform.position; + playerRotation.transform.LookAt(enemyPosition); // Weapon viewpoint should be set to player rotation in editor + beliefSet.MeleeWeapon.Observation.UseWeapon(); + }); + // Action aimAtEnemy = new(beliefSet => + // { + // Transform playerRotation = beliefSet.PlayerRotation.Observation.transform; + // Vector3 enemyPosition = beliefSet.DetermineEnemyToFocus(out _).transform.position; + // playerRotation.transform.LookAt(enemyPosition); // Weapon viewpoint should be set to player rotation in editor + // }); + // PrimitiveTactic aimAtEnemyWhenNotAimedYet = new(aimAtEnemy, beliefSet => + // { + // AbstractEnemy enemyToFocus = beliefSet.DetermineEnemyToFocus(out float distance); + // Transform playerTransform = beliefSet.PlayerRigidBody.Observation.transform; + // Transform playerRotation = beliefSet.PlayerRotation.Observation.transform; + // Ray ray = new(playerTransform.position, playerRotation.forward); + // Debug.DrawRay(playerTransform.position, playerRotation.forward, Color.green); // TODO remove + // + // if (Physics.Raycast(ray, out RaycastHit hitInfo, distance, + // ~LayerMask.GetMask("PlayerSelf", "Ignore Raycast"))) + // { + // AbstractEnemy hitEnemy = hitInfo.collider.GetComponent(); + // var res = hitEnemy == null || hitEnemy != enemyToFocus; + // // Debug.LogError($"Aiming at enemy? {!res} {Time.time}"); + // return res; + // } + // return true; + // }); + + Action switchWeapon = new(beliefSet => beliefSet.EquipmentInventory.Observation.MoveNext()); + PrimitiveTactic equipCrossbow = new(switchWeapon, + beliefSet => beliefSet.EquipmentInventory.Observation.CurrentEquipment is not RangedWeapon); + PrimitiveTactic equipBat = new(switchWeapon, + beliefSet => beliefSet.EquipmentInventory.Observation.CurrentEquipment is not MeleeWeapon); + + TransformPathfinderAction approachEnemyAction = new( + beliefSet => beliefSet.PlayerRigidBody, + beliefSet => beliefSet.DetermineEnemyToFocus(out _).transform.position, + 0.3f + ); + PrimitiveTactic approachEnemyToShoot = new(approachEnemyAction, beliefSet => + { + _ = beliefSet.DetermineEnemyToFocus(out float distance); + return distance > beliefSet.RangedWeapon.Observation.Range; + }); + Action aimAndShootCrossbowAction = new(beliefSet => + { + Transform playerRotation = beliefSet.PlayerRotation.Observation.transform; + Vector3 enemyPosition = beliefSet.DetermineEnemyToFocus(out _).transform.position; + playerRotation.transform.LookAt(enemyPosition); // Weapon viewpoint should be set to player rotation in editor + beliefSet.RangedWeapon.Observation.UseWeapon(); + }); + Tactic shootEnemy = FirstOf(guard: beliefSet => + { + AbstractEnemy enemyToFocus = beliefSet.DetermineEnemyToFocus(out float enemyDistance); + return enemyToFocus != null + && beliefSet.AmmoCount > 0 + && enemyDistance > beliefSet.MeleeWeapon.Observation.Range + && (enemyToFocus is RangedEnemy || enemyToFocus is MeleeEnemy && beliefSet.AmmoCount > 3); + }, equipCrossbow, approachEnemyToShoot, aimAndShootCrossbowAction.Lift()); + + // Action swingBat = new(beliefSet => + // { + // beliefSet.MeleeWeapon.Observation.UseWeapon(); + // // Debug.Log($"Swing! {Time.time}"); + // }); + PrimitiveTactic approachEnemyToMelee = new(approachEnemyAction, beliefSet => + { + _ = beliefSet.DetermineEnemyToFocus(out float distance); + return distance > beliefSet.MeleeWeapon.Observation.Range; + }); + + Tactic hitEnemy = FirstOf(equipBat, approachEnemyToMelee, aimAndHitEnemyAction.Lift()); + + Tactic reactToEnemyTactic = FirstOf(fetchPotionIfDistancedMelee, dodgeCrossbow, fetchAmmo, useRagePotionIfUseful, shootEnemy, hitEnemy); + GoalStructure reactToEnemy = new Goal(reactToEnemyTactic, beliefSet => !beliefSet.AnyEnemyVisible); + + + Tactic fetchVisibleItem = FirstOf(pickUpVisibleHealthPotion, pickUpVisibleRagePotion, pickUpVisibleAmmo, pickUpVisibleKey); + GoalStructure fetchVisibleItemGoal = new Goal(fetchVisibleItem, beliefSet => !beliefSet.AnyItemIsVisible); + + DesireSet desireSet = new( + mainGoal: fetchElixir, // Fetch the elixir and bring it to the final room + sideGoals: new (IGoalStructure, InterruptGuard)[] + { + // But, when an item can be picked up, do so + (fetchVisibleItemGoal, beliefSet => + beliefSet.AnyItemIsVisible), + + // But, when an enemy is visible, react to it + (reactToEnemy, beliefSet => + beliefSet.AnyEnemyVisible), + + // But, when low on health and in possession of a healing potion, drink the potion + (restoreHealth, beliefSet => + beliefSet.PlayerHealthPercentage.Observation < 60 + && beliefSet.Inventory.Observation.ContainsItem()), + }); + + + // Act + BdiAgent agent = new(mainBeliefSet, desireSet); + AplibRunner testRunner = new(agent); + + yield return testRunner.Test(); + + // Assert + Assert.AreEqual(CompletionStatus.Success, agent.Status); + yield break; + + + #region Predicates + + bool endItemReachablePredicate(GameplayBeliefSet beliefSet) + { + Rigidbody playerRigidbody = beliefSet.PlayerRigidBody; + Vector3 target = beliefSet.EndItemPosition; + + NavMeshPath path = new(); + NavMesh.CalculatePath(playerRigidbody.position, target, NavMesh.AllAreas, path); + return path.status == NavMeshPathStatus.PathComplete; + } + + bool endItemPickedUpPredicate(GameplayBeliefSet beliefSet) + { + Inventory inventory = beliefSet.Inventory; + return inventory.ContainsItem(GameplayBeliefSet.EndItemName); + } + + bool playerIsInWinAreaPredicate(GameplayBeliefSet beliefSet) + { + Vector3 playerPos = beliefSet.PlayerRigidBody.Observation.position; + Vector3 centreOfWinArea = beliefSet.WinAreaPosition; + return Vector3.Distance(playerPos, centreOfWinArea) < 10f; // 10 is approximately the radius of the room + } + + #endregion + } + } +} diff --git a/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs.meta b/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs.meta new file mode 100644 index 00000000..b8db3f17 --- /dev/null +++ b/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ba2b7bfc274344a2836b8dba43b520d0 +timeCreated: 1717594836 \ No newline at end of file diff --git a/aplib.net-demo/ProjectSettings/EditorBuildSettings.asset b/aplib.net-demo/ProjectSettings/EditorBuildSettings.asset index 490661b2..0101ba01 100644 --- a/aplib.net-demo/ProjectSettings/EditorBuildSettings.asset +++ b/aplib.net-demo/ProjectSettings/EditorBuildSettings.asset @@ -65,4 +65,7 @@ EditorBuildSettings: - enabled: 1 path: Assets/Scenes/TestScenes/WeaponAnimateTestScene.unity guid: fa7e7b89851d59f40a3aff7ec0dcb180 + - enabled: 1 + path: Assets/Scenes/TestScenes/GameplayTestScene.unity + guid: 2b3f85a86977b9b0b824a76151fe31a1 m_configObjects: {} diff --git a/aplib.net-demo/ProjectSettings/TagManager.asset b/aplib.net-demo/ProjectSettings/TagManager.asset index ba2a74e3..24a3e729 100644 --- a/aplib.net-demo/ProjectSettings/TagManager.asset +++ b/aplib.net-demo/ProjectSettings/TagManager.asset @@ -19,8 +19,8 @@ TagManager: - UI - Ground - PlayerSelf - - - - + - Item + - Enemy - - - From 05cbb792b5712b00e8db234504f34b8e84de7ead Mon Sep 17 00:00:00 2001 From: SilasPeters <69711739+SilasPeters@users.noreply.github.com> Date: Sun, 23 Jun 2024 20:50:54 +0200 Subject: [PATCH 2/8] fix: cleaned up test --- .../Testing/AplibTests/GameplayTests.cs | 262 +++++++----------- 1 file changed, 107 insertions(+), 155 deletions(-) diff --git a/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs b/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs index 80841d71..fab3df87 100644 --- a/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs +++ b/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs @@ -1,21 +1,13 @@ using Aplib.Core; -using Aplib.Core.Agents; using Aplib.Core.Belief.Beliefs; using Aplib.Core.Belief.BeliefSets; -using Aplib.Core.Desire.DesireSets; -using Aplib.Core.Desire.Goals; -using Aplib.Core.Desire.GoalStructures; -using Aplib.Core.Intent.Actions; -using Aplib.Core.Intent.Tactics; using Aplib.Integrations.Unity; -using Aplib.Integrations.Unity.Actions; using Assets.Scripts.Items; using Entities.Weapons; using NUnit.Framework; using System.Collections; using System.Collections.Generic; using System.Linq; -using System.Threading; using UnityEngine; using UnityEngine.AI; using UnityEngine.SceneManagement; @@ -24,7 +16,6 @@ using Goal = Aplib.Core.Desire.Goals.Goal; using Action = Aplib.Core.Intent.Actions.Action; using Tactic = Aplib.Core.Intent.Tactics.Tactic; -using FirstOfTactic = Aplib.Core.Intent.Tactics.FirstOfTactic; using PrimitiveTactic = Aplib.Core.Intent.Tactics.PrimitiveTactic; using GoalStructure = Aplib.Core.Desire.GoalStructures.GoalStructure; using SequentialGoalStructure = Aplib.Core.Desire.GoalStructures.SequentialGoalStructure; @@ -36,7 +27,7 @@ namespace Testing.AplibTests { - // The realistic gameplay, ordered on priority: + // The realistic gameplay, ordered on priority (not fully implemented yet): // - If health below 60% and have health potion, use it // // - Determine which enemy to engage, IF at least one is visible @@ -130,6 +121,28 @@ public class GameplayBeliefSet : BeliefSet referenceTo => referenceTo.ItemsObject.GetComponentsInChildren() .Any(item => ItemVisibleFrom(item, referenceTo.Player.EyesPosition, out _))); + /// The position to which the player must navigate in order to fetch the end item. + public readonly Belief EndItemPosition = new( + GameObject.Find(EndItemName), x => x.transform.position, + () => !GameObject.Find("InventoryObject").GetComponent().ContainsItem(EndItemName)); + + /// The position of where the player started + public readonly Belief WinAreaPosition = new( + GameObject.FindWithTag("Win").transform, x => x.position); + + public readonly Belief AmmoCount = new( + GameObject.Find("EquipmentInventory").GetComponent(), x => x.CurrentAmmoCount); + + public readonly Belief MeleeWeapon = new( + GameObject.Find("Player").GetComponentInChildren(true), x => x); + + public readonly Belief RangedWeapon = new( + GameObject.Find("Player").GetComponentInChildren(true), x => x); + + public readonly Belief EquipmentInventory = new( + GameObject.Find("EquipmentInventory").GetComponent(), x => x); + + /// The position of the next key to obtain to reach the end room. public readonly Belief, Vector3> TargetKeyPosition = new( GameObject.FindGameObjectsWithTag("Key").Where(x => x != null), keys => @@ -149,42 +162,6 @@ public class GameplayBeliefSet : BeliefSet return Vector3.zero; }); - /// The position to which the player must navigate in order to fetch the end item. - public readonly Belief EndItemPosition = new( - GameObject.Find(EndItemName), x => x.transform.position, - () => !GameObject.Find("InventoryObject").GetComponent().ContainsItem(EndItemName)); - - /// The position of where the player started - public readonly Belief WinAreaPosition = new( - GameObject.FindWithTag("Win").transform, x => x.position); - - - private static bool ItemVisibleFrom(Item item, Vector3 origin, out float itemDistance) - => IsVisibleFrom(item.transform.position, origin, ~LayerMask.GetMask("PlayerSelf", "Item", "Ignore Raycast"), out itemDistance); - - private static bool EnemyVisibleFrom(AbstractEnemy enemy, Vector3 origin, out float enemyDistance) - => IsVisibleFrom(enemy.transform.position, origin, ~LayerMask.GetMask("PlayerSelf", "Enemy", "Ignore Raycast"), out enemyDistance); - - private static bool IsVisibleFrom(Vector3 target, Vector3 origin, LayerMask layerMask, out float enemyDistance) - { - enemyDistance = Vector3.Distance(origin, target); - - if (!Physics.Raycast(origin, target - origin, out _, enemyDistance, layerMask)) - return true; // Visible, nothing in the way - - enemyDistance = 0; - return false; // Something is in the way - - } - - /// Merely here to simplify types above - public class ItemsAndPlayerEyesReference - { - public GameObject ItemsObject; - public PlayerLogic Player; - } - - /// Determines which enemies are visible and recognizable by the player. public readonly Belief @@ -260,17 +237,26 @@ public readonly return null; } - public readonly Belief AmmoCount = new( - GameObject.Find("EquipmentInventory").GetComponent(), x => x.CurrentAmmoCount); + #region HelperMethods - public readonly Belief MeleeWeapon = new( - GameObject.Find("Player").GetComponentInChildren(true), x => x); + private static bool ItemVisibleFrom(Item item, Vector3 origin, out float itemDistance) + => IsVisibleFrom(item.transform.position, origin, ~LayerMask.GetMask("PlayerSelf", "Item", "Ignore Raycast"), out itemDistance); - public readonly Belief RangedWeapon = new( - GameObject.Find("Player").GetComponentInChildren(true), x => x); + private static bool EnemyVisibleFrom(AbstractEnemy enemy, Vector3 origin, out float enemyDistance) + => IsVisibleFrom(enemy.transform.position, origin, ~LayerMask.GetMask("PlayerSelf", "Enemy", "Ignore Raycast"), out enemyDistance); - public readonly Belief EquipmentInventory = new( - GameObject.Find("EquipmentInventory").GetComponent(), x => x); + private static bool IsVisibleFrom(Vector3 target, Vector3 origin, LayerMask layerMask, out float enemyDistance) + { + enemyDistance = Vector3.Distance(origin, target); + + if (!Physics.Raycast(origin, target - origin, out _, enemyDistance, layerMask)) + return true; // Visible, nothing in the way + + enemyDistance = 0; + return false; // Something is in the way + } + + #endregion /// Merely here to simplify types above public class EnemiesObjectAndPlayerEyesReference @@ -278,6 +264,13 @@ public class EnemiesObjectAndPlayerEyesReference public GameObject EnemiesObject; public PlayerLogic Player; } + + /// Merely here to simplify types above + public class ItemsAndPlayerEyesReference + { + public GameObject ItemsObject; + public PlayerLogic Player; + } } public class GameplayTests @@ -301,48 +294,10 @@ public void SetUp() [Timeout(300000)] public IEnumerator RealisticGameplayCanWinTheGame() { - // Arrange InputManager.Instance.enabled = false; GameplayBeliefSet mainBeliefSet = new(); - Action mark = new(_ => Debug.Log("MARK")); - Action mark2 = new(_ => Debug.Log("MARK2")); - Tactic markT = new PrimitiveTactic(mark, _ => true); - Tactic markT2 = new PrimitiveTactic(mark2, _ => true); - Goal markGoal = new(mark.Lift(), _ => false); - Goal markGoal2 = new(mark2.Lift(), _ => false); - bool smort = true; - - Action smartMark = new(_ => Debug.Log("SMART MARK")); - Goal smartMarkGoal = new(smartMark.Lift(), _ => smort = !smort); - bool smort2 = true; - Action smartMark2 = new(_ => Debug.Log("SMART MARK 2")); - Goal smartMarkGoal2 = new(smartMark2.Lift(), _ => smort2 = !smort2); - - - Action rotateInventory = new(beliefSet => beliefSet.Inventory.Observation.SwitchItem()); - // TODO Assumes the item is in the inventory - Goal equipHealingPotion = new(rotateInventory.Lift(), - beliefSet => beliefSet.Inventory.Observation.EquippedItem is HealthPotion); - // TODO Assumes the item is in the inventory - PrimitiveTactic equipRagePotion = new(rotateInventory, - beliefSet => beliefSet.Inventory.Observation.EquippedItem is not RagePotion); - - Action useEquippedItemAction = new(beliefSet => - { - // Debug.Log("Using item"); - beliefSet.Inventory.Observation.ActivateItem(); - }); - bool hasNotYetUsedEquippedItem = true; - bool hasUsedEquippedItem = false; - PrimitiveTactic useEquippedItemTactic = new(useEquippedItemAction, - _ => hasNotYetUsedEquippedItem = !hasNotYetUsedEquippedItem); - Goal useEquippedItemGoal = new(useEquippedItemAction.Lift(), - _ => hasUsedEquippedItem = !hasUsedEquippedItem); - - SequentialGoalStructure restoreHealth = Seq(equipHealingPotion.Lift(), useEquippedItemGoal.Lift()); - Tactic useRagePotion = FirstOf(equipRagePotion, useEquippedItemTactic); // TODO probleem dat SEQ hier nodig was? - + #region fetchElixir GameObject[] keys = GameObject.FindGameObjectsWithTag("Key"); foreach (GameObject key in keys) key.AddComponent(); @@ -371,6 +326,55 @@ public IEnumerator RealisticGameplayCanWinTheGame() GoalStructure fetchElixir = Seq(moveToNextKeyGoal.Lift(), moveToElixirGoal.Lift(), moveToWinArea.Lift()); + #region Predicates + + bool endItemReachablePredicate(GameplayBeliefSet beliefSet) + { + Rigidbody playerRigidbody = beliefSet.PlayerRigidBody; + Vector3 target = beliefSet.EndItemPosition; + + NavMeshPath path = new(); + NavMesh.CalculatePath(playerRigidbody.position, target, NavMesh.AllAreas, path); + return path.status == NavMeshPathStatus.PathComplete; + } + + bool endItemPickedUpPredicate(GameplayBeliefSet beliefSet) + { + Inventory inventory = beliefSet.Inventory; + return inventory.ContainsItem(GameplayBeliefSet.EndItemName); + } + + bool playerIsInWinAreaPredicate(GameplayBeliefSet beliefSet) + { + Vector3 playerPos = beliefSet.PlayerRigidBody.Observation.position; + Vector3 centreOfWinArea = beliefSet.WinAreaPosition; + return Vector3.Distance(playerPos, centreOfWinArea) < 10f; // 10 is approximately the radius of the room + } + + #endregion + + #endregion + + #region fetchVisibleItem + + Action rotateInventory = new(beliefSet => beliefSet.Inventory.Observation.SwitchItem()); + Goal equipHealingPotion = new(rotateInventory.Lift(), + beliefSet => beliefSet.Inventory.Observation.EquippedItem is HealthPotion); + PrimitiveTactic equipRagePotion = new(rotateInventory, + beliefSet => beliefSet.Inventory.Observation.EquippedItem is not RagePotion); + + Action useEquippedItemAction = new(beliefSet => beliefSet.Inventory.Observation.ActivateItem()); + bool hasNotYetUsedEquippedItem = true; + bool hasUsedEquippedItem = false; + PrimitiveTactic useEquippedItemTactic = new(useEquippedItemAction, + _ => hasNotYetUsedEquippedItem = !hasNotYetUsedEquippedItem); + Goal useEquippedItemGoal = new(useEquippedItemAction.Lift(), + _ => hasUsedEquippedItem = !hasUsedEquippedItem); + + SequentialGoalStructure restoreHealth = Seq(equipHealingPotion.Lift(), useEquippedItemGoal.Lift()); + Tactic useRagePotion = FirstOf(equipRagePotion, useEquippedItemTactic); + + TransformPathfinderAction moveToVisibleHealthPotionAction = new( beliefSet => beliefSet.PlayerRigidBody, beliefSet => beliefSet.VisibleHealthPotions.Observation @@ -417,6 +421,13 @@ public IEnumerator RealisticGameplayCanWinTheGame() beliefSet.VisibleHealthPotions.Observation.Length != 0)), pickUpVisibleHealthPotion, pickUpVisibleRagePotion); + Tactic fetchVisibleItem = FirstOf(pickUpVisibleHealthPotion, pickUpVisibleRagePotion, pickUpVisibleAmmo, pickUpVisibleKey); + GoalStructure fetchVisibleItemGoal = new Goal(fetchVisibleItem, beliefSet => !beliefSet.AnyItemIsVisible); + + #endregion + + #region reactToEnemy + Action stepAsideRightAction = new(beliefSet => { Debug.Log("Dodging right!"); @@ -435,7 +446,7 @@ public IEnumerator RealisticGameplayCanWinTheGame() Vector3 left = playerRigidBody.transform.TransformDirection(Vector3.left); return Physics.Raycast(playerRigidBody.transform.position, left, 0.5f, - ~LayerMask.GetMask("PlayerSelf", "Item", "Ignore Raycast")); // Whether something is on the left, but not the player or items + ~LayerMask.GetMask("PlayerSelf", "Item", "Ignore Raycast")); }); PrimitiveTactic stepAsideRight = new(stepAsideRightAction, beliefSet => { @@ -443,7 +454,7 @@ public IEnumerator RealisticGameplayCanWinTheGame() Vector3 left = playerRigidBody.transform.TransformDirection(Vector3.right); return Physics.Raycast(playerRigidBody.transform.position, left, 0.5f, - ~LayerMask.GetMask("PlayerSelf", "Item", "Ignore Raycast")); // Whether something is on the left, but not the player or items + ~LayerMask.GetMask("PlayerSelf", "Item", "Ignore Raycast")); }); Tactic dodgeCrossbow = FirstOf(guard: beliefSet => @@ -477,30 +488,6 @@ public IEnumerator RealisticGameplayCanWinTheGame() playerRotation.transform.LookAt(enemyPosition); // Weapon viewpoint should be set to player rotation in editor beliefSet.MeleeWeapon.Observation.UseWeapon(); }); - // Action aimAtEnemy = new(beliefSet => - // { - // Transform playerRotation = beliefSet.PlayerRotation.Observation.transform; - // Vector3 enemyPosition = beliefSet.DetermineEnemyToFocus(out _).transform.position; - // playerRotation.transform.LookAt(enemyPosition); // Weapon viewpoint should be set to player rotation in editor - // }); - // PrimitiveTactic aimAtEnemyWhenNotAimedYet = new(aimAtEnemy, beliefSet => - // { - // AbstractEnemy enemyToFocus = beliefSet.DetermineEnemyToFocus(out float distance); - // Transform playerTransform = beliefSet.PlayerRigidBody.Observation.transform; - // Transform playerRotation = beliefSet.PlayerRotation.Observation.transform; - // Ray ray = new(playerTransform.position, playerRotation.forward); - // Debug.DrawRay(playerTransform.position, playerRotation.forward, Color.green); // TODO remove - // - // if (Physics.Raycast(ray, out RaycastHit hitInfo, distance, - // ~LayerMask.GetMask("PlayerSelf", "Ignore Raycast"))) - // { - // AbstractEnemy hitEnemy = hitInfo.collider.GetComponent(); - // var res = hitEnemy == null || hitEnemy != enemyToFocus; - // // Debug.LogError($"Aiming at enemy? {!res} {Time.time}"); - // return res; - // } - // return true; - // }); Action switchWeapon = new(beliefSet => beliefSet.EquipmentInventory.Observation.MoveNext()); PrimitiveTactic equipCrossbow = new(switchWeapon, @@ -534,11 +521,6 @@ public IEnumerator RealisticGameplayCanWinTheGame() && (enemyToFocus is RangedEnemy || enemyToFocus is MeleeEnemy && beliefSet.AmmoCount > 3); }, equipCrossbow, approachEnemyToShoot, aimAndShootCrossbowAction.Lift()); - // Action swingBat = new(beliefSet => - // { - // beliefSet.MeleeWeapon.Observation.UseWeapon(); - // // Debug.Log($"Swing! {Time.time}"); - // }); PrimitiveTactic approachEnemyToMelee = new(approachEnemyAction, beliefSet => { _ = beliefSet.DetermineEnemyToFocus(out float distance); @@ -550,9 +532,8 @@ public IEnumerator RealisticGameplayCanWinTheGame() Tactic reactToEnemyTactic = FirstOf(fetchPotionIfDistancedMelee, dodgeCrossbow, fetchAmmo, useRagePotionIfUseful, shootEnemy, hitEnemy); GoalStructure reactToEnemy = new Goal(reactToEnemyTactic, beliefSet => !beliefSet.AnyEnemyVisible); + #endregion - Tactic fetchVisibleItem = FirstOf(pickUpVisibleHealthPotion, pickUpVisibleRagePotion, pickUpVisibleAmmo, pickUpVisibleKey); - GoalStructure fetchVisibleItemGoal = new Goal(fetchVisibleItem, beliefSet => !beliefSet.AnyItemIsVisible); DesireSet desireSet = new( mainGoal: fetchElixir, // Fetch the elixir and bring it to the final room @@ -581,35 +562,6 @@ public IEnumerator RealisticGameplayCanWinTheGame() // Assert Assert.AreEqual(CompletionStatus.Success, agent.Status); - yield break; - - - #region Predicates - - bool endItemReachablePredicate(GameplayBeliefSet beliefSet) - { - Rigidbody playerRigidbody = beliefSet.PlayerRigidBody; - Vector3 target = beliefSet.EndItemPosition; - - NavMeshPath path = new(); - NavMesh.CalculatePath(playerRigidbody.position, target, NavMesh.AllAreas, path); - return path.status == NavMeshPathStatus.PathComplete; - } - - bool endItemPickedUpPredicate(GameplayBeliefSet beliefSet) - { - Inventory inventory = beliefSet.Inventory; - return inventory.ContainsItem(GameplayBeliefSet.EndItemName); - } - - bool playerIsInWinAreaPredicate(GameplayBeliefSet beliefSet) - { - Vector3 playerPos = beliefSet.PlayerRigidBody.Observation.position; - Vector3 centreOfWinArea = beliefSet.WinAreaPosition; - return Vector3.Distance(playerPos, centreOfWinArea) < 10f; // 10 is approximately the radius of the room - } - - #endregion } } } From cbf5327d4036e878585ea47ad91fd444618c836f Mon Sep 17 00:00:00 2001 From: SilasPeters <69711739+SilasPeters@users.noreply.github.com> Date: Sun, 23 Jun 2024 20:51:10 +0200 Subject: [PATCH 3/8] fix: enemies can not spawn in starting room --- .../Scripts/LevelGeneration/LevelGenerationPipeline.cs | 2 +- aplib.net-demo/Assets/Scripts/WFC/Grid.cs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/aplib.net-demo/Assets/Scripts/LevelGeneration/LevelGenerationPipeline.cs b/aplib.net-demo/Assets/Scripts/LevelGeneration/LevelGenerationPipeline.cs index ff526427..54a6883b 100644 --- a/aplib.net-demo/Assets/Scripts/LevelGeneration/LevelGenerationPipeline.cs +++ b/aplib.net-demo/Assets/Scripts/LevelGeneration/LevelGenerationPipeline.cs @@ -85,6 +85,6 @@ private void MakeScene() /// /// Spawns the enemies. /// - public void SpawnEnemies() => _enemySpawner.SpawnEnemies(Grid.GetAllNotEmptyTiles()); + public void SpawnEnemies() => _enemySpawner.SpawnEnemies(Grid.GetAllNotEmptyTilesExceptStartRoom()); } } diff --git a/aplib.net-demo/Assets/Scripts/WFC/Grid.cs b/aplib.net-demo/Assets/Scripts/WFC/Grid.cs index 131cc37c..c7561970 100644 --- a/aplib.net-demo/Assets/Scripts/WFC/Grid.cs +++ b/aplib.net-demo/Assets/Scripts/WFC/Grid.cs @@ -419,5 +419,11 @@ public Cell GetRandomFilledCell() /// /// Returns all cells that are not empty. public List GetAllNotEmptyTiles() => _cells.FindAll(cell => cell.Tile is not Empty); + + /// + /// Gets all cells that are not empty. Excludes the starting room. + /// + /// Returns all cells that are not empty. + public List GetAllNotEmptyTilesExceptStartRoom() => _cells.FindAll(cell => cell.Tile is not Empty && !cell.Tile.IsStart); } } From 2a4310977130b6584971f57f2a2fbc2978faa0d3 Mon Sep 17 00:00:00 2001 From: SilasPeters <69711739+SilasPeters@users.noreply.github.com> Date: Sun, 23 Jun 2024 21:02:40 +0200 Subject: [PATCH 4/8] fix: even better cleanup --- .../Testing/AplibTests/GameplayTests.cs | 64 +++++++++++-------- 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs b/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs index fab3df87..e7216631 100644 --- a/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs +++ b/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs @@ -65,8 +65,30 @@ public class GameplayBeliefSet : BeliefSet public readonly Belief PlayerRotation = new( GameObject.Find("PlayerRotation"), x => x); - public readonly Belief PlayerHealthPercentage = new( - GameObject.Find("Player").GetComponent(), x => (float)x.Health / x.MaxHealth * 100); + #region fetchElixir + + /// The position of the next key to obtain to reach the end room. + public readonly Belief, Vector3> TargetKeyPosition = new( + GameObject.FindGameObjectsWithTag("Key").Where(x => x != null), keys => + { + Vector3 playerPosition = GameObject.Find("Player").GetComponent().position; + NavMeshPath path = new(); + + // Find the first key that is reachable. + foreach (GameObject key in keys) + { + NavMesh.CalculatePath(playerPosition, key.transform.position, NavMesh.AllAreas, path); + if (path.status is NavMeshPathStatus.PathComplete) + return key.transform.position; + } + + // If no key is reachable, return Vector3.zero. + return Vector3.zero; + }); + + #endregion + + #region fetchVisibleItem public readonly Belief VisibleHealthPotions = new( new ItemsAndPlayerEyesReference @@ -130,6 +152,13 @@ public class GameplayBeliefSet : BeliefSet public readonly Belief WinAreaPosition = new( GameObject.FindWithTag("Win").transform, x => x.position); + #endregion + + #region reactToEnemy + + public readonly Belief PlayerHealthPercentage = new( + GameObject.Find("Player").GetComponent(), x => (float)x.Health / x.MaxHealth * 100); + public readonly Belief AmmoCount = new( GameObject.Find("EquipmentInventory").GetComponent(), x => x.CurrentAmmoCount); @@ -142,26 +171,6 @@ public class GameplayBeliefSet : BeliefSet public readonly Belief EquipmentInventory = new( GameObject.Find("EquipmentInventory").GetComponent(), x => x); - - /// The position of the next key to obtain to reach the end room. - public readonly Belief, Vector3> TargetKeyPosition = new( - GameObject.FindGameObjectsWithTag("Key").Where(x => x != null), keys => - { - Vector3 playerPosition = GameObject.Find("Player").GetComponent().position; - NavMeshPath path = new(); - - // Find the first key that is reachable. - foreach (GameObject key in keys) - { - NavMesh.CalculatePath(playerPosition, key.transform.position, NavMesh.AllAreas, path); - if (path.status is NavMeshPathStatus.PathComplete) - return key.transform.position; - } - - // If no key is reachable, return Vector3.zero. - return Vector3.zero; - }); - /// Determines which enemies are visible and recognizable by the player. public readonly Belief @@ -191,7 +200,7 @@ public readonly /// /// Determines which enemy to focus on, based on the visible enemies and their distances. /// - public AbstractEnemy DetermineEnemyToFocus(out float distance) // TODO move this to a Belief of its own for caching + public AbstractEnemy DetermineEnemyToFocus(out float distance) { (AbstractEnemy[] enemies, float[] distances) = VisibleEnemies.Observation; if (enemies.Length == 0) @@ -237,7 +246,9 @@ public readonly return null; } - #region HelperMethods + #endregion + + #region HelperMethodsAndTypes private static bool ItemVisibleFrom(Item item, Vector3 origin, out float itemDistance) => IsVisibleFrom(item.transform.position, origin, ~LayerMask.GetMask("PlayerSelf", "Item", "Ignore Raycast"), out itemDistance); @@ -256,8 +267,6 @@ private static bool IsVisibleFrom(Vector3 target, Vector3 origin, LayerMask laye return false; // Something is in the way } - #endregion - /// Merely here to simplify types above public class EnemiesObjectAndPlayerEyesReference { @@ -271,6 +280,8 @@ public class ItemsAndPlayerEyesReference public GameObject ItemsObject; public PlayerLogic Player; } + + #endregion } public class GameplayTests @@ -553,7 +564,6 @@ bool playerIsInWinAreaPredicate(GameplayBeliefSet beliefSet) && beliefSet.Inventory.Observation.ContainsItem()), }); - // Act BdiAgent agent = new(mainBeliefSet, desireSet); AplibRunner testRunner = new(agent); From 56cf5318a4e003475a231ef7f1ca01358f0c10c6 Mon Sep 17 00:00:00 2001 From: SilasPeters <69711739+SilasPeters@users.noreply.github.com> Date: Sun, 23 Jun 2024 23:47:17 +0200 Subject: [PATCH 5/8] feat: animations and lighting --- .../Assets/Prefabs/Items/EndItem.prefab | 4 +-- .../Scenes/TestScenes/GameplayTestScene.unity | 2 +- .../GameplayTestSceneGridConfig.asset | 2 +- .../Testing/AplibTests/GameplayTests.cs | 26 ++++++++++++++----- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/aplib.net-demo/Assets/Prefabs/Items/EndItem.prefab b/aplib.net-demo/Assets/Prefabs/Items/EndItem.prefab index 9a2f86b1..f50cbcd1 100644 --- a/aplib.net-demo/Assets/Prefabs/Items/EndItem.prefab +++ b/aplib.net-demo/Assets/Prefabs/Items/EndItem.prefab @@ -14,7 +14,7 @@ GameObject: - component: {fileID: 6476791847648061540} - component: {fileID: 8353329355836069700} - component: {fileID: 1579793037850114028} - m_Layer: 8 + m_Layer: 0 m_Name: EndItem m_TagString: Untagged m_Icon: {fileID: 0} @@ -200,7 +200,7 @@ PrefabInstance: - target: {fileID: 919132149155446097, guid: 1575f63c98da02142b31eee0b014b4bd, type: 3} propertyPath: m_Layer - value: 8 + value: 0 objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] diff --git a/aplib.net-demo/Assets/Scenes/TestScenes/GameplayTestScene.unity b/aplib.net-demo/Assets/Scenes/TestScenes/GameplayTestScene.unity index 29dd29f5..97945c65 100644 --- a/aplib.net-demo/Assets/Scenes/TestScenes/GameplayTestScene.unity +++ b/aplib.net-demo/Assets/Scenes/TestScenes/GameplayTestScene.unity @@ -20,7 +20,7 @@ RenderSettings: m_FogDensity: 0.01 m_LinearFogStart: 0 m_LinearFogEnd: 300 - m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientSkyColor: {r: 1, g: 1, b: 1, a: 1} m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} m_AmbientIntensity: 1 diff --git a/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneGridConfig.asset b/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneGridConfig.asset index 932669d5..50c03180 100644 --- a/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneGridConfig.asset +++ b/aplib.net-demo/Assets/ScriptableObjects/GameplayTestScene/GameplayTestSceneGridConfig.asset @@ -13,7 +13,7 @@ MonoBehaviour: m_Name: GameplayTestSceneGridConfig m_EditorClassIdentifier: UseSeed: 1 - Seed: 1988492683 + Seed: 846546036 GridWidthX: 5 GridWidthZ: 5 AmountOfRooms: 3 diff --git a/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs b/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs index e7216631..4545b026 100644 --- a/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs +++ b/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs @@ -171,6 +171,15 @@ public class GameplayBeliefSet : BeliefSet public readonly Belief EquipmentInventory = new( GameObject.Find("EquipmentInventory").GetComponent(), x => x); + public readonly Belief Animator = new( + GameObject.Find("Player").GetComponent(), x => + { + x.SetFloat("PlayerVelocity", 3f); + x.SetBool("PlayerGrounded", true); + return x; + // \(^.^)/ manually setting the animator to walk + }); + /// Determines which enemies are visible and recognizable by the player. public readonly Belief @@ -226,7 +235,6 @@ public AbstractEnemy DetermineEnemyToFocus(out float distance) for (int i = 0; i < groupedEnemies.Length; i++) { IEnumerable group = groupedEnemies[i]; - if (!group.Any()) continue; // If low on health, filter over untriggered enemies (do not attack them) if (PlayerHealthPercentage.Observation < 30) @@ -234,8 +242,12 @@ public AbstractEnemy DetermineEnemyToFocus(out float distance) group = group.Where(enemyIndex => !enemies[enemyIndex].IsTriggered()); } + int[] groupArray = group.ToArray(); + + if (!groupArray.Any()) continue; + // Ranged enemies further away should be targeted first - int enemyToFocusIndex = group + int enemyToFocusIndex = groupArray .OrderBy(enemyIndex => distances[enemyIndex] * (enemies[enemyIndex] is RangedEnemy ? -1 : 1)) .First(); distance = distances[enemyToFocusIndex]; @@ -488,7 +500,7 @@ bool playerIsInWinAreaPredicate(GameplayBeliefSet beliefSet) Tactic useRagePotionIfUseful = FirstOf(guard: beliefSet => beliefSet.DetermineEnemyToFocus(out float enemyDistance) != null - && enemyDistance < 7 + && enemyDistance < 9 && beliefSet.Inventory.Observation.ContainsItem(), useRagePotion); @@ -498,6 +510,7 @@ bool playerIsInWinAreaPredicate(GameplayBeliefSet beliefSet) Vector3 enemyPosition = beliefSet.DetermineEnemyToFocus(out _).transform.position; playerRotation.transform.LookAt(enemyPosition); // Weapon viewpoint should be set to player rotation in editor beliefSet.MeleeWeapon.Observation.UseWeapon(); + beliefSet.Animator.Observation.SetTrigger("PlayerAttack"); }); Action switchWeapon = new(beliefSet => beliefSet.EquipmentInventory.Observation.MoveNext()); @@ -522,6 +535,7 @@ bool playerIsInWinAreaPredicate(GameplayBeliefSet beliefSet) Vector3 enemyPosition = beliefSet.DetermineEnemyToFocus(out _).transform.position; playerRotation.transform.LookAt(enemyPosition); // Weapon viewpoint should be set to player rotation in editor beliefSet.RangedWeapon.Observation.UseWeapon(); + beliefSet.Animator.Observation.SetTrigger("PlayerAttack"); }); Tactic shootEnemy = FirstOf(guard: beliefSet => { @@ -540,8 +554,8 @@ bool playerIsInWinAreaPredicate(GameplayBeliefSet beliefSet) Tactic hitEnemy = FirstOf(equipBat, approachEnemyToMelee, aimAndHitEnemyAction.Lift()); - Tactic reactToEnemyTactic = FirstOf(fetchPotionIfDistancedMelee, dodgeCrossbow, fetchAmmo, useRagePotionIfUseful, shootEnemy, hitEnemy); - GoalStructure reactToEnemy = new Goal(reactToEnemyTactic, beliefSet => !beliefSet.AnyEnemyVisible); + Tactic reactToEnemyTactic = FirstOf(sleep, fetchPotionIfDistancedMelee, dodgeCrossbow, fetchAmmo, useRagePotionIfUseful, shootEnemy, hitEnemy); + GoalStructure reactToEnemy = new Goal(reactToEnemyTactic, beliefSet => !beliefSet.AnyEnemyVisible || beliefSet.DetermineEnemyToFocus(out _) == null); #endregion @@ -556,7 +570,7 @@ bool playerIsInWinAreaPredicate(GameplayBeliefSet beliefSet) // But, when an enemy is visible, react to it (reactToEnemy, beliefSet => - beliefSet.AnyEnemyVisible), + beliefSet.AnyEnemyVisible && beliefSet.DetermineEnemyToFocus(out _) != null), // But, when low on health and in possession of a healing potion, drink the potion (restoreHealth, beliefSet => From 367877ca58a8d9f7169b6e6f437b186d5c7a1c99 Mon Sep 17 00:00:00 2001 From: SilasPeters <69711739+SilasPeters@users.noreply.github.com> Date: Sun, 23 Jun 2024 23:54:47 +0200 Subject: [PATCH 6/8] test: added godlike test --- .../Testing/AplibTests/GameplayTests.cs | 294 +++++++++++++++++- 1 file changed, 291 insertions(+), 3 deletions(-) diff --git a/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs b/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs index 4545b026..47eb2c44 100644 --- a/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs +++ b/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs @@ -307,6 +307,284 @@ public void SetUp() SceneManager.LoadScene(_sceneName); } + /// + /// Given that the smart agent mimics godlike gameplay, + /// When the agent is tasked to complete the game from start to end, + /// The game must be winnable. + /// + /// An IEnumerator usable to iterate the test. + [UnityTest] + [Timeout(300000)] + public IEnumerator GodlikeGameplayCanWinTheGame() + { + GameplayBeliefSet mainBeliefSet = new(); + + #region fetchElixir + + GameObject[] keys = GameObject.FindGameObjectsWithTag("Key"); + foreach (GameObject key in keys) key.AddComponent(); + + TransformPathfinderAction moveToElixir = new( + beliefSet => beliefSet.PlayerRigidBody, + beliefSet => beliefSet.EndItemPosition, + 0.3f + ); + + TransformPathfinderAction moveToNextKeyAction = new( + beliefSet => beliefSet.PlayerRigidBody, + beliefSet => beliefSet.TargetKeyPosition, + 0.3f + ); + + TransformPathfinderAction moveToWinAreaAction = new( + beliefSet => beliefSet.PlayerRigidBody, + beliefSet => beliefSet.WinAreaPosition, + 0.3f + ); + + Goal moveToElixirGoal = new(moveToElixir.Lift(), endItemPickedUpPredicate); + Goal moveToNextKeyGoal = new(moveToNextKeyAction.Lift(), endItemReachablePredicate); + Goal moveToWinArea = new(moveToWinAreaAction.Lift(), playerIsInWinAreaPredicate); + + GoalStructure fetchElixir = Seq(moveToNextKeyGoal.Lift(), moveToElixirGoal.Lift(), moveToWinArea.Lift()); + + #region Predicates + + bool endItemReachablePredicate(GameplayBeliefSet beliefSet) + { + Rigidbody playerRigidbody = beliefSet.PlayerRigidBody; + Vector3 target = beliefSet.EndItemPosition; + + NavMeshPath path = new(); + NavMesh.CalculatePath(playerRigidbody.position, target, NavMesh.AllAreas, path); + return path.status == NavMeshPathStatus.PathComplete; + } + + bool endItemPickedUpPredicate(GameplayBeliefSet beliefSet) + { + Inventory inventory = beliefSet.Inventory; + return inventory.ContainsItem(GameplayBeliefSet.EndItemName); + } + + bool playerIsInWinAreaPredicate(GameplayBeliefSet beliefSet) + { + Vector3 playerPos = beliefSet.PlayerRigidBody.Observation.position; + Vector3 centreOfWinArea = beliefSet.WinAreaPosition; + return Vector3.Distance(playerPos, centreOfWinArea) < 10f; // 10 is approximately the radius of the room + } + + #endregion + + #endregion + + #region fetchVisibleItem + + Action rotateInventory = new(beliefSet => beliefSet.Inventory.Observation.SwitchItem()); + Goal equipHealingPotion = new(rotateInventory.Lift(), + beliefSet => beliefSet.Inventory.Observation.EquippedItem is HealthPotion); + PrimitiveTactic equipRagePotion = new(rotateInventory, + beliefSet => beliefSet.Inventory.Observation.EquippedItem is not RagePotion); + + Action useEquippedItemAction = new(beliefSet => beliefSet.Inventory.Observation.ActivateItem()); + bool hasNotYetUsedEquippedItem = true; + bool hasUsedEquippedItem = false; + PrimitiveTactic useEquippedItemTactic = new(useEquippedItemAction, + _ => hasNotYetUsedEquippedItem = !hasNotYetUsedEquippedItem); + Goal useEquippedItemGoal = new(useEquippedItemAction.Lift(), + _ => hasUsedEquippedItem = !hasUsedEquippedItem); + + SequentialGoalStructure restoreHealth = Seq(equipHealingPotion.Lift(), useEquippedItemGoal.Lift()); + Tactic useRagePotion = FirstOf(equipRagePotion, useEquippedItemTactic); + + + TransformPathfinderAction moveToVisibleHealthPotionAction = new( + beliefSet => beliefSet.PlayerRigidBody, + beliefSet => beliefSet.VisibleHealthPotions.Observation + .Select(x => x.transform.position) + .OrderBy(x => Vector3.Distance(x, beliefSet.PlayerRigidBody.Observation.position)) // TODO distance is already calculated + .First(), + 0.3f); + TransformPathfinderAction moveToVisibleRagePotionAction = new( + beliefSet => beliefSet.PlayerRigidBody, + beliefSet => beliefSet.VisibleRagePotions.Observation + .Select(x => x.transform.position) + .OrderBy(x => Vector3.Distance(x, beliefSet.PlayerRigidBody.Observation.position)) + .First(), + 0.3f); + TransformPathfinderAction moveToVisibleAmmoAction = new( + beliefSet => beliefSet.PlayerRigidBody, + beliefSet => beliefSet.VisibleAmmo.Observation + .Select(x => x.item.transform.position) + .OrderBy(x => Vector3.Distance(x, beliefSet.PlayerRigidBody.Observation.position)) + .First(), + 0.3f); + TransformPathfinderAction moveToVisibleKeyAction = new( + beliefSet => beliefSet.PlayerRigidBody, + beliefSet => beliefSet.VisibleKeys.Observation + .Select(x => x.item.transform.position) + .OrderBy(x => Vector3.Distance(x, beliefSet.PlayerRigidBody.Observation.position)) + .First(), + 0.3f); + + PrimitiveTactic pickUpVisibleHealthPotion = new(moveToVisibleHealthPotionAction, + beliefSet => beliefSet.VisibleHealthPotions.Observation.Length != 0); + PrimitiveTactic pickUpVisibleRagePotion = new(moveToVisibleRagePotionAction, + beliefSet => beliefSet.VisibleRagePotions.Observation.Length != 0); + PrimitiveTactic pickUpVisibleAmmo = new(moveToVisibleAmmoAction, + beliefSet => beliefSet.VisibleAmmo.Observation.Length != 0); + PrimitiveTactic pickUpVisibleKey = new(moveToVisibleKeyAction, + beliefSet => beliefSet.VisibleKeys.Observation.Length != 0); + + Tactic fetchPotionIfDistancedMelee = FirstOf(guard: beliefSet => + beliefSet.DetermineEnemyToFocus(out float distance) is MeleeEnemy && distance > 5 && + ((!beliefSet.Inventory.Observation.ContainsItem() && + beliefSet.VisibleRagePotions.Observation.Length != 0) || + (beliefSet.PlayerHealthPercentage.Observation < 30 && + beliefSet.VisibleHealthPotions.Observation.Length != 0)), + pickUpVisibleHealthPotion, pickUpVisibleRagePotion); + + Tactic fetchVisibleItem = FirstOf(pickUpVisibleHealthPotion, pickUpVisibleRagePotion, pickUpVisibleAmmo, pickUpVisibleKey); + GoalStructure fetchVisibleItemGoal = new Goal(fetchVisibleItem, beliefSet => !beliefSet.AnyItemIsVisible); + + #endregion + + #region reactToEnemy + + Action stepAsideRightAction = new(beliefSet => + { + Rigidbody playerRigidBody = beliefSet.PlayerRigidBody; + playerRigidBody.AddForce(playerRigidBody.transform.right * 10, ForceMode.VelocityChange); + }); + Action stepAsideLeftAction = new(beliefSet => + { + Rigidbody playerRigidBody = beliefSet.PlayerRigidBody; + playerRigidBody.AddForce(playerRigidBody.transform.right * -10, ForceMode.VelocityChange); + }); + PrimitiveTactic stepAsideLeft = new(stepAsideLeftAction, beliefSet => + { + Rigidbody playerRigidBody = beliefSet.PlayerRigidBody; + + Vector3 left = playerRigidBody.transform.TransformDirection(Vector3.left); + return Physics.Raycast(playerRigidBody.transform.position, left, 0.5f, + ~LayerMask.GetMask("PlayerSelf", "Item", "Ignore Raycast")); + }); + PrimitiveTactic stepAsideRight = new(stepAsideRightAction, beliefSet => + { + Rigidbody playerRigidBody = beliefSet.PlayerRigidBody; + + Vector3 left = playerRigidBody.transform.TransformDirection(Vector3.right); + return Physics.Raycast(playerRigidBody.transform.position, left, 0.5f, + ~LayerMask.GetMask("PlayerSelf", "Item", "Ignore Raycast")); + }); + + Tactic dodgeCrossbow = FirstOf(guard: beliefSet => + { + AbstractEnemy enemy = beliefSet.DetermineEnemyToFocus(out _); + return enemy is RangedEnemy && enemy.IsTriggered(); + }, + stepAsideLeft, stepAsideRight); + + Tactic fetchAmmo = FirstOf(guard: beliefSet => + { + AbstractEnemy enemy = beliefSet.DetermineEnemyToFocus(out float enemyDistance); + + return enemy is RangedEnemy + && beliefSet.AmmoCount < 4 + && beliefSet.VisibleAmmo.Observation.Length != 0 + && beliefSet.VisibleAmmo.Observation.Min(x => x.distance) < enemyDistance / 3; + }, + pickUpVisibleAmmo); + + Tactic useRagePotionIfUseful = FirstOf(guard: + beliefSet => beliefSet.DetermineEnemyToFocus(out float enemyDistance) != null + && enemyDistance < 9 + && beliefSet.Inventory.Observation.ContainsItem(), + useRagePotion); + + Action aimAndHitEnemyAction = new(beliefSet => + { + Transform playerRotation = beliefSet.PlayerRotation.Observation.transform; + Vector3 enemyPosition = beliefSet.DetermineEnemyToFocus(out _).transform.position; + playerRotation.transform.LookAt(enemyPosition); // Weapon viewpoint should be set to player rotation in editor + beliefSet.MeleeWeapon.Observation.UseWeapon(); + beliefSet.Animator.Observation.SetTrigger("PlayerAttack"); + }); + + Action switchWeapon = new(beliefSet => beliefSet.EquipmentInventory.Observation.MoveNext()); + PrimitiveTactic equipCrossbow = new(switchWeapon, + beliefSet => beliefSet.EquipmentInventory.Observation.CurrentEquipment is not RangedWeapon); + PrimitiveTactic equipBat = new(switchWeapon, + beliefSet => beliefSet.EquipmentInventory.Observation.CurrentEquipment is not MeleeWeapon); + + TransformPathfinderAction approachEnemyAction = new( + beliefSet => beliefSet.PlayerRigidBody, + beliefSet => beliefSet.DetermineEnemyToFocus(out _).transform.position, + 0.3f + ); + PrimitiveTactic approachEnemyToShoot = new(approachEnemyAction, beliefSet => + { + _ = beliefSet.DetermineEnemyToFocus(out float distance); + return distance > beliefSet.RangedWeapon.Observation.Range; + }); + Action aimAndShootCrossbowAction = new(beliefSet => + { + Transform playerRotation = beliefSet.PlayerRotation.Observation.transform; + Vector3 enemyPosition = beliefSet.DetermineEnemyToFocus(out _).transform.position; + playerRotation.transform.LookAt(enemyPosition); // Weapon viewpoint should be set to player rotation in editor + beliefSet.RangedWeapon.Observation.UseWeapon(); + beliefSet.Animator.Observation.SetTrigger("PlayerAttack"); + }); + Tactic shootEnemy = FirstOf(guard: beliefSet => + { + AbstractEnemy enemyToFocus = beliefSet.DetermineEnemyToFocus(out float enemyDistance); + return enemyToFocus != null + && beliefSet.AmmoCount > 0 + && enemyDistance > beliefSet.MeleeWeapon.Observation.Range + && (enemyToFocus is RangedEnemy || enemyToFocus is MeleeEnemy && beliefSet.AmmoCount > 3); + }, equipCrossbow, approachEnemyToShoot, aimAndShootCrossbowAction.Lift()); + + PrimitiveTactic approachEnemyToMelee = new(approachEnemyAction, beliefSet => + { + _ = beliefSet.DetermineEnemyToFocus(out float distance); + return distance > beliefSet.MeleeWeapon.Observation.Range; + }); + + Tactic hitEnemy = FirstOf(equipBat, approachEnemyToMelee, aimAndHitEnemyAction.Lift()); + + Tactic reactToEnemyTactic = FirstOf(fetchPotionIfDistancedMelee, dodgeCrossbow, fetchAmmo, useRagePotionIfUseful, shootEnemy, hitEnemy); + GoalStructure reactToEnemy = new Goal(reactToEnemyTactic, beliefSet => !beliefSet.AnyEnemyVisible || beliefSet.DetermineEnemyToFocus(out _) == null); + + #endregion + + + DesireSet desireSet = new( + mainGoal: fetchElixir, // Fetch the elixir and bring it to the final room + sideGoals: new (IGoalStructure, InterruptGuard)[] + { + // But, when an item can be picked up, do so + (fetchVisibleItemGoal, beliefSet => + beliefSet.AnyItemIsVisible), + + // But, when an enemy is visible, react to it + (reactToEnemy, beliefSet => + beliefSet.AnyEnemyVisible && beliefSet.DetermineEnemyToFocus(out _) != null), + + // But, when low on health and in possession of a healing potion, drink the potion + (restoreHealth, beliefSet => + beliefSet.PlayerHealthPercentage.Observation < 60 + && beliefSet.Inventory.Observation.ContainsItem()), + }); + + // Act + BdiAgent agent = new(mainBeliefSet, desireSet); + AplibRunner testRunner = new(agent); + + yield return testRunner.Test(); + + // Assert + Assert.AreEqual(CompletionStatus.Success, agent.Status); + } + /// /// Given that the smart agent mimics realistic gameplay, /// When the agent is tasked to complete the game from start to end, @@ -317,7 +595,6 @@ public void SetUp() [Timeout(300000)] public IEnumerator RealisticGameplayCanWinTheGame() { - InputManager.Instance.enabled = false; GameplayBeliefSet mainBeliefSet = new(); #region fetchElixir @@ -451,15 +728,24 @@ bool playerIsInWinAreaPredicate(GameplayBeliefSet beliefSet) #region reactToEnemy + float wakeUpTimeStamp = -1; + const float sleepDuration = 0.3f; // seconds + Action sleepAction = new(beliefSet => + { + Transform playerRotation = beliefSet.PlayerRotation.Observation.transform; + Vector3 enemyPosition = beliefSet.DetermineEnemyToFocus(out _).transform.position; + playerRotation.transform.LookAt(enemyPosition); // Weapon viewpoint should be set to player rotation in editor + } ); + PrimitiveTactic sleep = new(sleepAction, _ => Time.time < wakeUpTimeStamp); + + Action stepAsideRightAction = new(beliefSet => { - Debug.Log("Dodging right!"); Rigidbody playerRigidBody = beliefSet.PlayerRigidBody; playerRigidBody.AddForce(playerRigidBody.transform.right * 10, ForceMode.VelocityChange); }); Action stepAsideLeftAction = new(beliefSet => { - Debug.Log("Dodging left!"); Rigidbody playerRigidBody = beliefSet.PlayerRigidBody; playerRigidBody.AddForce(playerRigidBody.transform.right * -10, ForceMode.VelocityChange); }); @@ -510,6 +796,7 @@ bool playerIsInWinAreaPredicate(GameplayBeliefSet beliefSet) Vector3 enemyPosition = beliefSet.DetermineEnemyToFocus(out _).transform.position; playerRotation.transform.LookAt(enemyPosition); // Weapon viewpoint should be set to player rotation in editor beliefSet.MeleeWeapon.Observation.UseWeapon(); + wakeUpTimeStamp = Time.time + sleepDuration; beliefSet.Animator.Observation.SetTrigger("PlayerAttack"); }); @@ -535,6 +822,7 @@ bool playerIsInWinAreaPredicate(GameplayBeliefSet beliefSet) Vector3 enemyPosition = beliefSet.DetermineEnemyToFocus(out _).transform.position; playerRotation.transform.LookAt(enemyPosition); // Weapon viewpoint should be set to player rotation in editor beliefSet.RangedWeapon.Observation.UseWeapon(); + wakeUpTimeStamp = Time.time + sleepDuration; beliefSet.Animator.Observation.SetTrigger("PlayerAttack"); }); Tactic shootEnemy = FirstOf(guard: beliefSet => From d72c0e43180c74bb84eaac00d3146e6c7c73c813 Mon Sep 17 00:00:00 2001 From: SilasPeters <69711739+SilasPeters@users.noreply.github.com> Date: Mon, 24 Jun 2024 13:19:36 +0200 Subject: [PATCH 7/8] chore: process feedback --- aplib.net-demo/Assets/Scripts/Items/HealthPotion.cs | 1 - aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/aplib.net-demo/Assets/Scripts/Items/HealthPotion.cs b/aplib.net-demo/Assets/Scripts/Items/HealthPotion.cs index 485d7f60..b65fe1cd 100644 --- a/aplib.net-demo/Assets/Scripts/Items/HealthPotion.cs +++ b/aplib.net-demo/Assets/Scripts/Items/HealthPotion.cs @@ -30,7 +30,6 @@ public override void UseItem() base.UseItem(); _playerHealth.IncreaseHealth(_healAmount); Instantiate(_playerEffect, _playerHealth.transform); - Debug.Log($"Healed player with {_healAmount}"); } } } diff --git a/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs b/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs index 47eb2c44..6494728a 100644 --- a/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs +++ b/aplib.net-demo/Assets/Testing/AplibTests/GameplayTests.cs @@ -263,9 +263,11 @@ public AbstractEnemy DetermineEnemyToFocus(out float distance) #region HelperMethodsAndTypes private static bool ItemVisibleFrom(Item item, Vector3 origin, out float itemDistance) + // Tests if vision has been obstructed towards the item, where the Player, Item and Ignore Raycast layers do not count to being obstructed => IsVisibleFrom(item.transform.position, origin, ~LayerMask.GetMask("PlayerSelf", "Item", "Ignore Raycast"), out itemDistance); private static bool EnemyVisibleFrom(AbstractEnemy enemy, Vector3 origin, out float enemyDistance) + // Tests if vision has been obstructed towards the enemy, where the Player, Enemy and Ignore Raycast layers do not count to being obstructed => IsVisibleFrom(enemy.transform.position, origin, ~LayerMask.GetMask("PlayerSelf", "Enemy", "Ignore Raycast"), out enemyDistance); private static bool IsVisibleFrom(Vector3 target, Vector3 origin, LayerMask layerMask, out float enemyDistance) @@ -466,6 +468,7 @@ bool playerIsInWinAreaPredicate(GameplayBeliefSet beliefSet) Vector3 left = playerRigidBody.transform.TransformDirection(Vector3.left); return Physics.Raycast(playerRigidBody.transform.position, left, 0.5f, + // Tests if anything towards the left can collide within 0.5m. Do not collide with said layermasks ~LayerMask.GetMask("PlayerSelf", "Item", "Ignore Raycast")); }); PrimitiveTactic stepAsideRight = new(stepAsideRightAction, beliefSet => @@ -474,6 +477,7 @@ bool playerIsInWinAreaPredicate(GameplayBeliefSet beliefSet) Vector3 left = playerRigidBody.transform.TransformDirection(Vector3.right); return Physics.Raycast(playerRigidBody.transform.position, left, 0.5f, + // Tests if anything towards the right can collide within 0.5m. Do not collide with said layermasks ~LayerMask.GetMask("PlayerSelf", "Item", "Ignore Raycast")); }); @@ -755,6 +759,7 @@ bool playerIsInWinAreaPredicate(GameplayBeliefSet beliefSet) Vector3 left = playerRigidBody.transform.TransformDirection(Vector3.left); return Physics.Raycast(playerRigidBody.transform.position, left, 0.5f, + // Tests if anything towards the left can collide within 0.5m. Do not collide with said layermasks ~LayerMask.GetMask("PlayerSelf", "Item", "Ignore Raycast")); }); PrimitiveTactic stepAsideRight = new(stepAsideRightAction, beliefSet => @@ -763,6 +768,7 @@ bool playerIsInWinAreaPredicate(GameplayBeliefSet beliefSet) Vector3 left = playerRigidBody.transform.TransformDirection(Vector3.right); return Physics.Raycast(playerRigidBody.transform.position, left, 0.5f, + // Tests if anything towards the right can collide within 0.5m. Do not collide with said layermasks ~LayerMask.GetMask("PlayerSelf", "Item", "Ignore Raycast")); }); From 337b5310834e46f2cd03830a3a7c02dde9bfbc32 Mon Sep 17 00:00:00 2001 From: SilasPeters <69711739+SilasPeters@users.noreply.github.com> Date: Mon, 24 Jun 2024 13:20:18 +0200 Subject: [PATCH 8/8] fix: adjusted scene brightness --- aplib.net-demo/Assets/Scenes/TestScenes/GameplayTestScene.unity | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aplib.net-demo/Assets/Scenes/TestScenes/GameplayTestScene.unity b/aplib.net-demo/Assets/Scenes/TestScenes/GameplayTestScene.unity index 97945c65..1fc7e7bf 100644 --- a/aplib.net-demo/Assets/Scenes/TestScenes/GameplayTestScene.unity +++ b/aplib.net-demo/Assets/Scenes/TestScenes/GameplayTestScene.unity @@ -20,7 +20,7 @@ RenderSettings: m_FogDensity: 0.01 m_LinearFogStart: 0 m_LinearFogEnd: 300 - m_AmbientSkyColor: {r: 1, g: 1, b: 1, a: 1} + m_AmbientSkyColor: {r: 0.76430756, g: 0.76430756, b: 0.76430756, a: 1} m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} m_AmbientIntensity: 1