Merge branch 'main' of https://github.com/orsolya-st/gamejam_050626
This commit is contained in:
@@ -14,7 +14,7 @@ GameObject:
|
|||||||
- component: {fileID: 5321372118810808216}
|
- component: {fileID: 5321372118810808216}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Branch
|
m_Name: Branch
|
||||||
m_TagString: Untagged
|
m_TagString: Platform
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ GameObject:
|
|||||||
- component: {fileID: 8211840801622381919}
|
- component: {fileID: 8211840801622381919}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: MiniDroplet
|
m_Name: MiniDroplet
|
||||||
m_TagString: Untagged
|
m_TagString: Minidrop
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
@@ -140,7 +140,7 @@ Animation:
|
|||||||
m_GameObject: {fileID: 3724115605263402928}
|
m_GameObject: {fileID: 3724115605263402928}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
serializedVersion: 4
|
serializedVersion: 4
|
||||||
m_Animation: {fileID: 0}
|
m_Animation: {fileID: 7400000, guid: e4158635e9083d84b8d27001bfbda9b7, type: 2}
|
||||||
m_Animations: []
|
m_Animations: []
|
||||||
m_WrapMode: 0
|
m_WrapMode: 0
|
||||||
m_PlayAutomatically: 1
|
m_PlayAutomatically: 1
|
||||||
@@ -157,7 +157,7 @@ Animator:
|
|||||||
m_GameObject: {fileID: 3724115605263402928}
|
m_GameObject: {fileID: 3724115605263402928}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
m_Avatar: {fileID: 0}
|
m_Avatar: {fileID: 0}
|
||||||
m_Controller: {fileID: 0}
|
m_Controller: {fileID: 9100000, guid: 3bbead65504fbb048ac08d62468d0776, type: 2}
|
||||||
m_CullingMode: 0
|
m_CullingMode: 0
|
||||||
m_UpdateMode: 0
|
m_UpdateMode: 0
|
||||||
m_ApplyRootMotion: 0
|
m_ApplyRootMotion: 0
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ GameObject:
|
|||||||
- component: {fileID: 1462837664068369080}
|
- component: {fileID: 1462837664068369080}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: LeaveObstacle
|
m_Name: LeaveObstacle
|
||||||
m_TagString: Untagged
|
m_TagString: Platform
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ GameObject:
|
|||||||
- component: {fileID: 1230605949537068183}
|
- component: {fileID: 1230605949537068183}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: RealBranch 1
|
m_Name: RealBranch 1
|
||||||
m_TagString: Untagged
|
m_TagString: Platform
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ GameObject:
|
|||||||
- component: {fileID: 1230605949537068183}
|
- component: {fileID: 1230605949537068183}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: RealBranch
|
m_Name: RealBranch
|
||||||
m_TagString: Untagged
|
m_TagString: Platform
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System.Collections;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Object = System.Object;
|
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
public class DamageHandler : MonoBehaviour
|
public class DamageHandler : MonoBehaviour
|
||||||
@@ -60,17 +59,16 @@ public class DamageHandler : MonoBehaviour
|
|||||||
|
|
||||||
private void OnCollisionEnter2D(Collision2D other)
|
private void OnCollisionEnter2D(Collision2D other)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (other.collider.CompareTag("Minidrop")){
|
||||||
|
UpdateHealth(0.2f);
|
||||||
|
}
|
||||||
|
//on collision check fall damage
|
||||||
float fallSpeed = lastYVelocity;
|
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}");
|
|
||||||
UpdateHealth(health - fallDamage);
|
UpdateHealth(health - fallDamage);
|
||||||
// Debug.Log($"New health:{health - fallDamage}");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Debug.Log($"Fell with velocity:{fallSpeed}. No fall damage");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,14 +76,15 @@ public class DamageHandler : MonoBehaviour
|
|||||||
public void UpdateHealth(float health)
|
public void UpdateHealth(float health)
|
||||||
{
|
{
|
||||||
this.health = health;
|
this.health = health;
|
||||||
|
if (health > maxHealth) this.health = maxHealth;
|
||||||
|
|
||||||
Transform transform = GetComponent<Transform>();
|
Transform transform = GetComponent<Transform>();
|
||||||
float healthScaling = minSize + (1 - minSize) * (this.health / maxHealth);
|
float healthScaling = minSize + (1 - minSize) * (this.health / maxHealth);
|
||||||
|
//adjust size based on health
|
||||||
transform.localScale = new Vector3(healthScaling,healthScaling,healthScaling);
|
transform.localScale = new Vector3(healthScaling,healthScaling,healthScaling);
|
||||||
// Debug.Log("UpdatedScale and health");
|
|
||||||
|
|
||||||
if(this.health <= 0f)
|
if(this.health <= 0f)
|
||||||
{
|
{
|
||||||
// Debug.Log("Die");
|
|
||||||
Die();
|
Die();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ public class DropletMovement : MonoBehaviour
|
|||||||
private Collider2D characterCollider;
|
private Collider2D characterCollider;
|
||||||
|
|
||||||
// helper variables
|
// helper variables
|
||||||
private bool isGrounded = true;
|
private bool isGrounded = false;
|
||||||
private float facingDirection = 1f;
|
private float facingDirection = 1f;
|
||||||
private bool isDropping = false;
|
private bool isDropping = false;
|
||||||
private float fallTimer;
|
private float fallTimer;
|
||||||
@@ -40,7 +40,7 @@ public class DropletMovement : MonoBehaviour
|
|||||||
{
|
{
|
||||||
|
|
||||||
//dashing
|
//dashing
|
||||||
if (isDashing)
|
if (isDashing || isGrounded == false)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -93,18 +93,15 @@ public class DropletMovement : MonoBehaviour
|
|||||||
if (isDashing || isDropping)
|
if (isDashing || isDropping)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
} // was here before
|
}
|
||||||
|
|
||||||
|
//wind
|
||||||
float windForce = 0f;
|
float windForce = 0f;
|
||||||
|
|
||||||
if (WindManager.Instance != null)
|
if (WindManager.Instance != null)
|
||||||
{
|
{
|
||||||
windForce = WindManager.Instance.CurrentWindForce;
|
windForce = WindManager.Instance.CurrentWindForce;
|
||||||
}
|
}
|
||||||
|
|
||||||
rb.linearVelocity = new Vector2(movement.x * moveSpeed + windForce, rb.linearVelocity.y);
|
rb.linearVelocity = new Vector2(movement.x * moveSpeed + windForce, rb.linearVelocity.y);
|
||||||
|
|
||||||
//used to be rb.linearVelocity = new Vector2(movement.x * moveSpeed, rb.linearVelocity.y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnTriggerEnter2D(Collider2D other)
|
private void OnTriggerEnter2D(Collider2D other)
|
||||||
@@ -151,9 +148,24 @@ public class DropletMovement : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void OnCollisionEnter2D(Collision2D col)
|
private void OnCollisionEnter2D(Collision2D col)
|
||||||
|
{
|
||||||
|
if (col.collider.CompareTag("Platform") && rb.linearVelocity.y == 0)
|
||||||
{
|
{
|
||||||
isGrounded = true;
|
isGrounded = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isGrounded = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnCollisionExit2D(Collision2D collision)
|
||||||
|
{
|
||||||
|
if (collision.collider.CompareTag("Platform"))
|
||||||
|
{
|
||||||
|
isGrounded = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void DropDown()
|
private void DropDown()
|
||||||
|
|||||||
@@ -2,15 +2,13 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class MiniDroplet : MonoBehaviour
|
public class MiniDroplet : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
||||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
float size = Random.Range(0.3f, 0.7f);
|
||||||
|
Vector2 targetSize = new Vector2(size, size);
|
||||||
|
|
||||||
}
|
transform.localScale = targetSize;
|
||||||
|
|
||||||
// Update is called once per frame
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ TagManager:
|
|||||||
tags:
|
tags:
|
||||||
- Border
|
- Border
|
||||||
- Hole
|
- Hole
|
||||||
|
- Minidrop
|
||||||
|
- Platform
|
||||||
layers:
|
layers:
|
||||||
- Default
|
- Default
|
||||||
- TransparentFX
|
- TransparentFX
|
||||||
|
|||||||
Reference in New Issue
Block a user