Fixed minidroplet

This commit is contained in:
go38coz
2026-06-06 18:22:06 +02:00
parent 2c3933d77f
commit b868459d86
2 changed files with 199 additions and 7 deletions
+185
View File
@@ -119,6 +119,11 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!4 &33859906 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
m_PrefabInstance: {fileID: 1489069184}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &274994935
PrefabInstance:
m_ObjectHideFlags: 0
@@ -176,6 +181,63 @@ PrefabInstance:
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
--- !u!1001 &488250683
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 3724115605263402928, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
propertyPath: m_Name
value: MiniDroplet
objectReference: {fileID: 0}
- target: {fileID: 7100472280186483774, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
propertyPath: m_LocalPosition.x
value: 3.3575556
objectReference: {fileID: 0}
- target: {fileID: 7100472280186483774, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
propertyPath: m_LocalPosition.y
value: -4.47
objectReference: {fileID: 0}
- target: {fileID: 7100472280186483774, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7100472280186483774, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7100472280186483774, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7100472280186483774, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7100472280186483774, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7100472280186483774, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7100472280186483774, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7100472280186483774, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 5bb8206709807ff4cae9583b3ee3e67d, type: 3}
--- !u!1 &505713147
GameObject:
m_ObjectHideFlags: 0
@@ -370,6 +432,11 @@ Transform:
m_CorrespondingSourceObject: {fileID: 6566899495513628888, guid: d56297e435f8410a584581d73d99d2e4, type: 3}
m_PrefabInstance: {fileID: 1445156949}
m_PrefabAsset: {fileID: 0}
--- !u!4 &688751894 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
m_PrefabInstance: {fileID: 1870986352}
m_PrefabAsset: {fileID: 0}
--- !u!1 &750131489
GameObject:
m_ObjectHideFlags: 0
@@ -493,6 +560,7 @@ MonoBehaviour:
maxHealth: 1
health: 0
minSize: 0.4
maxFallingTime: 2
--- !u!1001 &1445156949
PrefabInstance:
m_ObjectHideFlags: 0
@@ -581,6 +649,63 @@ PrefabInstance:
insertIndex: -1
addedObject: {fileID: 1229548147}
m_SourcePrefab: {fileID: 100100000, guid: d56297e435f8410a584581d73d99d2e4, type: 3}
--- !u!1001 &1489069184
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 2072448676}
m_Modifications:
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalPosition.x
value: -2.25
objectReference: {fileID: 0}
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalPosition.y
value: -5.23
objectReference: {fileID: 0}
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8871780616060845038, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_Name
value: Branch (3)
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
--- !u!1001 &1681788161
PrefabInstance:
m_ObjectHideFlags: 0
@@ -761,6 +886,63 @@ SpriteRenderer:
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_SpriteSortPoint: 0
--- !u!1001 &1870986352
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 2072448676}
m_Modifications:
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalPosition.x
value: 1.89
objectReference: {fileID: 0}
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalPosition.y
value: -5.28
objectReference: {fileID: 0}
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2163867978973577705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8871780616060845038, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
propertyPath: m_Name
value: Branch (4)
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
--- !u!1001 &1890470405
PrefabInstance:
m_ObjectHideFlags: 0
@@ -911,6 +1093,8 @@ Transform:
m_Children:
- {fileID: 1944302763}
- {fileID: 1124127124}
- {fileID: 33859906}
- {fileID: 688751894}
- {fileID: 1710653547}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -923,3 +1107,4 @@ SceneRoots:
- {fileID: 2072448676}
- {fileID: 1445156949}
- {fileID: 750131492}
- {fileID: 488250683}
+14 -7
View File
@@ -1,3 +1,4 @@
using System;
using System.Collections;
using UnityEngine;
using UnityEngine.SceneManagement;
@@ -39,7 +40,7 @@ public class DamageHandler : MonoBehaviour
if (lastYVelocity >= 0 && currentVelocity < 0)
{
falling = true;
Debug.Log("Started falling");
// Debug.Log("Started falling");
fallTime = 0f;
}
else if(lastYVelocity < 0 && currentVelocity < 0)
@@ -51,7 +52,7 @@ public class DamageHandler : MonoBehaviour
fallTime += Time.deltaTime;
} else if(currentVelocity >= 0)
{
Debug.Log("Not falling");
// Debug.Log("Not falling");
falling = false;
}
lastYVelocity = currentVelocity;
@@ -59,10 +60,7 @@ public class DamageHandler : MonoBehaviour
private void OnCollisionEnter2D(Collision2D other)
{
if (other.collider.CompareTag("Minidrop")){
UpdateHealth(0.2f);
}
// Debug.LogWarning("collide");
//on collision check fall damage
float fallSpeed = lastYVelocity;
if (fallSpeed < -threshold)
@@ -71,7 +69,16 @@ public class DamageHandler : MonoBehaviour
UpdateHealth(health - fallDamage);
}
}
private void OnTriggerEnter2D(Collider2D other)
{
if (other.CompareTag("Minidrop")){
UpdateHealth(health + 0.2f);
Destroy(other.gameObject);
return;
}
}
public void UpdateHealth(float health)
{