From cc20964c12a62dc88bb6c0e244aab517cbe6e2ad Mon Sep 17 00:00:00 2001 From: Jason Durand 01 Date: Sat, 2 Apr 2022 14:31:42 -0400 Subject: [PATCH 01/15] Recopied SampleScene to JasonScene --- Assets/Scenes/JasonScene.unity | 492 +++++++++++++++++++++++----- Assets/Scenes/JasonScene.unity.meta | 2 +- 2 files changed, 418 insertions(+), 76 deletions(-) diff --git a/Assets/Scenes/JasonScene.unity b/Assets/Scenes/JasonScene.unity index 874c018..70122c9 100644 --- a/Assets/Scenes/JasonScene.unity +++ b/Assets/Scenes/JasonScene.unity @@ -72,21 +72,21 @@ LightmapSettings: m_FinalGatherRayCount: 256 m_ReflectionCompression: 2 m_MixedBakeMode: 2 - m_BakeBackend: 1 + m_BakeBackend: 0 m_PVRSampling: 1 m_PVRDirectSampleCount: 32 - m_PVRSampleCount: 512 + m_PVRSampleCount: 500 m_PVRBounces: 2 - m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentSampleCount: 500 m_PVREnvironmentReferencePointCount: 2048 - m_PVRFilteringMode: 1 - m_PVRDenoiserTypeDirect: 1 - m_PVRDenoiserTypeIndirect: 1 - m_PVRDenoiserTypeAO: 1 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 m_PVRFilterTypeDirect: 0 m_PVRFilterTypeIndirect: 0 m_PVRFilterTypeAO: 0 - m_PVREnvironmentMIS: 1 + m_PVREnvironmentMIS: 0 m_PVRCulling: 1 m_PVRFilteringGaussRadiusDirect: 1 m_PVRFilteringGaussRadiusIndirect: 5 @@ -123,69 +123,18 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} ---- !u!4 &1483024674 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - m_PrefabInstance: {fileID: 1214567907777892293} +--- !u!114 &330576709 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1967503440015794769, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + m_PrefabInstance: {fileID: 1942557562} m_PrefabAsset: {fileID: 0} ---- !u!1001 &1214567907777892293 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1214567908930553593, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_Name - value: Vampire - objectReference: {fileID: 0} - - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_RootOrder - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} ---- !u!1001 &8365024800643098903 + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 56c3e06ea5db48a40a7f55e72291cb0d, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1001 &647315810 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 @@ -195,11 +144,11 @@ PrefabInstance: - target: {fileID: 8365024801073869718, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3} propertyPath: m_Follow value: - objectReference: {fileID: 1483024674} + objectReference: {fileID: 720678398} - target: {fileID: 8365024801073869718, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3} propertyPath: m_LookAt value: - objectReference: {fileID: 1483024674} + objectReference: {fileID: 720678398} - target: {fileID: 8365024801698166081, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3} propertyPath: m_RootOrder value: 0 @@ -214,7 +163,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8365024801698166081, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3} propertyPath: m_LocalPosition.z - value: 0 + value: -10 objectReference: {fileID: 0} - target: {fileID: 8365024801698166081, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3} propertyPath: m_LocalRotation.w @@ -250,16 +199,29 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3} ---- !u!1001 &9196727425198912291 +--- !u!4 &720678398 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + m_PrefabInstance: {fileID: 1942557562} + m_PrefabAsset: {fileID: 0} +--- !u!1001 &1359990804 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: m_TransformParent: {fileID: 0} m_Modifications: + - target: {fileID: -7596782781093632548, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} + propertyPath: gameFlowManager + value: + objectReference: {fileID: 1359990806} + - target: {fileID: 4164153230343464235, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} + propertyPath: globalCamera + value: + objectReference: {fileID: 1557338110} - target: {fileID: 9196727425507610130, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} propertyPath: m_RootOrder - value: 2 + value: 1 objectReference: {fileID: 0} - target: {fileID: 9196727425507610130, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} propertyPath: m_LocalPosition.x @@ -307,3 +269,383 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} +--- !u!1 &1359990805 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 9196727425507610131, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} + m_PrefabInstance: {fileID: 1359990804} + m_PrefabAsset: {fileID: 0} +--- !u!114 &1359990806 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1359990805} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e3fecdc4a8b2cb4419ef9d03180d130d, type: 3} + m_Name: + m_EditorClassIdentifier: + k__BackingField: 1 +--- !u!114 &1464970062 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1878107874314509256, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + m_PrefabInstance: {fileID: 1551362086} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: aadb67b8f73573a44b31b015f38561ee, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1001 &1551362086 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1878107874060227347, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_Name + value: UI Canvas + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_Pivot.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_Pivot.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874060227351, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874529155599, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1878107874529155599, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} +--- !u!114 &1551362087 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1878107873739935074, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + m_PrefabInstance: {fileID: 1551362086} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 81a29b049c6380f4abb3c18ed121efcd, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1557338110 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 3328484984159178892, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3} + m_PrefabInstance: {fileID: 647315810} + m_PrefabAsset: {fileID: 0} +--- !u!1001 &1942557562 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.size + value: 17 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[13].m_ActionId + value: d0405457-c534-4103-a0b6-cf113432b467 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[14].m_ActionId + value: 01a06960-a379-49e3-9d58-9b7c8effcb3d + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[15].m_ActionId + value: 65aa4e67-f805-47b9-adc0-444ca0e0bec8 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[16].m_ActionId + value: 5017bbb1-a56a-40c6-add6-2360873a6945 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[13].m_ActionName + value: Player/SwitchMinion[/Keyboard/q,/Keyboard/e,/XInputControllerWindows/leftShoulder,/XInputControllerWindows/rightShoulder] + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[14].m_ActionName + value: Player/Start[/XInputControllerWindows/start,/Keyboard/enter] + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[15].m_ActionName + value: Player/Accept[/XInputControllerWindows/buttonSouth,/XInputControllerWindows/start,/Keyboard/enter] + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[16].m_ActionName + value: Player/Throw[/Keyboard/r,/XInputControllerWindows/buttonNorth] + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[13].m_PersistentCalls.m_Calls.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[14].m_PersistentCalls.m_Calls.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[15].m_PersistentCalls.m_Calls.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[16].m_PersistentCalls.m_Calls.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[13].m_PersistentCalls.m_Calls.Array.data[0].m_Mode + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[14].m_PersistentCalls.m_Calls.Array.data[0].m_Mode + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[15].m_PersistentCalls.m_Calls.Array.data[0].m_Mode + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[16].m_PersistentCalls.m_Calls.Array.data[0].m_Mode + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[13].m_PersistentCalls.m_Calls.Array.data[0].m_Target + value: + objectReference: {fileID: 1551362087} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[14].m_PersistentCalls.m_Calls.Array.data[0].m_Target + value: + objectReference: {fileID: 1359990806} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[15].m_PersistentCalls.m_Calls.Array.data[0].m_Target + value: + objectReference: {fileID: 1359990806} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[16].m_PersistentCalls.m_Calls.Array.data[0].m_Target + value: + objectReference: {fileID: 330576709} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[13].m_PersistentCalls.m_Calls.Array.data[0].m_CallState + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[14].m_PersistentCalls.m_Calls.Array.data[0].m_CallState + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[15].m_PersistentCalls.m_Calls.Array.data[0].m_CallState + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[16].m_PersistentCalls.m_Calls.Array.data[0].m_CallState + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[13].m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: ChangeSelectedIcon + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[14].m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: OnStart + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[15].m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: OnAccept + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[16].m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: ToggleThrowMode + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[13].m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName + value: MinionBar, Assembly-CSharp + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[14].m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName + value: GameFlowManager, Assembly-CSharp + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[15].m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName + value: GameFlowManager, Assembly-CSharp + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[16].m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName + value: MinionThrower, Assembly-CSharp + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[13].m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName + value: UnityEngine.Object, UnityEngine + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[14].m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName + value: UnityEngine.Object, UnityEngine + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[15].m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName + value: UnityEngine.Object, UnityEngine + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_ActionEvents.Array.data[16].m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName + value: UnityEngine.Object, UnityEngine + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553592, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: gameFlowManager + value: + objectReference: {fileID: 1359990806} + - target: {fileID: 1214567908930553593, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_Name + value: Vampire + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1214567908930553595, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: m_SortingOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3126145803593047825, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: healthBar + value: + objectReference: {fileID: 1464970062} + - target: {fileID: 3126145803593047825, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: playerStats + value: + objectReference: {fileID: 11400000, guid: 12a626b5a296d934ba078d222ad6ba98, type: 2} + - target: {fileID: 3126145803593047825, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: gameFlowManager + value: + objectReference: {fileID: 1359990806} + - target: {fileID: 3126145803593047825, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: k__BackingField + value: 100 + objectReference: {fileID: 0} + m_RemovedComponents: + - {fileID: 7731321959366517533, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + m_SourcePrefab: {fileID: 100100000, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} diff --git a/Assets/Scenes/JasonScene.unity.meta b/Assets/Scenes/JasonScene.unity.meta index 5b8fe73..422fb60 100644 --- a/Assets/Scenes/JasonScene.unity.meta +++ b/Assets/Scenes/JasonScene.unity.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 762252a8d124bbb43ae04058a5d1658c +guid: 6a79b85d54b2044408b5b5a2ad3ae57d DefaultImporter: externalObjects: {} userData: From 3d804d9f44468fc854a24bca2d805a5c8c7821b1 Mon Sep 17 00:00:00 2001 From: Jason Durand 01 Date: Sat, 2 Apr 2022 14:49:11 -0400 Subject: [PATCH 02/15] Moved GameFlowManager to Scripts/ --- Assets/{ => Scripts}/GameFlowManager.cs | 0 Assets/{ => Scripts}/GameFlowManager.cs.meta | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename Assets/{ => Scripts}/GameFlowManager.cs (100%) rename Assets/{ => Scripts}/GameFlowManager.cs.meta (100%) diff --git a/Assets/GameFlowManager.cs b/Assets/Scripts/GameFlowManager.cs similarity index 100% rename from Assets/GameFlowManager.cs rename to Assets/Scripts/GameFlowManager.cs diff --git a/Assets/GameFlowManager.cs.meta b/Assets/Scripts/GameFlowManager.cs.meta similarity index 100% rename from Assets/GameFlowManager.cs.meta rename to Assets/Scripts/GameFlowManager.cs.meta From 25a10047ad5ba87980e933d90b43961e4114f1ae Mon Sep 17 00:00:00 2001 From: Jason Durand 01 Date: Sat, 2 Apr 2022 15:14:04 -0400 Subject: [PATCH 03/15] Added quick game timer --- Assets/Prefabs/UI Canvas.prefab | 153 +++++++++++++++++++++++++++++- Assets/Scenes/JasonScene.unity | 12 +++ Assets/Scripts/GameFlowManager.cs | 11 +++ Assets/Scripts/GameTimer.cs | 30 ++++++ Assets/Scripts/GameTimer.cs.meta | 11 +++ 5 files changed, 212 insertions(+), 5 deletions(-) create mode 100644 Assets/Scripts/GameTimer.cs create mode 100644 Assets/Scripts/GameTimer.cs.meta diff --git a/Assets/Prefabs/UI Canvas.prefab b/Assets/Prefabs/UI Canvas.prefab index d115d5f..a5bf11b 100644 --- a/Assets/Prefabs/UI Canvas.prefab +++ b/Assets/Prefabs/UI Canvas.prefab @@ -1,5 +1,152 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &344214375 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 344214376} + - component: {fileID: 344214379} + - component: {fileID: 344214378} + - component: {fileID: 344214377} + m_Layer: 5 + m_Name: Timer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &344214376 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 344214375} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1878107874060227351} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 10, y: -40} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0, y: 1} +--- !u!114 &344214379 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 344214375} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a53670f9cd399ea4a8ae3ed81b923aa8, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!222 &344214378 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 344214375} + m_CullTransparentMesh: 1 +--- !u!114 &344214377 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 344214375} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, 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_text: 00:00 + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4278190080 + m_fontColor: {r: 0, g: 0, b: 0, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 36 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 0 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} --- !u!1 &1878107873570787823 GameObject: m_ObjectHideFlags: 0 @@ -124,11 +271,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 81a29b049c6380f4abb3c18ed121efcd, type: 3} m_Name: m_EditorClassIdentifier: - minionTypes: - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} minionIconPrefab: {fileID: 1979632678310270257, guid: 2fee1ea5c97c5a04bb2c5f1f685fc92e, type: 3} --- !u!114 &1878107873739935075 MonoBehaviour: @@ -188,6 +330,7 @@ RectTransform: m_Children: - {fileID: 1878107874314509258} - {fileID: 1878107873739935084} + - {fileID: 344214376} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Scenes/JasonScene.unity b/Assets/Scenes/JasonScene.unity index 70122c9..f4f0a0a 100644 --- a/Assets/Scenes/JasonScene.unity +++ b/Assets/Scenes/JasonScene.unity @@ -134,6 +134,17 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 56c3e06ea5db48a40a7f55e72291cb0d, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!114 &344214379 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 344214379, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + m_PrefabInstance: {fileID: 1551362086} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a53670f9cd399ea4a8ae3ed81b923aa8, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1001 &647315810 PrefabInstance: m_ObjectHideFlags: 0 @@ -286,6 +297,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: e3fecdc4a8b2cb4419ef9d03180d130d, type: 3} m_Name: m_EditorClassIdentifier: + gameTimer: {fileID: 344214379} k__BackingField: 1 --- !u!114 &1464970062 stripped MonoBehaviour: diff --git a/Assets/Scripts/GameFlowManager.cs b/Assets/Scripts/GameFlowManager.cs index a688d84..ce6df7e 100644 --- a/Assets/Scripts/GameFlowManager.cs +++ b/Assets/Scripts/GameFlowManager.cs @@ -1,9 +1,12 @@ +using NaughtyAttributes; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.SceneManagement; //Could be a singleton public class GameFlowManager : MonoBehaviour { + [SerializeField] [Required] + GameTimer gameTimer = null!; /// /// True if time is frozen (Start, Pause Menu, Dead) /// @@ -80,8 +83,16 @@ public class GameFlowManager : MonoBehaviour { public override void EnterState() { base.EnterState(); + + gameFlowManager.gameTimer.StartTimer(); gameFlowManager.SetPause(false); } + + public override void LeaveState() { + base.LeaveState(); + + gameFlowManager.gameTimer.PauseTimer(); + } } class PauseMenuFlowState : GameFlowState { public PauseMenuFlowState(GameFlowManager gameFlowManager) : base(gameFlowManager) {} diff --git a/Assets/Scripts/GameTimer.cs b/Assets/Scripts/GameTimer.cs new file mode 100644 index 0000000..d901c0d --- /dev/null +++ b/Assets/Scripts/GameTimer.cs @@ -0,0 +1,30 @@ +using System; +using TMPro; +using UnityEngine; + +public class GameTimer : MonoBehaviour { + TMP_Text label; + float timer; + bool stopped; + + void Awake() { + label = GetComponent(); + stopped = true; + } + + public void StartTimer() { + timer = Time.time; + stopped = false; + } + + public void PauseTimer() => stopped = true; + + void Update() { + if (stopped) + return; + + timer += Time.deltaTime; + label.text = TimeSpan.FromSeconds(timer) + .ToString(@"mm\:ss"); + } +} \ No newline at end of file diff --git a/Assets/Scripts/GameTimer.cs.meta b/Assets/Scripts/GameTimer.cs.meta new file mode 100644 index 0000000..f104860 --- /dev/null +++ b/Assets/Scripts/GameTimer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a53670f9cd399ea4a8ae3ed81b923aa8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From a7a29f4cce34575d018ebaebaa5fdcc58a32fcdc Mon Sep 17 00:00:00 2001 From: Jason Durand 01 Date: Sat, 2 Apr 2022 15:50:30 -0400 Subject: [PATCH 04/15] Started adding AIEntity's ThrownState --- Assets/Scripts/AIEntity.cs | 61 ++++++++++++++++++++++++++++++++ Assets/Scripts/AIStats.cs | 6 ++++ Assets/Scripts/Entity.cs | 2 +- Assets/Scripts/EntityStats.cs | 2 +- Assets/Scripts/PlayerMovement.cs | 10 ++---- Assets/Scripts/Utils.cs | 9 ++++- 6 files changed, 79 insertions(+), 11 deletions(-) diff --git a/Assets/Scripts/AIEntity.cs b/Assets/Scripts/AIEntity.cs index db0b678..2f58539 100644 --- a/Assets/Scripts/AIEntity.cs +++ b/Assets/Scripts/AIEntity.cs @@ -16,6 +16,67 @@ public class AIEntity : Entity } } + /*//Basically a copy of JumpingMovementState + class NonPhysicThrownState : BaseStateAI { + readonly Vector3 target; + + Vector3 startPosition; + float duration; + float startTime; + + public NonPhysicThrownState(AIEntity entity, Vector3 target) : base(entity) { + this.target = target; + } + + public override void EnterState() { + base.EnterState(); + + duration = entity.AIStats.ThrownDurationPerMeter * Vector3.Distance(entity.transform.position, target); + startPosition = entity.transform.position; + startTime = Time.time; + entity.rb.SetEnabled(false); + } + + public override void LeaveState() { + base.LeaveState(); + entity.rb.SetEnabled(true); + } + + public override BaseState? FixedUpdateState() { + float currentTime = Time.time - startTime; + if (currentTime >= duration) + return new FindTargetState(entity); + + entity.rb.MovePosition(Vector3.Lerp( + startPosition, + target, + entity.AIStats.ThrownCurve.Evaluate(currentTime / duration) + )); + + return null; + } + }*/ + + class ThrownState : BaseStateAI { + public ThrownState(AIEntity entity) : base(entity) {} + + public override void EnterState() { + base.EnterState(); + + entity.rb.SetEnabled(false); + } + + public override void LeaveState() { + base.LeaveState(); + entity.rb.SetEnabled(true); + } + + public override BaseState? FixedUpdateState() + => entity.rb.velocity.magnitude < entity.stats.MinVelocityWhenThrown + ? new FindTargetState(entity) + : null; + } + class SeekState : BaseStateAI{ public SeekState(AIEntity entity) : base(entity){ diff --git a/Assets/Scripts/AIStats.cs b/Assets/Scripts/AIStats.cs index e1d503a..2879e1b 100644 --- a/Assets/Scripts/AIStats.cs +++ b/Assets/Scripts/AIStats.cs @@ -3,4 +3,10 @@ using UnityEngine; [CreateAssetMenu] public class AIStats : ScriptableObject { public float closeEnough = 1f; + + [field: SerializeField] + public AnimationCurve ThrownCurve { get; } + + [field: SerializeField] + public float ThrownDurationPerMeter { get; } } \ No newline at end of file diff --git a/Assets/Scripts/Entity.cs b/Assets/Scripts/Entity.cs index 72f9457..51b1034 100644 --- a/Assets/Scripts/Entity.cs +++ b/Assets/Scripts/Entity.cs @@ -39,7 +39,7 @@ public class Entity : MonoBehaviour protected virtual void FixedUpdate() { //TODO sqrMagnitude? - if (beingPushed && rb.velocity.magnitude < stats.MinVelocityWhenPushed) { + if (beingPushed && rb.velocity.magnitude < stats.MinVelocityWhenThrown) { rb.velocity = Vector2.zero; beingPushed = false; } diff --git a/Assets/Scripts/EntityStats.cs b/Assets/Scripts/EntityStats.cs index 654e200..6f841c8 100644 --- a/Assets/Scripts/EntityStats.cs +++ b/Assets/Scripts/EntityStats.cs @@ -2,5 +2,5 @@ public class EntityStats { [field: SerializeField] [field: Min(0f)] - public float MinVelocityWhenPushed { get; private set; } = 5f; + public float MinVelocityWhenThrown { get; private set; } = 5f; } \ No newline at end of file diff --git a/Assets/Scripts/PlayerMovement.cs b/Assets/Scripts/PlayerMovement.cs index 21dc09f..0cb8f80 100644 --- a/Assets/Scripts/PlayerMovement.cs +++ b/Assets/Scripts/PlayerMovement.cs @@ -91,12 +91,6 @@ public class PlayerMovement : MonoBehaviour { safeZone = null; } - void SetRigidbodyEnabled(bool enabled) { - rb.velocity = Vector2.zero; - rb.angularVelocity = 0f; - rb.isKinematic = !enabled; - } - #endregion #region States @@ -171,7 +165,7 @@ public class PlayerMovement : MonoBehaviour { base.EnterState(); safeZone.EnterSafeZone(); - playerMovement.SetRigidbodyEnabled(false); + playerMovement.rb.SetEnabled(false); } protected override BaseState Transition() => new ImmobileMovementState(playerMovement); @@ -190,7 +184,7 @@ public class PlayerMovement : MonoBehaviour { base.EnterState(); safeZone.ExitSafeZone(); - playerMovement.SetRigidbodyEnabled(true); + playerMovement.rb.SetEnabled(true); } protected override float ModifyLerpTime(float t) => safeZone.Stats.JumpSpeedCurve.Evaluate(t); diff --git a/Assets/Scripts/Utils.cs b/Assets/Scripts/Utils.cs index 32f7c6b..f2fdfd3 100644 --- a/Assets/Scripts/Utils.cs +++ b/Assets/Scripts/Utils.cs @@ -1,4 +1,5 @@ -using UnityEngine.InputSystem; +using UnityEngine; +using UnityEngine.InputSystem; public static class Utils { public static bool WasPressedThisFrame(this InputAction.CallbackContext ctx, ref bool lastValue) { @@ -8,4 +9,10 @@ public static class Utils { return wasJustPressed; } + + public static void SetEnabled(this Rigidbody2D rb, bool enabled) { + rb.velocity = Vector2.zero; + rb.angularVelocity = 0f; + rb.isKinematic = !enabled; + } } \ No newline at end of file From c74dbe3aef6567c87539a7b5b67a51ef4e47c7f7 Mon Sep 17 00:00:00 2001 From: Soulaha Balde Date: Sat, 2 Apr 2022 16:21:11 -0400 Subject: [PATCH 05/15] wait before going into normal arena spawn rate --- Assets/Scripts/Arena Stats.asset | 2 +- Assets/Scripts/Arena.cs | 2 +- Assets/Scripts/ArenaStats.cs | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Arena Stats.asset b/Assets/Scripts/Arena Stats.asset index d412c84..8a67059 100644 --- a/Assets/Scripts/Arena Stats.asset +++ b/Assets/Scripts/Arena Stats.asset @@ -12,4 +12,4 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 8de175900b604adb984b49af64538a07, type: 3} m_Name: Arena Stats m_EditorClassIdentifier: - secondsBetweenSpawners: 3 + secondsBetweenSpawners: 10 diff --git a/Assets/Scripts/Arena.cs b/Assets/Scripts/Arena.cs index 6ec7ed2..3ac4267 100644 --- a/Assets/Scripts/Arena.cs +++ b/Assets/Scripts/Arena.cs @@ -31,7 +31,7 @@ public class Arena : MonoBehaviour { } IEnumerator SpawnEnemies() { - yield return new WaitForSeconds(stats.secondsBetweenSpawners); + yield return new WaitForSeconds(stats.initWaitToSpawn); int currentSpawner = 0; diff --git a/Assets/Scripts/ArenaStats.cs b/Assets/Scripts/ArenaStats.cs index 480974d..d4a6f91 100644 --- a/Assets/Scripts/ArenaStats.cs +++ b/Assets/Scripts/ArenaStats.cs @@ -3,4 +3,5 @@ [CreateAssetMenu] public class ArenaStats : ScriptableObject { [Min(0f)] public float secondsBetweenSpawners = 3f; + [Min(0f)] public float initWaitToSpawn = 3f; } \ No newline at end of file From bac85ff90f512d1c04636c464d7670692ed9ce62 Mon Sep 17 00:00:00 2001 From: Soulaha Balde Date: Sat, 2 Apr 2022 16:41:34 -0400 Subject: [PATCH 06/15] Gladiators stop targeting vampire if monster hit --- Assets/Scripts/AIEntity.cs | 11 ++++++++++- Assets/Scripts/Entity.cs | 2 +- Assets/Scripts/MinionThrower.cs | 2 +- Assets/Scripts/VampireEntity.cs | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/AIEntity.cs b/Assets/Scripts/AIEntity.cs index dc29f9f..fd8fd6b 100644 --- a/Assets/Scripts/AIEntity.cs +++ b/Assets/Scripts/AIEntity.cs @@ -47,6 +47,15 @@ public class AIEntity : Entity return false; } + + override public bool TakeDamage(float amount, Entity other){ + Entity currTargetEntity = GetTarget().GetComponent(); + if(!(currTargetEntity is null)){ + if(currTargetEntity.entityName == "Vampire") + SetTarget(other.transform); + } + return base.TakeDamage(amount, other); + } abstract class BaseStateAI : BaseState{ protected AIEntity entity; @@ -163,7 +172,7 @@ public class AIEntity : Entity private BaseState? Attack(){ Entity targetEntity = entity.GetTarget().GetComponent(); if(targetEntity != null){ - targetEntity.TakeDamage(entity.attackDmg); + targetEntity.TakeDamage(entity.attackDmg, entity); bool isTargetAlive = targetEntity.IsAlive(); if(!isTargetAlive){ return new FindTargetState(entity); diff --git a/Assets/Scripts/Entity.cs b/Assets/Scripts/Entity.cs index 964a492..538caad 100644 --- a/Assets/Scripts/Entity.cs +++ b/Assets/Scripts/Entity.cs @@ -80,7 +80,7 @@ public class Entity : MonoBehaviour { } //Apply damage to the entity, returns true if it is still alive - public virtual bool TakeDamage(float amount) { + public virtual bool TakeDamage(float amount, Entity other) { Health -= amount; healthBar.SetHealthFraction(Health / initialHealth); diff --git a/Assets/Scripts/MinionThrower.cs b/Assets/Scripts/MinionThrower.cs index 759ce59..c9d3f90 100644 --- a/Assets/Scripts/MinionThrower.cs +++ b/Assets/Scripts/MinionThrower.cs @@ -59,7 +59,7 @@ public class MinionThrower : MonoBehaviour { if(minionHealthCost >= vampireEntity.Health) { return; } - vampireEntity.TakeDamage(minionHealthCost); + vampireEntity.TakeDamage(minionHealthCost, vampireEntity); currentInitialCooldown = 2f; // TODO currentCooldownTimer = currentInitialCooldown; diff --git a/Assets/Scripts/VampireEntity.cs b/Assets/Scripts/VampireEntity.cs index 85afed0..c426a6a 100644 --- a/Assets/Scripts/VampireEntity.cs +++ b/Assets/Scripts/VampireEntity.cs @@ -21,7 +21,7 @@ public class VampireEntity : Entity { if (gameFlowManager.Paused) return; - TakeDamage(playerStats.bloodLossRate * Time.deltaTime); + TakeDamage(playerStats.bloodLossRate * Time.deltaTime, this); } // public override void TakeDamage(float amount) { From 1fc46498d4ca1fdf4e06879f9b933e4fcd69e8d7 Mon Sep 17 00:00:00 2001 From: Soulaha Balde Date: Sat, 2 Apr 2022 16:53:58 -0400 Subject: [PATCH 07/15] Tweak values: Vampire movement speed Blood loss rate AI hp --- Assets/Prefabs/Gladiator.prefab | 2 +- Assets/Prefabs/Monster.prefab | 2 +- Assets/Scripts/Player Stats.asset | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Assets/Prefabs/Gladiator.prefab b/Assets/Prefabs/Gladiator.prefab index 59c37d9..8437100 100644 --- a/Assets/Prefabs/Gladiator.prefab +++ b/Assets/Prefabs/Gladiator.prefab @@ -99,7 +99,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: gameFlowManager: {fileID: 0} - k__BackingField: 100 + k__BackingField: 40 healthBar: {fileID: 1378753993005748510} bloodTokens: 1 k__BackingField: 2 diff --git a/Assets/Prefabs/Monster.prefab b/Assets/Prefabs/Monster.prefab index d7a7bfa..99d8895 100644 --- a/Assets/Prefabs/Monster.prefab +++ b/Assets/Prefabs/Monster.prefab @@ -181,7 +181,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: gameFlowManager: {fileID: 0} - k__BackingField: 100 + k__BackingField: 40 healthBar: {fileID: 7668921808924868904} bloodTokens: 0 k__BackingField: 2 diff --git a/Assets/Scripts/Player Stats.asset b/Assets/Scripts/Player Stats.asset index 7be6b71..54d8bf9 100644 --- a/Assets/Scripts/Player Stats.asset +++ b/Assets/Scripts/Player Stats.asset @@ -12,6 +12,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 5a9c2f4541a74e86afc424d568e0f629, type: 3} m_Name: Player Stats m_EditorClassIdentifier: - movementSpeed: 3 + movementSpeed: 4 suckSpeed: 1 - bloodLossRate: 3 + bloodLossRate: 2 From e3aba142c86a22ab332aa550dac68bc2e25153c1 Mon Sep 17 00:00:00 2001 From: Yann Dupont 01 Date: Sat, 2 Apr 2022 17:14:56 -0400 Subject: [PATCH 08/15] merge yann --- Assets/Scenes/SampleScene.unity | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 651d107..1862ae6 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -211,6 +211,10 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 0} m_Modifications: + - target: {fileID: 1359990806, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} + propertyPath: startPrompt + value: + objectReference: {fileID: 1551362088} - target: {fileID: 4164153230343464235, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} propertyPath: globalCamera value: @@ -403,6 +407,16 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 81a29b049c6380f4abb3c18ed121efcd, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &1551362088 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 1844274959428875625, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + m_PrefabInstance: {fileID: 1551362086} + m_PrefabAsset: {fileID: 0} +--- !u!1 &1551362089 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 763564871199756608, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + m_PrefabInstance: {fileID: 1551362086} + m_PrefabAsset: {fileID: 0} --- !u!1 &1557338110 stripped GameObject: m_CorrespondingSourceObject: {fileID: 3328484984159178892, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3} @@ -563,6 +577,10 @@ PrefabInstance: propertyPath: m_ActionEvents.Array.data[16].m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName value: UnityEngine.Object, UnityEngine objectReference: {fileID: 0} + - target: {fileID: 1214567908930553592, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: safeZonePrompt + value: + objectReference: {fileID: 1551362089} - target: {fileID: 1214567908930553592, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} propertyPath: gameFlowManager value: From 6879efdf24dbe50f81299cd5426145fc8c0336a5 Mon Sep 17 00:00:00 2001 From: Soulaha Balde Date: Sat, 2 Apr 2022 17:17:47 -0400 Subject: [PATCH 09/15] spawn gladiator in waves --- Assets/Scripts/Arena Stats.asset | 4 +++- Assets/Scripts/Arena.cs | 15 ++++++++++----- Assets/Scripts/ArenaStats.cs | 2 ++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/Arena Stats.asset b/Assets/Scripts/Arena Stats.asset index 8a67059..fbce64e 100644 --- a/Assets/Scripts/Arena Stats.asset +++ b/Assets/Scripts/Arena Stats.asset @@ -12,4 +12,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 8de175900b604adb984b49af64538a07, type: 3} m_Name: Arena Stats m_EditorClassIdentifier: - secondsBetweenSpawners: 10 + secondsBetweenSpawners: 15 + initWaitToSpawn: 3 + waveSize: 3 diff --git a/Assets/Scripts/Arena.cs b/Assets/Scripts/Arena.cs index 3ac4267..1920e9e 100644 --- a/Assets/Scripts/Arena.cs +++ b/Assets/Scripts/Arena.cs @@ -34,12 +34,17 @@ public class Arena : MonoBehaviour { yield return new WaitForSeconds(stats.initWaitToSpawn); int currentSpawner = 0; - - while (true) { - SpawnEnemy(currentSpawner); - currentSpawner = Random.Range(0, spawners.Length); - yield return new WaitForSeconds(stats.secondsBetweenSpawners); + int amountSpawned = 0; + while(true){ + while (amountSpawned < stats.waveSize) { + currentSpawner = Random.Range(0, spawners.Length); + SpawnEnemy(currentSpawner); + amountSpawned++; + } + yield return new WaitForSeconds(stats.secondsBetweenSpawners); + amountSpawned = 0; } + } #if UNITY_EDITOR diff --git a/Assets/Scripts/ArenaStats.cs b/Assets/Scripts/ArenaStats.cs index d4a6f91..32ca27a 100644 --- a/Assets/Scripts/ArenaStats.cs +++ b/Assets/Scripts/ArenaStats.cs @@ -4,4 +4,6 @@ public class ArenaStats : ScriptableObject { [Min(0f)] public float secondsBetweenSpawners = 3f; [Min(0f)] public float initWaitToSpawn = 3f; + [Min(0f)] public float waveSize = 3f; + } \ No newline at end of file From c07aa285c88b2642eb0c9d2b387b25ae12a23c16 Mon Sep 17 00:00:00 2001 From: Jason Durand 01 Date: Sat, 2 Apr 2022 17:20:01 -0400 Subject: [PATCH 10/15] Can throw enemies from safe zone --- Assets/Prefabs/Arena.prefab | 19 +++++--- Assets/Scenes/JasonScene.unity | 34 ++++++-------- Assets/Scripts/AI Stats.asset | 25 ++++++++++ Assets/Scripts/AIEntity.cs | 81 ++++---------------------------- Assets/Scripts/AIStats.cs | 4 +- Assets/Scripts/Arena Stats.asset | 2 +- Assets/Scripts/Arena.cs | 21 +++++++-- Assets/Scripts/Entity.cs | 6 ++- Assets/Scripts/MinionThrower.cs | 19 +++++++- Assets/Scripts/Monster.cs | 74 +++++++++++++++++++++++++++-- Assets/Scripts/PlayerMovement.cs | 4 ++ 11 files changed, 177 insertions(+), 112 deletions(-) diff --git a/Assets/Prefabs/Arena.prefab b/Assets/Prefabs/Arena.prefab index 0090b60..1edf323 100644 --- a/Assets/Prefabs/Arena.prefab +++ b/Assets/Prefabs/Arena.prefab @@ -1756,12 +1756,18 @@ MonoBehaviour: m_EditorClassIdentifier: gameFlowManager: {fileID: 1359990806} spawners: - - {x: -10, y: 10, z: 0} - - {x: 10, y: 10, z: 0} - - {x: -17.75, y: 0, z: 0} - - {x: 17.75, y: 0, z: 0} - - {x: -10, y: -10, z: 0} - - {x: 10, y: -10, z: 0} + - position: {x: -10, y: 10} + direction: {x: 0, y: -1} + - position: {x: 10, y: 10} + direction: {x: 0, y: -1} + - position: {x: -17.75, y: 0} + direction: {x: 1, y: 0} + - position: {x: 17.75, y: 0} + direction: {x: -1, y: 0} + - position: {x: -10, y: -10} + direction: {x: 0, y: 1} + - position: {x: 10, y: -10} + direction: {x: 0, y: 1} stats: {fileID: 11400000, guid: fe319ad8c9a37b84e8b45268c913d54c, type: 2} entityPrefab: {fileID: 197677485360569561, guid: b25a487d193f24049b6a791adf592b2e, type: 3} --- !u!114 &1359990806 @@ -1776,4 +1782,5 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: e3fecdc4a8b2cb4419ef9d03180d130d, type: 3} m_Name: m_EditorClassIdentifier: + gameTimer: {fileID: 0} k__BackingField: 1 diff --git a/Assets/Scenes/JasonScene.unity b/Assets/Scenes/JasonScene.unity index f4f0a0a..a81fe42 100644 --- a/Assets/Scenes/JasonScene.unity +++ b/Assets/Scenes/JasonScene.unity @@ -222,10 +222,10 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: -7596782781093632548, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} - propertyPath: gameFlowManager + - target: {fileID: 1359990806, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} + propertyPath: gameTimer value: - objectReference: {fileID: 1359990806} + objectReference: {fileID: 344214379} - target: {fileID: 4164153230343464235, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} propertyPath: globalCamera value: @@ -280,25 +280,17 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} ---- !u!1 &1359990805 stripped -GameObject: - m_CorrespondingSourceObject: {fileID: 9196727425507610131, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} +--- !u!114 &1359990809 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1359990806, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} m_PrefabInstance: {fileID: 1359990804} m_PrefabAsset: {fileID: 0} ---- !u!114 &1359990806 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1359990805} + m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: e3fecdc4a8b2cb4419ef9d03180d130d, type: 3} m_Name: m_EditorClassIdentifier: - gameTimer: {fileID: 344214379} - k__BackingField: 1 --- !u!114 &1464970062 stripped MonoBehaviour: m_CorrespondingSourceObject: {fileID: 1878107874314509256, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} @@ -513,11 +505,11 @@ PrefabInstance: - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} propertyPath: m_ActionEvents.Array.data[14].m_PersistentCalls.m_Calls.Array.data[0].m_Target value: - objectReference: {fileID: 1359990806} + objectReference: {fileID: 1359990809} - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} propertyPath: m_ActionEvents.Array.data[15].m_PersistentCalls.m_Calls.Array.data[0].m_Target value: - objectReference: {fileID: 1359990806} + objectReference: {fileID: 1359990809} - target: {fileID: 1214567908930553477, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} propertyPath: m_ActionEvents.Array.data[16].m_PersistentCalls.m_Calls.Array.data[0].m_Target value: @@ -589,7 +581,7 @@ PrefabInstance: - target: {fileID: 1214567908930553592, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} propertyPath: gameFlowManager value: - objectReference: {fileID: 1359990806} + objectReference: {fileID: 1359990809} - target: {fileID: 1214567908930553593, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} propertyPath: m_Name value: Vampire @@ -642,6 +634,10 @@ PrefabInstance: propertyPath: m_SortingOrder value: 0 objectReference: {fileID: 0} + - target: {fileID: 1967503440015794769, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: gameFlowManager + value: + objectReference: {fileID: 1359990809} - target: {fileID: 3126145803593047825, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} propertyPath: healthBar value: @@ -653,7 +649,7 @@ PrefabInstance: - target: {fileID: 3126145803593047825, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} propertyPath: gameFlowManager value: - objectReference: {fileID: 1359990806} + objectReference: {fileID: 1359990809} - target: {fileID: 3126145803593047825, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} propertyPath: k__BackingField value: 100 diff --git a/Assets/Scripts/AI Stats.asset b/Assets/Scripts/AI Stats.asset index 33007e2..28ef788 100644 --- a/Assets/Scripts/AI Stats.asset +++ b/Assets/Scripts/AI Stats.asset @@ -26,3 +26,28 @@ MonoBehaviour: - {x: 14, y: 0, z: 0} - {x: 14, y: 0, z: 0} - {x: 14, y: 0, z: 0} + k__BackingField: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 2.4414444 + outSlope: 2.4414444 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0.036708858 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.042344622 + outSlope: -0.042344622 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.05569625 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + k__BackingField: 0.15 diff --git a/Assets/Scripts/AIEntity.cs b/Assets/Scripts/AIEntity.cs index 13079ec..2439739 100644 --- a/Assets/Scripts/AIEntity.cs +++ b/Assets/Scripts/AIEntity.cs @@ -6,16 +6,14 @@ using UnityEngine.Serialization; public class AIEntity : Entity { - [FormerlySerializedAs("stats")] [SerializeField] AIStats AIStats = null!; + [FormerlySerializedAs("stats")] [SerializeField] + public AIStats AIStats = null!; BaseState currentState = null!; public string[] enemies {get; protected set; } - override protected void Awake(){ - base.Awake(); - currentState = new FindTargetState(this); - } override protected void Start(){ base.Start(); + currentState = CreateInitialState(); currentState.EnterState(); } @@ -37,6 +35,8 @@ public class AIEntity : Entity newState.EnterState(); } + protected virtual BaseState CreateInitialState() => new FindTargetState(this); + //Looks into enemy name list to see if the other is targetable virtual protected bool IsTargetable(Entity other){ foreach (string name in enemies){ @@ -48,75 +48,14 @@ public class AIEntity : Entity return false; } - abstract class BaseStateAI : BaseState{ + protected abstract class BaseStateAI : BaseState{ protected AIEntity entity; public BaseStateAI(AIEntity entity){ this.entity = entity; } } - /*//Basically a copy of JumpingMovementState - class NonPhysicThrownState : BaseStateAI { - readonly Vector3 target; - - Vector3 startPosition; - float duration; - float startTime; - - public NonPhysicThrownState(AIEntity entity, Vector3 target) : base(entity) { - this.target = target; - } - - public override void EnterState() { - base.EnterState(); - - duration = entity.AIStats.ThrownDurationPerMeter * Vector3.Distance(entity.transform.position, target); - startPosition = entity.transform.position; - startTime = Time.time; - entity.rb.SetEnabled(false); - } - - public override void LeaveState() { - base.LeaveState(); - entity.rb.SetEnabled(true); - } - - public override BaseState? FixedUpdateState() { - float currentTime = Time.time - startTime; - if (currentTime >= duration) - return new FindTargetState(entity); - - entity.rb.MovePosition(Vector3.Lerp( - startPosition, - target, - entity.AIStats.ThrownCurve.Evaluate(currentTime / duration) - )); - - return null; - } - }*/ - - class ThrownState : BaseStateAI { - public ThrownState(AIEntity entity) : base(entity) {} - - public override void EnterState() { - base.EnterState(); - - entity.rb.SetEnabled(false); - } - - public override void LeaveState() { - base.LeaveState(); - entity.rb.SetEnabled(true); - } - - public override BaseState? FixedUpdateState() - => entity.rb.velocity.magnitude < entity.stats.MinVelocityWhenThrown - ? new FindTargetState(entity) - : null; - } - - class SeekState : BaseStateAI{ + protected class SeekState : BaseStateAI{ public SeekState(AIEntity entity) : base(entity){ } @@ -152,7 +91,7 @@ public class AIEntity : Entity } } - class FindTargetState : BaseStateAI{ + protected class FindTargetState : BaseStateAI{ float closeEnough; Vector3 roamPosition; public FindTargetState(AIEntity entity) : base(entity){ @@ -199,7 +138,7 @@ public class AIEntity : Entity } - class AttackState : BaseStateAI{ + protected class AttackState : BaseStateAI{ public AttackState(AIEntity entity) : base(entity){ } @@ -234,7 +173,7 @@ public class AIEntity : Entity } } - class DeadState : BaseStateAI{ + protected class DeadState : BaseStateAI{ public DeadState(AIEntity entity) : base(entity){ Debug.Log("Dead!"); } diff --git a/Assets/Scripts/AIStats.cs b/Assets/Scripts/AIStats.cs index ab0756a..92e133b 100644 --- a/Assets/Scripts/AIStats.cs +++ b/Assets/Scripts/AIStats.cs @@ -12,8 +12,8 @@ public class AIStats : ScriptableObject { } [field: SerializeField] - public AnimationCurve ThrownCurve { get; } + public AnimationCurve ThrownCurve { get; private set; } [field: SerializeField] - public float ThrownDurationPerMeter { get; } + public float ThrownDurationPerMeter { get; private set; } } \ No newline at end of file diff --git a/Assets/Scripts/Arena Stats.asset b/Assets/Scripts/Arena Stats.asset index d412c84..caed1c1 100644 --- a/Assets/Scripts/Arena Stats.asset +++ b/Assets/Scripts/Arena Stats.asset @@ -12,4 +12,4 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 8de175900b604adb984b49af64538a07, type: 3} m_Name: Arena Stats m_EditorClassIdentifier: - secondsBetweenSpawners: 3 + secondsBetweenSpawners: 8 diff --git a/Assets/Scripts/Arena.cs b/Assets/Scripts/Arena.cs index 6ec7ed2..995c266 100644 --- a/Assets/Scripts/Arena.cs +++ b/Assets/Scripts/Arena.cs @@ -1,16 +1,24 @@ #nullable enable +using System; using System.Collections; using NaughtyAttributes; using UnityEngine; +using Random = UnityEngine.Random; public class Arena : MonoBehaviour { + [Serializable] + struct GladiatorEntrance { + public Vector2 position; + public Vector2 direction; + } + [SerializeField] [Required] GameFlowManager gameFlowManager = null!; //TODO probably add initial direction too //TODO Add some kind of "MinLength(1)" attribute [SerializeField] - Vector3[] spawners = null!; + GladiatorEntrance[] spawners = null!; [SerializeField] [Required] ArenaStats stats = null!; [SerializeField] [Required] @@ -26,8 +34,9 @@ public class Arena : MonoBehaviour { if (gameFlowManager.Paused) return; - var entity = Instantiate(entityPrefab, spawners[spawnerIndex], Quaternion.identity).GetComponent(); - entity.gameFlowManager = (gameFlowManager); + var entity = Instantiate(entityPrefab, spawners[spawnerIndex].position, Quaternion.identity).GetComponent(); + entity.direction = spawners[spawnerIndex].direction; + entity.gameFlowManager = gameFlowManager; } IEnumerator SpawnEnemies() { @@ -45,8 +54,10 @@ public class Arena : MonoBehaviour { #if UNITY_EDITOR void OnDrawGizmosSelected() { Gizmos.color = Color.blue; - foreach (Vector3 spawner in spawners) - Gizmos.DrawWireCube(spawner, Vector3.one); + foreach (GladiatorEntrance entrance in spawners) { + Gizmos.DrawWireCube(entrance.position, Vector3.one); + Gizmos.DrawLine(entrance.position, entrance.position + entrance.direction); + } } #endif } \ No newline at end of file diff --git a/Assets/Scripts/Entity.cs b/Assets/Scripts/Entity.cs index 5c679ec..c734c34 100644 --- a/Assets/Scripts/Entity.cs +++ b/Assets/Scripts/Entity.cs @@ -11,7 +11,7 @@ public class Entity : MonoBehaviour { [field: SerializeField] [field: Required] - protected EntityStats stats { get; private set; } + public EntityStats stats { get; private set; } [field: SerializeField] public float Health { get; private set; } [Min(10f)] protected float initialHealth; @@ -36,7 +36,9 @@ public class Entity : MonoBehaviour { virtual protected void Awake() => rb = GetComponent(); protected virtual void Start() { - direction = new Vector3(1, 0, 0); + if (direction == Vector3.zero && !(this is VampireEntity)) + Debug.LogWarning("Entity had null direction."); + attackTimer = attackCooldown; initialHealth = Health; if (halo != null) { diff --git a/Assets/Scripts/MinionThrower.cs b/Assets/Scripts/MinionThrower.cs index 759ce59..e6dacdc 100644 --- a/Assets/Scripts/MinionThrower.cs +++ b/Assets/Scripts/MinionThrower.cs @@ -1,9 +1,13 @@ +#nullable enable using System.Collections; using System.Collections.Generic; +using NaughtyAttributes; using UnityEngine; using UnityEngine.InputSystem; public class MinionThrower : MonoBehaviour { + [SerializeField] [Required] + GameFlowManager gameFlowManager = null!; public Entity[] minionPrefabs; public GameObject aimArrow; @@ -12,11 +16,13 @@ public class MinionThrower : MonoBehaviour { Vector2 throwDirection = Vector2.right; MinionBar minionBar; VampireEntity vampireEntity; + PlayerMovement movement; float currentCooldownTimer; float currentInitialCooldown; void Awake() { vampireEntity = GetComponent(); + movement = GetComponent(); minionBar = FindObjectOfType(); aimArrow.SetActive(false); } @@ -35,6 +41,9 @@ public class MinionThrower : MonoBehaviour { } public void ToggleThrowMode(InputAction.CallbackContext context) { + if (gameFlowManager.Paused) + return; + if (context.performed) { isInThrowMode = true; aimArrow.SetActive(true); @@ -65,9 +74,15 @@ public class MinionThrower : MonoBehaviour { currentCooldownTimer = currentInitialCooldown; minionBar.UpdateReload(currentCooldownTimer / currentInitialCooldown); - Entity newMinion = Instantiate(minionBar.GetCurrentMinion().gameObject, transform.position + new Vector3(throwDirection.x, throwDirection.y, 0f) * 1f, Quaternion.identity).GetComponent(); + var newMinion = Instantiate(minionBar.GetCurrentMinion().gameObject, transform.position + new Vector3(throwDirection.x, throwDirection.y, 0f) * 1f, Quaternion.identity) + .GetComponent(); + if (movement.GetSafeZone() is {} safeZone) { + newMinion.thrownFromSafeZone = true; + newMinion.thrownTargetPosition = safeZone.GetOutsidePosition(throwDirection); + } + + newMinion.direction = throwDirection; newMinion.gameFlowManager = vampireEntity.gameFlowManager; - // Apply throw force } } diff --git a/Assets/Scripts/Monster.cs b/Assets/Scripts/Monster.cs index d3b0c10..0f0568d 100644 --- a/Assets/Scripts/Monster.cs +++ b/Assets/Scripts/Monster.cs @@ -1,9 +1,10 @@ -using System.Collections; -using System.Collections.Generic; +#nullable enable using UnityEngine; -public class Monster : AIEntity -{ +public class Monster : AIEntity { + public bool thrownFromSafeZone; + public Vector3 thrownTargetPosition; + // Start is called before the first frame update override protected void Start() { @@ -12,4 +13,69 @@ public class Monster : AIEntity base.enemies = new string[]{"Gladiator"}; } + protected override BaseState CreateInitialState() + => thrownFromSafeZone + ? (BaseStateAI)new NonPhysicThrownState(this, thrownTargetPosition) + : new ThrownState(this); + + //Basically a copy of JumpingMovementState + protected class NonPhysicThrownState : BaseStateAI { + readonly Vector3 target; + + Vector3 startPosition; + float duration; + float startTime; + + public NonPhysicThrownState(AIEntity entity, Vector3 target) : base(entity) { + this.target = target; + } + + public override void EnterState() { + base.EnterState(); + + duration = entity.AIStats.ThrownDurationPerMeter * Vector3.Distance(entity.transform.position, target); + startPosition = entity.transform.position; + startTime = Time.time; + entity.rb.SetEnabled(false); + } + + public override void LeaveState() { + base.LeaveState(); + entity.rb.SetEnabled(true); + } + + public override BaseState? FixedUpdateState() { + float currentTime = Time.time - startTime; + if (currentTime >= duration) + return new FindTargetState(entity); + + entity.rb.MovePosition(Vector3.Lerp( + startPosition, + target, + entity.AIStats.ThrownCurve.Evaluate(currentTime / duration) + )); + + return null; + } + } + + protected class ThrownState : BaseStateAI { + public ThrownState(AIEntity entity) : base(entity) {} + + public override void EnterState() { + base.EnterState(); + + entity.rb.SetEnabled(false); + } + + public override void LeaveState() { + base.LeaveState(); + entity.rb.SetEnabled(true); + } + + public override BaseState? FixedUpdateState() + => entity.rb.velocity.magnitude < entity.stats.MinVelocityWhenThrown + ? new FindTargetState(entity) + : null; + } } diff --git a/Assets/Scripts/PlayerMovement.cs b/Assets/Scripts/PlayerMovement.cs index a1a5eb2..eed2519 100644 --- a/Assets/Scripts/PlayerMovement.cs +++ b/Assets/Scripts/PlayerMovement.cs @@ -49,6 +49,10 @@ public class PlayerMovement : MonoBehaviour { #endregion + public SafeZone? GetSafeZone() { + return safeZone; + } + #region Inputs public void OnMove(InputAction.CallbackContext ctx) { From d57eab3e923d9fcac223c845c3149e711b8e1fd7 Mon Sep 17 00:00:00 2001 From: Jason Durand 01 Date: Sat, 2 Apr 2022 17:42:24 -0400 Subject: [PATCH 11/15] Fixed throwing on ground --- Assets/Prefabs/Monster.prefab | 4 +++- Assets/Scenes/JasonScene.unity | 4 ---- Assets/Scripts/AI Stats.asset | 2 ++ Assets/Scripts/AIStats.cs | 6 ++++++ Assets/Scripts/Entity.cs | 11 +---------- Assets/Scripts/EntityStats.cs | 6 ------ Assets/Scripts/EntityStats.cs.meta | 3 --- Assets/Scripts/MinionThrower.cs | 2 +- Assets/Scripts/Monster.cs | 17 +++++++---------- Assets/Scripts/PlayerMovement.cs | 4 ++-- 10 files changed, 22 insertions(+), 37 deletions(-) delete mode 100644 Assets/Scripts/EntityStats.cs delete mode 100644 Assets/Scripts/EntityStats.cs.meta diff --git a/Assets/Prefabs/Monster.prefab b/Assets/Prefabs/Monster.prefab index d7a7bfa..93acfb4 100644 --- a/Assets/Prefabs/Monster.prefab +++ b/Assets/Prefabs/Monster.prefab @@ -193,6 +193,8 @@ MonoBehaviour: target: {fileID: 0} halo: {fileID: 160873202674104038} AIStats: {fileID: 11400000, guid: 9d8a9a664d932d0498d5eca7607eeb53, type: 2} + thrownFromSafeZone: 0 + thrownTargetPosition: {x: 0, y: 0, z: 0} --- !u!50 &1427479462206541758 Rigidbody2D: serializedVersion: 4 @@ -206,7 +208,7 @@ Rigidbody2D: m_UseFullKinematicContacts: 0 m_UseAutoMass: 0 m_Mass: 1 - m_LinearDrag: 0 + m_LinearDrag: 1 m_AngularDrag: 0.05 m_GravityScale: 0 m_Material: {fileID: 6200000, guid: 72c8b57001d325c418a78771641a077f, type: 2} diff --git a/Assets/Scenes/JasonScene.unity b/Assets/Scenes/JasonScene.unity index a81fe42..9119a45 100644 --- a/Assets/Scenes/JasonScene.unity +++ b/Assets/Scenes/JasonScene.unity @@ -630,10 +630,6 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 1214567908930553595, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} - propertyPath: m_SortingOrder - value: 0 - objectReference: {fileID: 0} - target: {fileID: 1967503440015794769, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} propertyPath: gameFlowManager value: diff --git a/Assets/Scripts/AI Stats.asset b/Assets/Scripts/AI Stats.asset index 28ef788..2e890a0 100644 --- a/Assets/Scripts/AI Stats.asset +++ b/Assets/Scripts/AI Stats.asset @@ -51,3 +51,5 @@ MonoBehaviour: m_PostInfinity: 2 m_RotationOrder: 4 k__BackingField: 0.15 + k__BackingField: 2 + throwForce: 5 diff --git a/Assets/Scripts/AIStats.cs b/Assets/Scripts/AIStats.cs index 92e133b..e1d8a44 100644 --- a/Assets/Scripts/AIStats.cs +++ b/Assets/Scripts/AIStats.cs @@ -16,4 +16,10 @@ public class AIStats : ScriptableObject { [field: SerializeField] public float ThrownDurationPerMeter { get; private set; } + + [field: SerializeField] [field: Min(0f)] + public float MinVelocityWhenThrown { get; private set; } = 5f; + + [field: SerializeField] [field: Min(0f)] + public float throwForce = 3f; } \ No newline at end of file diff --git a/Assets/Scripts/Entity.cs b/Assets/Scripts/Entity.cs index c734c34..698053f 100644 --- a/Assets/Scripts/Entity.cs +++ b/Assets/Scripts/Entity.cs @@ -9,9 +9,6 @@ public class Entity : MonoBehaviour { [Required] public GameFlowManager gameFlowManager = null!; - [field: SerializeField] - [field: Required] - public EntityStats stats { get; private set; } [field: SerializeField] public float Health { get; private set; } [Min(10f)] protected float initialHealth; @@ -48,13 +45,7 @@ public class Entity : MonoBehaviour { protected virtual void Update() { } - protected virtual void FixedUpdate() { - //TODO sqrMagnitude? - if (beingPushed && rb.velocity.magnitude < stats.MinVelocityWhenThrown) { - rb.velocity = Vector2.zero; - beingPushed = false; - } - } + protected virtual void FixedUpdate() {} protected virtual void Attack() { diff --git a/Assets/Scripts/EntityStats.cs b/Assets/Scripts/EntityStats.cs deleted file mode 100644 index 6f841c8..0000000 --- a/Assets/Scripts/EntityStats.cs +++ /dev/null @@ -1,6 +0,0 @@ -using UnityEngine; - -public class EntityStats { - [field: SerializeField] [field: Min(0f)] - public float MinVelocityWhenThrown { get; private set; } = 5f; -} \ No newline at end of file diff --git a/Assets/Scripts/EntityStats.cs.meta b/Assets/Scripts/EntityStats.cs.meta deleted file mode 100644 index 0a1726f..0000000 --- a/Assets/Scripts/EntityStats.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: f3b49b8d7dbc43dfbd074996aa811570 -timeCreated: 1648908811 \ No newline at end of file diff --git a/Assets/Scripts/MinionThrower.cs b/Assets/Scripts/MinionThrower.cs index e6dacdc..325f862 100644 --- a/Assets/Scripts/MinionThrower.cs +++ b/Assets/Scripts/MinionThrower.cs @@ -76,7 +76,7 @@ public class MinionThrower : MonoBehaviour { var newMinion = Instantiate(minionBar.GetCurrentMinion().gameObject, transform.position + new Vector3(throwDirection.x, throwDirection.y, 0f) * 1f, Quaternion.identity) .GetComponent(); - if (movement.GetSafeZone() is {} safeZone) { + if (movement.GetSafeZoneIfImmobile() is {} safeZone) { newMinion.thrownFromSafeZone = true; newMinion.thrownTargetPosition = safeZone.GetOutsidePosition(throwDirection); } diff --git a/Assets/Scripts/Monster.cs b/Assets/Scripts/Monster.cs index 0f0568d..5260077 100644 --- a/Assets/Scripts/Monster.cs +++ b/Assets/Scripts/Monster.cs @@ -2,8 +2,8 @@ using UnityEngine; public class Monster : AIEntity { - public bool thrownFromSafeZone; - public Vector3 thrownTargetPosition; + [HideInInspector] public bool thrownFromSafeZone; + [HideInInspector] public Vector3 thrownTargetPosition; // Start is called before the first frame update override protected void Start() @@ -65,17 +65,14 @@ public class Monster : AIEntity { public override void EnterState() { base.EnterState(); - entity.rb.SetEnabled(false); + entity.rb.velocity = entity.direction * entity.AIStats.throwForce; } - public override void LeaveState() { - base.LeaveState(); - entity.rb.SetEnabled(true); - } - - public override BaseState? FixedUpdateState() - => entity.rb.velocity.magnitude < entity.stats.MinVelocityWhenThrown + public override BaseState? FixedUpdateState() { + Debug.Log($"Velocity: {entity.rb.velocity.magnitude}"); + return entity.rb.velocity.magnitude < entity.AIStats.MinVelocityWhenThrown ? new FindTargetState(entity) : null; + } } } diff --git a/Assets/Scripts/PlayerMovement.cs b/Assets/Scripts/PlayerMovement.cs index eed2519..34ce60a 100644 --- a/Assets/Scripts/PlayerMovement.cs +++ b/Assets/Scripts/PlayerMovement.cs @@ -49,8 +49,8 @@ public class PlayerMovement : MonoBehaviour { #endregion - public SafeZone? GetSafeZone() { - return safeZone; + public SafeZone? GetSafeZoneIfImmobile() { + return currentState is ImmobileMovementState ? safeZone : null; } #region Inputs From ba164e5961726f6177ac5ccab740f08e80ea211a Mon Sep 17 00:00:00 2001 From: Jason Durand 01 Date: Sat, 2 Apr 2022 17:52:41 -0400 Subject: [PATCH 12/15] Fixed flakiness on safezone hopping --- Assets/Scenes/JasonScene.unity | 4 ++++ Assets/Scripts/PlayerMovement.cs | 28 +++++++++++++++++----------- Assets/Scripts/SafeZone.cs | 17 ----------------- Assets/Scripts/VampireEntity.cs | 7 +------ 4 files changed, 22 insertions(+), 34 deletions(-) diff --git a/Assets/Scenes/JasonScene.unity b/Assets/Scenes/JasonScene.unity index 9119a45..e22a40e 100644 --- a/Assets/Scenes/JasonScene.unity +++ b/Assets/Scenes/JasonScene.unity @@ -578,6 +578,10 @@ PrefabInstance: propertyPath: m_ActionEvents.Array.data[16].m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName value: UnityEngine.Object, UnityEngine objectReference: {fileID: 0} + - target: {fileID: 1214567908930553592, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: globalCamera + value: + objectReference: {fileID: 1557338110} - target: {fileID: 1214567908930553592, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} propertyPath: gameFlowManager value: diff --git a/Assets/Scripts/PlayerMovement.cs b/Assets/Scripts/PlayerMovement.cs index 34ce60a..dae44a9 100644 --- a/Assets/Scripts/PlayerMovement.cs +++ b/Assets/Scripts/PlayerMovement.cs @@ -10,6 +10,7 @@ public class PlayerMovement : MonoBehaviour { [SerializeField] [field: Required] PlayerStats stats = null!; + [SerializeField] GameObject globalCamera; [field: Required] Rigidbody2D rb = null!; @@ -20,6 +21,8 @@ public class PlayerMovement : MonoBehaviour { bool lastJumpButton; + public bool IsInSafeZone => currentState is ImmobileMovementState; + #region Unity Messages void Awake() { @@ -27,7 +30,10 @@ public class PlayerMovement : MonoBehaviour { currentState = new ImmobileMovementState(this); } - void Start() => currentState.EnterState(); + void Start() { + globalCamera.SetActive(true); + currentState.EnterState(); + } void Update() { if (gameFlowManager.Paused) @@ -68,10 +74,10 @@ public class PlayerMovement : MonoBehaviour { if (gameFlowManager.Paused || safeZone == null) return; - if (safeZone.IsInSafeZone) { + if (IsInSafeZone) { if (moveDirection.magnitude >= safeZone.Stats.MinJumpJoystickValue) SwitchState(new ExitSafeZoneMovementState(this, safeZone, moveDirection)); - } else //TODO if (AngleBetween(moveDirection, toSafeZone) < 90) + } else if (currentState is NormalMovementState) //TODO if (AngleBetween(moveDirection, toSafeZone) < 90) SwitchState(new EnterSafeZoneMovementState(this, safeZone)); } @@ -104,12 +110,6 @@ public class PlayerMovement : MonoBehaviour { currentState = newState; newState.EnterState(); } - public bool IsInSafeZone(){ - if(safeZone is null){ - return false; - } - return safeZone.IsInSafeZone; - } abstract class BaseStatePlayerMovement : BaseState { protected PlayerMovement playerMovement; @@ -174,7 +174,6 @@ public class PlayerMovement : MonoBehaviour { public override void EnterState() { base.EnterState(); - safeZone.EnterSafeZone(); playerMovement.rb.SetEnabled(false); } @@ -193,7 +192,6 @@ public class PlayerMovement : MonoBehaviour { public override void LeaveState() { base.EnterState(); - safeZone.ExitSafeZone(); playerMovement.rb.SetEnabled(true); } @@ -205,9 +203,17 @@ public class PlayerMovement : MonoBehaviour { public override void EnterState() { base.EnterState(); + playerMovement.globalCamera.SetActive(true); if (!playerMovement.rb.isKinematic) Debug.LogWarning("Rigidbody should probably be kinematic when immobile (when in safe zone)."); } + + public override void LeaveState() { + base.LeaveState(); + + playerMovement.globalCamera.SetActive(false); + } + #if UNITY_EDITOR public override void OnDrawGizmos() { if (playerMovement.safeZone is null) diff --git a/Assets/Scripts/SafeZone.cs b/Assets/Scripts/SafeZone.cs index 0fe27b7..147930e 100644 --- a/Assets/Scripts/SafeZone.cs +++ b/Assets/Scripts/SafeZone.cs @@ -6,23 +6,6 @@ public class SafeZone : MonoBehaviour { public SafeZoneStats Stats { get; private set; } [SerializeField] CircleCollider2D moatCollider; - [SerializeField] GameObject globalCamera; - - public bool IsInSafeZone { get; private set; } = true; - - void Start() { - globalCamera.SetActive(true); - } - - public void EnterSafeZone() { - IsInSafeZone = true; - globalCamera.SetActive(true); - } - - public void ExitSafeZone() { - IsInSafeZone = false; - globalCamera.SetActive(false); - } public Vector3 GetOutsidePosition(Vector2 direction) { return transform.position + (moatCollider.radius + Stats.JumpOffset) * (Vector3)direction; diff --git a/Assets/Scripts/VampireEntity.cs b/Assets/Scripts/VampireEntity.cs index 85afed0..d0f390a 100644 --- a/Assets/Scripts/VampireEntity.cs +++ b/Assets/Scripts/VampireEntity.cs @@ -29,12 +29,7 @@ public class VampireEntity : Entity { // healthBar.SetHealthFraction(Health / initialHealth); // } - public bool IsInSafeZone(){ - if(playerMovement is null){ - return false; - } - return playerMovement.IsInSafeZone(); - } + public bool IsInSafeZone() => playerMovement.IsInSafeZone; protected override void OnDied() => gameFlowManager.GameOver(); } \ No newline at end of file From 83d8bd6cf985bdd7864465c3321751ff8f0abb4a Mon Sep 17 00:00:00 2001 From: Jason Durand 01 Date: Sat, 2 Apr 2022 17:58:32 -0400 Subject: [PATCH 13/15] Use IsInSafeZone + remove debug log --- Assets/Scenes/JasonScene.unity | 18 ++++++++++++++++++ Assets/Scripts/Monster.cs | 1 - Assets/Scripts/PlayerMovement.cs | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Assets/Scenes/JasonScene.unity b/Assets/Scenes/JasonScene.unity index e22a40e..cabf7b3 100644 --- a/Assets/Scenes/JasonScene.unity +++ b/Assets/Scenes/JasonScene.unity @@ -215,6 +215,11 @@ Transform: m_CorrespondingSourceObject: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} m_PrefabInstance: {fileID: 1942557562} m_PrefabAsset: {fileID: 0} +--- !u!1 &1186739821 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 1844274959428875625, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + m_PrefabInstance: {fileID: 1551362086} + m_PrefabAsset: {fileID: 0} --- !u!1001 &1359990804 PrefabInstance: m_ObjectHideFlags: 0 @@ -226,6 +231,10 @@ PrefabInstance: propertyPath: gameTimer value: objectReference: {fileID: 344214379} + - target: {fileID: 1359990806, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} + propertyPath: startPrompt + value: + objectReference: {fileID: 1186739821} - target: {fileID: 4164153230343464235, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} propertyPath: globalCamera value: @@ -423,6 +432,11 @@ GameObject: m_CorrespondingSourceObject: {fileID: 3328484984159178892, guid: f7f5d2b1228d13f4d9015073aced3e81, type: 3} m_PrefabInstance: {fileID: 647315810} m_PrefabAsset: {fileID: 0} +--- !u!1 &1596616199 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 763564871199756608, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + m_PrefabInstance: {fileID: 1551362086} + m_PrefabAsset: {fileID: 0} --- !u!1001 &1942557562 PrefabInstance: m_ObjectHideFlags: 0 @@ -582,6 +596,10 @@ PrefabInstance: propertyPath: globalCamera value: objectReference: {fileID: 1557338110} + - target: {fileID: 1214567908930553592, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: safeZonePrompt + value: + objectReference: {fileID: 1596616199} - target: {fileID: 1214567908930553592, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} propertyPath: gameFlowManager value: diff --git a/Assets/Scripts/Monster.cs b/Assets/Scripts/Monster.cs index 5260077..9a6e5b4 100644 --- a/Assets/Scripts/Monster.cs +++ b/Assets/Scripts/Monster.cs @@ -69,7 +69,6 @@ public class Monster : AIEntity { } public override BaseState? FixedUpdateState() { - Debug.Log($"Velocity: {entity.rb.velocity.magnitude}"); return entity.rb.velocity.magnitude < entity.AIStats.MinVelocityWhenThrown ? new FindTargetState(entity) : null; diff --git a/Assets/Scripts/PlayerMovement.cs b/Assets/Scripts/PlayerMovement.cs index 6ec4ee9..b48b0a5 100644 --- a/Assets/Scripts/PlayerMovement.cs +++ b/Assets/Scripts/PlayerMovement.cs @@ -49,7 +49,7 @@ public class PlayerMovement : MonoBehaviour { if (gameFlowManager.Paused) return; - if (safeZone != null && safeZone.IsInSafeZone) { + if (safeZone != null && IsInSafeZone) { safeZonePrompt.SetActive(false); } else { safeZonePrompt.SetActive(true); From c3a6575d87bc26e89bae966cbf614fc7eb0b1107 Mon Sep 17 00:00:00 2001 From: Jason Durand 01 Date: Sat, 2 Apr 2022 18:00:59 -0400 Subject: [PATCH 14/15] Reintegrated inspector stuff --- Assets/Scenes/SampleScene.unity | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 1862ae6..ef8841b 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -204,6 +204,17 @@ Transform: m_CorrespondingSourceObject: {fileID: 1214567908930553594, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} m_PrefabInstance: {fileID: 1942557562} m_PrefabAsset: {fileID: 0} +--- !u!114 &836972483 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 344214379, guid: e1dac4f28fe75a547b919b7aa8240fed, type: 3} + m_PrefabInstance: {fileID: 1551362086} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a53670f9cd399ea4a8ae3ed81b923aa8, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1001 &1359990804 PrefabInstance: m_ObjectHideFlags: 0 @@ -211,6 +222,10 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 0} m_Modifications: + - target: {fileID: 1359990806, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} + propertyPath: gameTimer + value: + objectReference: {fileID: 836972483} - target: {fileID: 1359990806, guid: 581322f036f3ff1448d4d2ec70f295a4, type: 3} propertyPath: startPrompt value: @@ -577,6 +592,10 @@ PrefabInstance: propertyPath: m_ActionEvents.Array.data[16].m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName value: UnityEngine.Object, UnityEngine objectReference: {fileID: 0} + - target: {fileID: 1214567908930553592, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: globalCamera + value: + objectReference: {fileID: 1557338110} - target: {fileID: 1214567908930553592, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} propertyPath: safeZonePrompt value: @@ -637,6 +656,10 @@ PrefabInstance: propertyPath: m_SortingOrder value: 0 objectReference: {fileID: 0} + - target: {fileID: 1967503440015794769, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} + propertyPath: gameFlowManager + value: + objectReference: {fileID: 1359990806} - target: {fileID: 3126145803593047825, guid: 3e0aae8cda56aef44af9598dc5471020, type: 3} propertyPath: healthBar value: From a1d2beca4f298f8c54a0dc09d51282c04ad0c0ee Mon Sep 17 00:00:00 2001 From: Soulaha Balde Date: Sat, 2 Apr 2022 18:58:56 -0400 Subject: [PATCH 15/15] Represent death on sprites --- Assets/Prefabs/Gladiator.prefab | 105 +++++++++++----------- Assets/Prefabs/Health Bar Canvas.prefab | 2 +- Assets/Prefabs/Monster.prefab | 113 +++++++++++++----------- Assets/Prefabs/Vampire.prefab | 12 +-- Assets/Scripts/AIEntity.cs | 4 +- Assets/Scripts/Entity.cs | 34 ++++++- Assets/Scripts/Gladiator.cs | 7 ++ ProjectSettings/TagManager.asset | 6 ++ 8 files changed, 171 insertions(+), 112 deletions(-) diff --git a/Assets/Prefabs/Gladiator.prefab b/Assets/Prefabs/Gladiator.prefab index 8437100..5621b32 100644 --- a/Assets/Prefabs/Gladiator.prefab +++ b/Assets/Prefabs/Gladiator.prefab @@ -9,11 +9,10 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 197677485360569565} - - component: {fileID: 197677485360569564} - - component: {fileID: 197677485360569563} - component: {fileID: 197677485360569566} - component: {fileID: 3988163462708087662} - component: {fileID: 2142155588016984618} + - component: {fileID: -8195126358453283336} m_Layer: 0 m_Name: Gladiator m_TagString: Gladiator @@ -37,55 +36,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!33 &197677485360569564 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 197677485360569561} - m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &197677485360569563 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 197677485360569561} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} --- !u!114 &197677485360569566 MonoBehaviour: m_ObjectHideFlags: 0 @@ -110,6 +60,8 @@ MonoBehaviour: attackCooldown: 1 target: {fileID: 0} halo: {fileID: 3772547392739388838} + deadColor: {r: 0.7075472, g: 0.030037368, b: 0.030037368, a: 1} + emptyColor: {r: 0.5660378, g: 0.5660378, b: 0.5660378, a: 0.4117647} AIStats: {fileID: 11400000, guid: 9d8a9a664d932d0498d5eca7607eeb53, type: 2} --- !u!58 &3988163462708087662 CircleCollider2D: @@ -148,6 +100,57 @@ Rigidbody2D: m_SleepingMode: 1 m_CollisionDetection: 0 m_Constraints: 4 +--- !u!212 &-8195126358453283336 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 197677485360569561} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: -1438510283 + m_SortingLayer: 1 + m_SortingOrder: 0 + m_Sprite: {fileID: -2413806693520163455, guid: 4adeaf2d2b1c7417e89f026626d8264f, type: 3} + m_Color: {r: 0.04774831, g: 0.2735849, b: 0.08162382, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1 &3772547392739388838 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Health Bar Canvas.prefab b/Assets/Prefabs/Health Bar Canvas.prefab index 2bfdefb..7378fc2 100644 --- a/Assets/Prefabs/Health Bar Canvas.prefab +++ b/Assets/Prefabs/Health Bar Canvas.prefab @@ -57,7 +57,7 @@ Canvas: m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 m_AdditionalShaderChannelsFlag: 0 - m_SortingLayerID: 0 + m_SortingLayerID: -1438510283 m_SortingOrder: 0 m_TargetDisplay: 0 --- !u!114 &2962150094107129824 diff --git a/Assets/Prefabs/Monster.prefab b/Assets/Prefabs/Monster.prefab index 99d8895..aaecdb6 100644 --- a/Assets/Prefabs/Monster.prefab +++ b/Assets/Prefabs/Monster.prefab @@ -91,11 +91,10 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 2399377275812995968} - - component: {fileID: 2399377275812995969} - - component: {fileID: 2399377275812995970} - component: {fileID: 2399377275812995974} - component: {fileID: 1427479462206541758} - component: {fileID: 8912459659685944407} + - component: {fileID: 7325874221449804585} m_Layer: 0 m_Name: Monster m_TagString: Monster @@ -119,55 +118,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!33 &2399377275812995969 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2399377275812995980} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &2399377275812995970 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2399377275812995980} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_ReceiveGI: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 1 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - m_AdditionalVertexStreams: {fileID: 0} --- !u!114 &2399377275812995974 MonoBehaviour: m_ObjectHideFlags: 0 @@ -192,6 +142,8 @@ MonoBehaviour: attackCooldown: 1 target: {fileID: 0} halo: {fileID: 160873202674104038} + deadColor: {r: 0.7058824, g: 0.03137255, b: 0.03137255, a: 1} + emptyColor: {r: 0.5647059, g: 0.5647059, b: 0.5647059, a: 0.4117647} AIStats: {fileID: 11400000, guid: 9d8a9a664d932d0498d5eca7607eeb53, type: 2} --- !u!50 &1427479462206541758 Rigidbody2D: @@ -230,6 +182,57 @@ CircleCollider2D: m_Offset: {x: 0, y: 0} serializedVersion: 2 m_Radius: 0.5 +--- !u!212 &7325874221449804585 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2399377275812995980} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: -1438510283 + m_SortingLayer: 1 + m_SortingOrder: 0 + m_Sprite: {fileID: -5177388603050735206, guid: 71ebafeef3c03457483266a33ab2b270, type: 3} + m_Color: {r: 0.14929691, g: 0.18158285, b: 0.5754717, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 1, y: 1} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 --- !u!1001 &4861301622389167767 PrefabInstance: m_ObjectHideFlags: 0 @@ -237,6 +240,10 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 2399377275812995968} m_Modifications: + - target: {fileID: 2962150094107129825, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3} + propertyPath: m_Enabled + value: 1 + objectReference: {fileID: 0} - target: {fileID: 2962150094107129826, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3} propertyPath: m_Name value: Health Bar Canvas @@ -333,6 +340,10 @@ PrefabInstance: propertyPath: m_AnchorMax.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 2962150095602046905, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: d1d8f8326b5490848a9400aa9bd6b2f4, type: 3} --- !u!224 &7668921808236339569 stripped diff --git a/Assets/Prefabs/Vampire.prefab b/Assets/Prefabs/Vampire.prefab index 69f413b..9c24056 100644 --- a/Assets/Prefabs/Vampire.prefab +++ b/Assets/Prefabs/Vampire.prefab @@ -72,12 +72,14 @@ MonoBehaviour: k__BackingField: 0 k__BackingField: 0 fov: 0 - attackRange: 0 + k__BackingField: 0 k__BackingField: 0 attackCooldown: 0 target: {fileID: 0} + halo: {fileID: 0} + deadColor: {r: 1, g: 0, b: 0, a: 1} + emptyColor: {r: 1, g: 0, b: 0, a: 1} playerStats: {fileID: 11400000, guid: 12a626b5a296d934ba078d222ad6ba98, type: 2} - healthBar: {fileID: 0} --- !u!114 &1967503440015794769 MonoBehaviour: m_ObjectHideFlags: 0 @@ -145,11 +147,11 @@ SpriteRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 + m_SortingLayerID: 603553691 + m_SortingLayer: 2 m_SortingOrder: 0 m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7, type: 3} - m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Color: {r: 0.03226238, g: 0.0766813, b: 0.23584908, a: 1} m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 diff --git a/Assets/Scripts/AIEntity.cs b/Assets/Scripts/AIEntity.cs index fd8fd6b..b63a5ab 100644 --- a/Assets/Scripts/AIEntity.cs +++ b/Assets/Scripts/AIEntity.cs @@ -20,11 +20,13 @@ public class AIEntity : Entity } override protected void Update() { + base.Update(); if (currentState.UpdateState() is {} newState) SwitchState(newState); } override protected void FixedUpdate() { + base.FixedUpdate(); if (currentState.FixedUpdateState() is {} newState) SwitchState(newState); } @@ -184,7 +186,7 @@ public class AIEntity : Entity class DeadState : BaseStateAI{ public DeadState(AIEntity entity) : base(entity){ - Debug.Log("Dead!"); + } public override BaseState? UpdateState(){ diff --git a/Assets/Scripts/Entity.cs b/Assets/Scripts/Entity.cs index 538caad..5010864 100644 --- a/Assets/Scripts/Entity.cs +++ b/Assets/Scripts/Entity.cs @@ -27,13 +27,20 @@ public class Entity : MonoBehaviour { protected float attackTimer; [SerializeField] private Transform target; public string entityName { get; protected set; } - private Collider atkCollider; public Vector3 direction { get; set; } public Rigidbody2D rb { get; private set; } + public Collider2D collider { get; private set; } + public SpriteRenderer renderer { get; private set; } bool beingPushed; [SerializeField] GameObject halo; + [SerializeField] Color deadColor = Color.red; + [SerializeField] Color emptyColor = Color.grey; - virtual protected void Awake() => rb = GetComponent(); + virtual protected void Awake(){ + rb = GetComponent(); + collider = GetComponent(); + renderer = GetComponent(); + } protected virtual void Start() { direction = new Vector3(1, 0, 0); @@ -120,7 +127,28 @@ public class Entity : MonoBehaviour { rb.AddForce(impulse, ForceMode2D.Impulse); } - protected virtual void OnDied() { } + protected virtual void OnDied() { + if(!(collider is null)){ + collider.isTrigger = true; + } + if(!(rb is null)){ + rb.isKinematic = true; + rb.velocity = Vector2.zero; + } + healthBar.gameObject.SetActive(false); + if(bloodTokens > 0){ + renderer.color = deadColor; + renderer.sortingOrder = -1; + }else{ + renderer.color = emptyColor; + renderer.sortingOrder = -2; + } + } + + protected virtual void OnEmpty(){ + renderer.color = emptyColor; + renderer.sortingOrder = -2; + } public void EnableHalo() { halo.SetActive(true); diff --git a/Assets/Scripts/Gladiator.cs b/Assets/Scripts/Gladiator.cs index eba6602..645a3d0 100644 --- a/Assets/Scripts/Gladiator.cs +++ b/Assets/Scripts/Gladiator.cs @@ -12,6 +12,13 @@ public class Gladiator : AIEntity base.enemies = new string[]{"Monster", "Vampire"}; } + override protected void Update(){ + base.Update(); + if(bloodTokens <= 0){ + OnEmpty(); + } + } + override protected bool IsTargetable(Entity other){ foreach (string name in enemies){ if(other.entityName == name && other.IsAlive()){ diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index 5499c00..fcb1929 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -46,3 +46,9 @@ TagManager: - name: Default uniqueID: 0 locked: 0 + - name: AI + uniqueID: 2856457013 + locked: 0 + - name: Player + uniqueID: 603553691 + locked: 0