From be654637d24a11a31444bd7cf12634403cf838e8 Mon Sep 17 00:00:00 2001 From: Henry <henrytshotwell@gmail.com> Date: Wed, 20 Mar 2024 18:03:41 -0400 Subject: [PATCH] point break --- Assets/Prefabs/extinguisher.prefab | 6 +++--- Assets/Scenes/TestMovement.unity | 4 ++++ Assets/Scripts/GM.cs | 7 +++++++ Assets/Scripts/Objects/Extinguisher.cs | 7 ++++++- Assets/Scripts/Objects/ObjectHealth.cs | 4 ++++ 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Assets/Prefabs/extinguisher.prefab b/Assets/Prefabs/extinguisher.prefab index dff0108..4c296aa 100644 --- a/Assets/Prefabs/extinguisher.prefab +++ b/Assets/Prefabs/extinguisher.prefab @@ -26,13 +26,13 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 836299710778053083} serializedVersion: 2 - m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068} - m_LocalPosition: {x: -1.6, y: -2.8, z: -0.4} + m_LocalRotation: {x: 0, y: 1, z: 0, w: 0} + m_LocalPosition: {x: -1.6, y: 0.2, z: -2} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2140468118705131016} - m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0} --- !u!198 &271574366033552408 ParticleSystem: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/TestMovement.unity b/Assets/Scenes/TestMovement.unity index 15d51a8..5f2e147 100644 --- a/Assets/Scenes/TestMovement.unity +++ b/Assets/Scenes/TestMovement.unity @@ -3257,6 +3257,10 @@ PrefabInstance: propertyPath: m_Name value: extinguisher objectReference: {fileID: 0} + - target: {fileID: 5943070958037994730, guid: d6f71a072d0de754da29b25411179453, type: 3} + propertyPath: activeSpeed + value: 9999 + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] diff --git a/Assets/Scripts/GM.cs b/Assets/Scripts/GM.cs index 67ade82..4d74d6f 100644 --- a/Assets/Scripts/GM.cs +++ b/Assets/Scripts/GM.cs @@ -110,6 +110,13 @@ public static void trackPoints(ObjectPoints obj) trackingObjects.Add(tracker); } + public static void instantPoints(int points) + { + var tracker = Instantiate(pointPre, canvasTransform).GetComponent<PointTracker>(); + tracker.points = points; + combo++; + } + public static IEnumerator AddScore(PointTracker source, float basePoints) { int points = (int)source.points; diff --git a/Assets/Scripts/Objects/Extinguisher.cs b/Assets/Scripts/Objects/Extinguisher.cs index 1fe9492..59bccbb 100644 --- a/Assets/Scripts/Objects/Extinguisher.cs +++ b/Assets/Scripts/Objects/Extinguisher.cs @@ -36,7 +36,12 @@ void Update() { lifetime -= Time.deltaTime; myBod.velocity = transform.forward * currentRandomTime; - if (lifetime <= 0f) { myBod.useGravity = true; } + Debug.Log(myBod.velocity); + if (lifetime <= 0f) + { + myBod.useGravity = true; + if (smoke) { var s = smoke.emission; s.enabled = false; } + } else { if (currentRandomTime > 0f) diff --git a/Assets/Scripts/Objects/ObjectHealth.cs b/Assets/Scripts/Objects/ObjectHealth.cs index c31e49b..81a4c9a 100644 --- a/Assets/Scripts/Objects/ObjectHealth.cs +++ b/Assets/Scripts/Objects/ObjectHealth.cs @@ -17,6 +17,8 @@ public class ObjectHealth : MonoBehaviour private GameObject broken1; private GameObject broken2; + [Range(1,100)]public int breakScore; + /// <summary> /// Meant to be called by Cats code that's dealing with launching the items /// </summary> @@ -40,6 +42,8 @@ public void Damage(float damage) { //Maybe we want a cracked material on it if its damaged but won't break, we would do that here } + + GM.instantPoints(breakScore); } } -- GitLab