diff --git a/Assets/Scenes/Level_01.unity b/Assets/Scenes/Level_01.unity index 98409fa7562dbc7a874ee1fa5f08af296364d6ef..907f588bb7d60e9c7d7a9ae334a3bdcc94947ab4 100644 --- a/Assets/Scenes/Level_01.unity +++ b/Assets/Scenes/Level_01.unity @@ -2548,6 +2548,11 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: speed: 6 + pet: 0 + Pets: + - {fileID: 1528693926709559163} + - {fileID: 47640732} + - {fileID: 1318841538} --- !u!82 &624092164 AudioSource: m_ObjectHideFlags: 0 @@ -3287,6 +3292,10 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 0} m_Modifications: + - target: {fileID: 684574999, guid: 22f2e750f46b08145b81598aff3a067c, type: 3} + propertyPath: OutputAudioMixerGroup + value: + objectReference: {fileID: 24300002, guid: 5b84db49d40ea449aa4f3e3bd229ab5b, type: 2} - target: {fileID: 5233401772555631958, guid: 22f2e750f46b08145b81598aff3a067c, type: 3} propertyPath: m_Name value: PetRobo @@ -3339,10 +3348,18 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 8069118080564623084, guid: 22f2e750f46b08145b81598aff3a067c, type: 3} + propertyPath: player + value: + objectReference: {fileID: 624092162} - target: {fileID: 8069118080564623085, guid: 22f2e750f46b08145b81598aff3a067c, type: 3} propertyPath: player value: objectReference: {fileID: 624092168} + - target: {fileID: 8069118080920477240, guid: 22f2e750f46b08145b81598aff3a067c, type: 3} + propertyPath: OutputAudioMixerGroup + value: + objectReference: {fileID: 24300002, guid: 5b84db49d40ea449aa4f3e3bd229ab5b, type: 2} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 22f2e750f46b08145b81598aff3a067c, type: 3} --- !u!1 &759591886 @@ -10970,6 +10987,7 @@ MonoBehaviour: - {fileID: 47640732} - {fileID: 1318841538} playerGold: {fileID: 624092177} + player: {fileID: 624092162} --- !u!1 &1614820522 GameObject: m_ObjectHideFlags: 0 @@ -11721,10 +11739,18 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 1710546516545906498, guid: 50754b1bd29cde544bf7b1e78400a3fd, type: 3} + propertyPath: OutputAudioMixerGroup + value: + objectReference: {fileID: 24300002, guid: 5b84db49d40ea449aa4f3e3bd229ab5b, type: 2} - target: {fileID: 5237900790845583655, guid: 50754b1bd29cde544bf7b1e78400a3fd, type: 3} propertyPath: weapon value: objectReference: {fileID: 1003343662} + - target: {fileID: 6649821425492048567, guid: 50754b1bd29cde544bf7b1e78400a3fd, type: 3} + propertyPath: player + value: + objectReference: {fileID: 624092162} - target: {fileID: 9140073484006322690, guid: 50754b1bd29cde544bf7b1e78400a3fd, type: 3} propertyPath: player value: @@ -13101,6 +13127,10 @@ PrefabInstance: propertyPath: player value: objectReference: {fileID: 624092162} + - target: {fileID: 5102195255237782389, guid: 5f5f233d029030a4897e42369bff2504, type: 3} + propertyPath: player + value: + objectReference: {fileID: 624092162} - target: {fileID: 6051044097362172068, guid: 5f5f233d029030a4897e42369bff2504, type: 3} propertyPath: m_Name value: PetFox (1) diff --git a/Assets/Scripts/Pet/PetHealth.cs b/Assets/Scripts/Pet/PetHealth.cs index 1b587fe1bd9aec8d55e28d1ce5d752a48c91076b..0a079a06ec79ec6ac75dc07e9edb7aae5ad3b43c 100644 --- a/Assets/Scripts/Pet/PetHealth.cs +++ b/Assets/Scripts/Pet/PetHealth.cs @@ -9,7 +9,7 @@ public class PetHealth : MonoBehaviour, Attackable // public Slider healthSlider; public int armor = 0; public AudioClip deathClip; - + public GameObject player; private bool isDead = false; private Animator anim; private CapsuleCollider capsuleCollider; @@ -55,7 +55,7 @@ public class PetHealth : MonoBehaviour, Attackable void Death() { isDead = true; - + player.GetComponent<PlayerMovement>().pet = 0; anim.SetTrigger("Dead"); petAudio.clip = deathClip; diff --git a/Assets/Scripts/Player/PlayerMovement.cs b/Assets/Scripts/Player/PlayerMovement.cs index 344783291548dd715703494ffb370b9a261c240f..32294801d326f894a31ffe7aab02d463958118f1 100644 --- a/Assets/Scripts/Player/PlayerMovement.cs +++ b/Assets/Scripts/Player/PlayerMovement.cs @@ -8,9 +8,19 @@ public class PlayerMovement : MonoBehaviour Rigidbody playerRigidbody; int floorMask; float camRayLength = 100f; - + public int pet = 0; + public GameObject[] Pets; private void Awake() { + if (pet==1){ + Pets[0].SetActive(true); + } + else if (pet==2){ + Pets[1].SetActive(true); + } + else if (pet==3){ + Pets[2].SetActive(true); + } //mendapatkan nilai mask dari layer yang bernama Floor floorMask = LayerMask.GetMask("Floor"); diff --git a/Assets/Scripts/Shop/ShopManager.cs b/Assets/Scripts/Shop/ShopManager.cs index 83c5f09d6cc419a30685154e2eb1025cd2b46058..d7fb4664f23c88aa2b83263709f312c13db6c0ed 100644 --- a/Assets/Scripts/Shop/ShopManager.cs +++ b/Assets/Scripts/Shop/ShopManager.cs @@ -7,6 +7,7 @@ using TMPro; public class ShopManager : MonoBehaviour { private int gold; + private bool unlimitedMoney = false; public TMP_Text goldText; public ShopItemSO[] shopItemsSO; public ShopTemplate[] shopTemplate; @@ -14,6 +15,7 @@ public class ShopManager : MonoBehaviour public Button[] purchaseBtn; public GameObject[] Pets; public PlayerGold playerGold; + public GameObject player; // Start is called before the first frame update void Start() { @@ -39,7 +41,7 @@ public class ShopManager : MonoBehaviour { for (int i = 0; i < shopItemsSO.Length; i++) { - if (gold >= shopItemsSO[i].price && shopTemplate[i].itemPrice.text != "Purchased") + if ((gold >= shopItemsSO[i].price || unlimitedMoney) && shopTemplate[i].itemPrice.text != "Purchased") { purchaseBtn[i].interactable = true; } @@ -47,28 +49,36 @@ public class ShopManager : MonoBehaviour { purchaseBtn[i].interactable = false; } + if (i<3 && player.GetComponent<PlayerMovement>().pet != 0){ + purchaseBtn[i].interactable = false; + } } } public void PurchaseItem(int itemIndex) { - if (gold >= shopItemsSO[itemIndex].price) + if (gold >= shopItemsSO[itemIndex].price || unlimitedMoney) { - playerGold.decreaseGoldAmount(shopItemsSO[itemIndex].price); - gold -= shopItemsSO[itemIndex].price; - goldText.text = "Gold : " + gold.ToString(); + if (!unlimitedMoney){ + playerGold.decreaseGoldAmount(shopItemsSO[itemIndex].price); + gold -= shopItemsSO[itemIndex].price; + goldText.text = "Gold : " + gold.ToString(); + } purchaseBtn[itemIndex].interactable = false; shopTemplate[itemIndex].itemPrice.text = "Purchased"; if (shopItemsSO[itemIndex].title == "Healer Pet") { + player.GetComponent<PlayerMovement>().pet = 1; Pets[0].SetActive(true); } if (shopItemsSO[itemIndex].title == "Support Pet") { + player.GetComponent<PlayerMovement>().pet = 2; Pets[1].SetActive(true); } if (shopItemsSO[itemIndex].title == "DPS Pet") { + player.GetComponent<PlayerMovement>().pet = 3; Pets[2].SetActive(true); } CheckPurchasable(); @@ -78,6 +88,23 @@ public class ShopManager : MonoBehaviour // Update is called once per frame void Update() { + if (Input.GetKeyDown("m")) + { + if (unlimitedMoney) + { + unlimitedMoney = false; + } + else + { + unlimitedMoney = true; + } + } + if (unlimitedMoney){ + goldText.text = "Gold : Unlimited"; + } + else { + goldText.text = "Gold : " + gold.ToString(); + } } public void LoadPanels() diff --git a/Assets/Unity.VisualScripting.Generated.meta b/Assets/Unity.VisualScripting.Generated.meta new file mode 100644 index 0000000000000000000000000000000000000000..cf9b47d250886a2e58aa58e84aeef2ac01ecfac3 --- /dev/null +++ b/Assets/Unity.VisualScripting.Generated.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0afd4e5dd51bbbd449f4048c44674858 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Unity.VisualScripting.Generated/VisualScripting.Flow.meta b/Assets/Unity.VisualScripting.Generated/VisualScripting.Flow.meta new file mode 100644 index 0000000000000000000000000000000000000000..b3a72a04d96ff03ed9557ffeb72283858a1a005b --- /dev/null +++ b/Assets/Unity.VisualScripting.Generated/VisualScripting.Flow.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 554be7bf9fed6a94183906486efeaadc +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Unity.VisualScripting.Generated/VisualScripting.Flow/UnitOptions.db b/Assets/Unity.VisualScripting.Generated/VisualScripting.Flow/UnitOptions.db new file mode 100644 index 0000000000000000000000000000000000000000..90e7f3979d8a923e37be7a16d6d5d8fef98402ba Binary files /dev/null and b/Assets/Unity.VisualScripting.Generated/VisualScripting.Flow/UnitOptions.db differ diff --git a/Assets/Unity.VisualScripting.Generated/VisualScripting.Flow/UnitOptions.db.meta b/Assets/Unity.VisualScripting.Generated/VisualScripting.Flow/UnitOptions.db.meta new file mode 100644 index 0000000000000000000000000000000000000000..52d15159b919ed8c707ed14aa29ab9127b06f83c --- /dev/null +++ b/Assets/Unity.VisualScripting.Generated/VisualScripting.Flow/UnitOptions.db.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3502cef1772b93b4ab4faeb43c7cd846 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/ProjectSettings/VisualScriptingSettings.asset b/ProjectSettings/VisualScriptingSettings.asset new file mode 100644 index 0000000000000000000000000000000000000000..41b57b958ebd7fdfcdf52346eddbabf140301cb7 --- /dev/null +++ b/ProjectSettings/VisualScriptingSettings.asset @@ -0,0 +1,20 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &1 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 65bae8b9f1bd244b3a27e92af4b23b2a, type: 3} + m_Name: + m_EditorClassIdentifier: + _data: + _json: '{"dictionary":{"aotSafeMode":{"$content":true,"$type":"System.Boolean"},"favoriteMembers":{"$content":[],"$type":"System.Collections.Generic.HashSet`1[[Unity.VisualScripting.Member, + Unity.VisualScripting.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"assemblyOptions":{"$content":["mscorlib","Assembly-CSharp-firstpass","Assembly-CSharp","UnityEngine","UnityEngine.CoreModule","UnityEngine.InputModule","UnityEngine.ClusterInputModule","UnityEngine.InputLegacyModule","UnityEngine.PhysicsModule","UnityEngine.Physics2DModule","UnityEngine.TerrainPhysicsModule","UnityEngine.VehiclesModule","UnityEngine.AudioModule","UnityEngine.AnimationModule","UnityEngine.VideoModule","UnityEngine.DirectorModule","UnityEngine.Timeline","UnityEngine.ParticleSystemModule","UnityEngine.ParticlesLegacyModule","UnityEngine.WindModule","UnityEngine.ClothModule","UnityEngine.TilemapModule","UnityEngine.SpriteMaskModule","UnityEngine.TerrainModule","UnityEngine.ImageConversionModule","UnityEngine.TextRenderingModule","UnityEngine.ClusterRendererModule","UnityEngine.ScreenCaptureModule","UnityEngine.AIModule","UnityEngine.UI","UnityEngine.UIModule","UnityEngine.IMGUIModule","UnityEngine.UIElementsModule","UnityEngine.StyleSheetsModule","UnityEngine.VR","UnityEngine.VRModule","UnityEngine.ARModule","UnityEngine.HoloLens","UnityEngine.SpatialTracking","UnityEngine.GoogleAudioSpatializer","UnityEngine.Networking","UnityEngine.Analytics","UnityEngine.Advertisements","UnityEngine.Purchasing","UnityEngine.UnityConnectModule","UnityEngine.UnityAnalyticsModule","UnityEngine.GameCenterModule","UnityEngine.AccessibilityModule","UnityEngine.AndroidJNIModule","UnityEngine.AssetBundleModule","UnityEngine.FileSystemHttpModule","UnityEngine.JSONSerializeModule","UnityEngine.UmbraModule","Unity.Timeline","Unity.Timeline.Editor","Cinemachine","com.unity.cinemachine.Editor","Unity.InputSystem","Unity.TextMeshPro","Unity.VisualScripting.Core","Unity.VisualScripting.Flow","Unity.VisualScripting.State"],"$type":"System.Collections.Generic.List`1[[Unity.VisualScripting.LooseAssemblyName, + Unity.VisualScripting.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"typeOptions":{"$content":["System.Object","System.Boolean","System.Int32","System.Single","System.String","UnityEngine.Vector2","UnityEngine.Vector3","UnityEngine.Vector4","UnityEngine.Quaternion","UnityEngine.Matrix4x4","UnityEngine.Rect","UnityEngine.Bounds","UnityEngine.Color","UnityEngine.AnimationCurve","UnityEngine.LayerMask","UnityEngine.Ray","UnityEngine.Ray2D","UnityEngine.RaycastHit","UnityEngine.RaycastHit2D","UnityEngine.ContactPoint","UnityEngine.ContactPoint2D","UnityEngine.ParticleCollisionEvent","UnityEngine.SceneManagement.Scene","UnityEngine.Application","UnityEngine.Resources","UnityEngine.Mathf","UnityEngine.Debug","UnityEngine.Input","UnityEngine.Touch","UnityEngine.Screen","UnityEngine.Cursor","UnityEngine.Time","UnityEngine.Random","UnityEngine.Physics","UnityEngine.Physics2D","UnityEngine.SceneManagement.SceneManager","UnityEngine.GUI","UnityEngine.GUILayout","UnityEngine.GUIUtility","UnityEngine.Audio.AudioMixerGroup","UnityEngine.AI.NavMesh","UnityEngine.Gizmos","UnityEngine.AnimatorStateInfo","UnityEngine.EventSystems.BaseEventData","UnityEngine.EventSystems.PointerEventData","UnityEngine.EventSystems.AxisEventData","System.Collections.IList","System.Collections.IDictionary","Unity.VisualScripting.AotList","Unity.VisualScripting.AotDictionary","System.Exception"],"$type":"System.Collections.Generic.List`1[[System.Type, + mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"projectSetupCompleted":{"$content":false,"$type":"System.Boolean"},"savedVersion":{"major":1,"minor":8,"patch":0,"label":null,"increment":0,"$type":"Unity.VisualScripting.SemanticVersion"}}}' + _objectReferences: []