From 12965fa2dc28240acf45334629bb0cb157d4157c Mon Sep 17 00:00:00 2001 From: Leo Cardhio <leocardhio@gmail.com> Date: Sat, 15 Apr 2023 09:41:23 +0700 Subject: [PATCH] [feat] activate shop before round start --- Assets/Scenes/Level_02.unity | 11 +- Assets/Scenes/Level_Final.unity | 301 ++++++++++++++++++++++++++++- Assets/Scripts/GameManager.cs | 10 +- Assets/Scripts/Shop/ShopTrigger.cs | 3 + 4 files changed, 314 insertions(+), 11 deletions(-) diff --git a/Assets/Scenes/Level_02.unity b/Assets/Scenes/Level_02.unity index e3f1b30b..b913e6fe 100644 --- a/Assets/Scenes/Level_02.unity +++ b/Assets/Scenes/Level_02.unity @@ -9911,6 +9911,7 @@ MonoBehaviour: m_EditorClassIdentifier: shopTimer: 30 shopTimerUI: {fileID: 1317709273} + shopUI: {fileID: 1444128283} --- !u!1 &1329226643 GameObject: m_ObjectHideFlags: 0 @@ -10146,7 +10147,7 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1444128283} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 @@ -10160,7 +10161,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchoredPosition: {x: -0.000030517578, y: -0.000030517578} m_SizeDelta: {x: 100, y: 138} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1444128285 @@ -10575,6 +10576,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: a5625387bc6ce43499c09f0bc30929dd, type: 3} m_Name: m_EditorClassIdentifier: + availableSlot: 000000 --- !u!4 &1546708126 Transform: m_ObjectHideFlags: 0 @@ -11222,6 +11224,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: coins: 50 + coinsLatest: 0 currentPet: name: buffType: @@ -11232,12 +11235,12 @@ MonoBehaviour: isPetAlive: 1 isShopOpen: 1 isShopping: 0 - isEnemySpawning: 0 + isEnemyActive: 1 petFactory: {fileID: 734232483} currentWeapon: 0 availableWeapon: 01000000 hudManager: {fileID: 491809539} - enemyManager: {fileID: 164778954} + enemySpawner: {fileID: 0} --- !u!114 &1644740160 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/Level_Final.unity b/Assets/Scenes/Level_Final.unity index f3223512..b755c93b 100644 --- a/Assets/Scenes/Level_Final.unity +++ b/Assets/Scenes/Level_Final.unity @@ -1127,6 +1127,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: a5625387bc6ce43499c09f0bc30929dd, type: 3} m_Name: m_EditorClassIdentifier: + availableSlot: 000000 --- !u!4 &268888278 Transform: m_ObjectHideFlags: 0 @@ -1246,6 +1247,7 @@ RectTransform: - {fileID: 1314518863} - {fileID: 1764071969} - {fileID: 124801772} + - {fileID: 991378527} - {fileID: 1093198193} m_Father: {fileID: 0} m_RootOrder: 8 @@ -7257,6 +7259,293 @@ ParticleSystemRenderer: m_MeshWeighting2: 1 m_MeshWeighting3: 1 m_MaskInteraction: 0 +--- !u!1 &931794853 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 931794854} + - component: {fileID: 931794856} + - component: {fileID: 931794855} + m_Layer: 5 + m_Name: TimeToClose + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &931794854 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 931794853} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 991378527} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0} + m_AnchoredPosition: {x: 0, y: -10} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &931794855 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 931794853} + 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: XX + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 91906345d5ae42a4ca879c3f6c4b65fb, type: 2} + m_sharedMaterial: {fileID: -2196506104538577691, guid: 91906345d5ae42a4ca879c3f6c4b65fb, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, 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: 1 + 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!222 &931794856 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 931794853} + m_CullTransparentMesh: 1 +--- !u!1 &991378526 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 991378527} + - component: {fileID: 991378530} + - component: {fileID: 991378529} + - component: {fileID: 991378528} + m_Layer: 5 + m_Name: ShopTimer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &991378527 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 991378526} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 931794854} + m_Father: {fileID: 491809538} + m_RootOrder: 11 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -383, y: 244.00002} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &991378528 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 991378526} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4133a988ba6a2734a94e70d74c4e9bda, type: 3} + m_Name: + m_EditorClassIdentifier: + shopTimer: 7 + shopTimerUI: {fileID: 991378526} + shopUI: {fileID: 1444128283} +--- !u!114 &991378529 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 991378526} + 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: 'Shop Closing in:' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 91906345d5ae42a4ca879c3f6c4b65fb, type: 2} + m_sharedMaterial: {fileID: -2196506104538577691, guid: 91906345d5ae42a4ca879c3f6c4b65fb, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, 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: 20 + m_fontSizeBase: 20 + 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: 1 + 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: -2.054306, 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!222 &991378530 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 991378526} + m_CullTransparentMesh: 1 --- !u!1 &999659690 GameObject: m_ObjectHideFlags: 0 @@ -7793,7 +8082,7 @@ RectTransform: - {fileID: 1146729426} - {fileID: 1029574650} m_Father: {fileID: 491809538} - m_RootOrder: 11 + m_RootOrder: 12 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} @@ -9628,6 +9917,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: coins: 50 + coinsLatest: 0 currentPet: name: buffType: @@ -9636,12 +9926,14 @@ MonoBehaviour: filename: id: 0 isPetAlive: 1 - isShopOpen: 0 + isShopOpen: 1 isShopping: 0 + isEnemyActive: 0 petFactory: {fileID: 1713238116} currentWeapon: 0 availableWeapon: 01000000 hudManager: {fileID: 491809539} + enemySpawner: {fileID: 7250609702671589678} --- !u!114 &1644740160 MonoBehaviour: m_ObjectHideFlags: 0 @@ -11635,3 +11927,8 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 433f5e4f5f25c034daf13357456b2ad4, type: 3} +--- !u!1 &7250609702671589678 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 7250609702779207134, guid: 433f5e4f5f25c034daf13357456b2ad4, type: 3} + m_PrefabInstance: {fileID: 7250609702671589677} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 09f7c4e5..823f50bb 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -17,7 +17,7 @@ public class GameManager : MonoBehaviour public bool isPetAlive = false; public bool isShopOpen = true; // shop only open after finishing quest public bool isShopping = false; // sedang berbelanja - public bool isEnemySpawning = true; + public bool isEnemyActive = true; public PetFactory petFactory; // Weapon @@ -31,13 +31,13 @@ public class GameManager : MonoBehaviour // Enemy [Header("Enemy")] - public GameObject enemyManager; + public GameObject enemySpawner; public static GameManager gameManager; private void Awake() { - enemyManager.SetActive(isEnemySpawning); + enemySpawner.SetActive(isEnemyActive); if (gameManager == null) { gameManager = this; @@ -96,7 +96,7 @@ public class GameManager : MonoBehaviour } public void TriggerSpawningEnemy() { - isEnemySpawning = !isEnemySpawning; - enemyManager.SetActive(isEnemySpawning); + isEnemyActive = !isEnemyActive; + enemySpawner.SetActive(isEnemyActive); } } diff --git a/Assets/Scripts/Shop/ShopTrigger.cs b/Assets/Scripts/Shop/ShopTrigger.cs index 3ed51978..b496f9b3 100644 --- a/Assets/Scripts/Shop/ShopTrigger.cs +++ b/Assets/Scripts/Shop/ShopTrigger.cs @@ -8,6 +8,7 @@ public class ShopTrigger : MonoBehaviour // Timer public float shopTimer = 30f; public GameObject shopTimerUI; + public GameObject shopUI; private TMP_Text timerText; @@ -26,6 +27,8 @@ public class ShopTrigger : MonoBehaviour if (shopTimer <= 0f) { GameManager.gameManager.isShopOpen = false; shopTimerUI.SetActive(false); + shopUI.SetActive(false); + GameManager.gameManager.isShopping = false; GameManager.gameManager.TriggerSpawningEnemy(); } } -- GitLab