Merge branch 'main' of https://github.com/orsolya-st/gamejam_050626
This commit is contained in:
@@ -142,3 +142,4 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: bbf8ab4673d6bf447aab098a12320431, type: 3}
|
m_Script: {fileID: 11500000, guid: bbf8ab4673d6bf447aab098a12320431, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier: Assembly-CSharp::SceneController
|
m_EditorClassIdentifier: Assembly-CSharp::SceneController
|
||||||
|
sceneIndex: 2
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ GameObject:
|
|||||||
- component: {fileID: 9198730630941053147}
|
- component: {fileID: 9198730630941053147}
|
||||||
- component: {fileID: 711765053222976334}
|
- component: {fileID: 711765053222976334}
|
||||||
- component: {fileID: 4924165898665643858}
|
- component: {fileID: 4924165898665643858}
|
||||||
|
- component: {fileID: 1462837664068369080}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: LeaveObstacle
|
m_Name: LeaveObstacle
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@@ -215,10 +216,10 @@ BoxCollider2D:
|
|||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Bits: 4294967295
|
m_Bits: 4294967295
|
||||||
m_IsTrigger: 0
|
m_IsTrigger: 0
|
||||||
m_UsedByEffector: 0
|
m_UsedByEffector: 1
|
||||||
m_CompositeOperation: 0
|
m_CompositeOperation: 0
|
||||||
m_CompositeOrder: 0
|
m_CompositeOrder: 0
|
||||||
m_Offset: {x: -0.46760708, y: 1.2761748}
|
m_Offset: {x: 0.3, y: 1.2761748}
|
||||||
m_SpriteTilingProperty:
|
m_SpriteTilingProperty:
|
||||||
border: {x: 0, y: 0, z: 0, w: 0}
|
border: {x: 0, y: 0, z: 0, w: 0}
|
||||||
pivot: {x: 0.5, y: 0.5}
|
pivot: {x: 0.5, y: 0.5}
|
||||||
@@ -230,3 +231,22 @@ BoxCollider2D:
|
|||||||
m_AutoTiling: 0
|
m_AutoTiling: 0
|
||||||
m_Size: {x: 4.656008, y: 0.5337138}
|
m_Size: {x: 4.656008, y: 0.5337138}
|
||||||
m_EdgeRadius: 0
|
m_EdgeRadius: 0
|
||||||
|
--- !u!251 &1462837664068369080
|
||||||
|
PlatformEffector2D:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7890225293042883908}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_UseColliderMask: 1
|
||||||
|
m_ColliderMask:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_RotationalOffset: 0
|
||||||
|
m_UseOneWay: 1
|
||||||
|
m_UseOneWayGrouping: 0
|
||||||
|
m_SurfaceArc: 180
|
||||||
|
m_UseSideFriction: 0
|
||||||
|
m_UseSideBounce: 0
|
||||||
|
m_SideArc: 1
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ GameObject:
|
|||||||
- component: {fileID: 4218697106962905645}
|
- component: {fileID: 4218697106962905645}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: PlayerDroplet
|
m_Name: PlayerDroplet
|
||||||
m_TagString: Untagged
|
m_TagString: Player
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
|
|||||||
@@ -3004,6 +3004,14 @@ PrefabInstance:
|
|||||||
propertyPath: m_LocalEulerAnglesHint.z
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6893150318335556705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_SortingLayer
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6893150318335556705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_SortingLayerID
|
||||||
|
value: -925020913
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8871780616060845038, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
- target: {fileID: 8871780616060845038, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: Branch
|
value: Branch
|
||||||
@@ -3067,9 +3075,17 @@ PrefabInstance:
|
|||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 6893150318335556705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
- target: {fileID: 6893150318335556705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
propertyPath: m_SortingOrder
|
propertyPath: m_SortingLayer
|
||||||
value: 1
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6893150318335556705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_SortingOrder
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6893150318335556705, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
|
propertyPath: m_SortingLayerID
|
||||||
|
value: -925020913
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8871780616060845038, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
- target: {fileID: 8871780616060845038, guid: 2f44dc6d6adb9ae7f9b4f644da0e3485, type: 3}
|
||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: Branch (2)
|
value: Branch (2)
|
||||||
@@ -3283,6 +3299,10 @@ PrefabInstance:
|
|||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
m_TransformParent: {fileID: 1428449368}
|
m_TransformParent: {fileID: 1428449368}
|
||||||
m_Modifications:
|
m_Modifications:
|
||||||
|
- target: {fileID: 4924165898665643858, guid: 09646d5b25a07904aa2ddf7399b3b075, type: 3}
|
||||||
|
propertyPath: m_Offset.x
|
||||||
|
value: 0.3
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7890225293042883908, guid: 09646d5b25a07904aa2ddf7399b3b075, type: 3}
|
- target: {fileID: 7890225293042883908, guid: 09646d5b25a07904aa2ddf7399b3b075, type: 3}
|
||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: LeaveObstacle
|
value: LeaveObstacle
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Object = System.Object;
|
|||||||
|
|
||||||
public class DamageHandler : MonoBehaviour
|
public class DamageHandler : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
private Rigidbody2D rb;
|
||||||
public float threshold = 2.5f;
|
public float threshold = 2.5f;
|
||||||
public float multiplier = 0.5f;
|
public float multiplier = 0.5f;
|
||||||
|
|
||||||
@@ -11,23 +12,35 @@ public class DamageHandler : MonoBehaviour
|
|||||||
public float health;
|
public float health;
|
||||||
public float minSize = 0.4f;
|
public float minSize = 0.4f;
|
||||||
|
|
||||||
|
private float lastYVelocity;
|
||||||
|
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
rb = GetComponent<Rigidbody2D>();
|
||||||
|
}
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
threshold = 2.5f;
|
threshold = 10f;
|
||||||
multiplier = 0.5f;
|
multiplier = 0.1f;
|
||||||
|
|
||||||
maxHealth = 1f;
|
maxHealth = 1f;
|
||||||
minSize = 0.8f;
|
minSize = 0.8f;
|
||||||
health = maxHealth;
|
health = maxHealth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void FixedUpdate()
|
||||||
|
{
|
||||||
|
lastYVelocity = rb.linearVelocityY;
|
||||||
|
}
|
||||||
|
|
||||||
private void OnCollisionEnter2D(Collision2D other)
|
private void OnCollisionEnter2D(Collision2D other)
|
||||||
{
|
{
|
||||||
float fallSpeed = GetComponent<Rigidbody2D>().linearVelocityY;
|
float fallSpeed = lastYVelocity;
|
||||||
if (fallSpeed > threshold)
|
if (fallSpeed < -threshold)
|
||||||
{
|
{
|
||||||
float fallDamage = (fallSpeed - threshold) * multiplier;
|
float fallDamage = (-fallSpeed - threshold) * multiplier;
|
||||||
Debug.Log($"Fell with velocity:{fallSpeed}. Fall damage{fallDamage}");
|
Debug.Log($"Fell with velocity:{fallSpeed}. Fall damage{fallDamage}");
|
||||||
UpdateHealth(health - fallDamage);
|
UpdateHealth(health - fallDamage);
|
||||||
// Debug.Log($"New health:{health - fallDamage}");
|
// Debug.Log($"New health:{health - fallDamage}");
|
||||||
@@ -38,6 +51,7 @@ public class DamageHandler : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void UpdateHealth(float health)
|
public void UpdateHealth(float health)
|
||||||
{
|
{
|
||||||
this.health = health;
|
this.health = health;
|
||||||
|
|||||||
Reference in New Issue
Block a user