mirror of
https://github.com/Kizuren/ShantiManti.git
synced 2025-12-21 21:16:04 +01:00
Fixed ground collision bug
Enemy Claudia dies when it isn't on the ground. At one level the collision check wasn't on the ground which led to this bug Bug only occurred in level9
This commit is contained in:
parent
31f428881f
commit
b80f002175
2 changed files with 7 additions and 7 deletions
|
|
@ -222,6 +222,7 @@ MonoBehaviour:
|
|||
nextWaypointDistance: 3
|
||||
health: 100
|
||||
deathEffect: {fileID: 1755349173569476, guid: 3c45864be6a059a4a82a25e285298338, type: 3}
|
||||
groundCheckCollider: {fileID: 4147001279113351536}
|
||||
--- !u!70 &8918774247366146758
|
||||
CapsuleCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -251,6 +252,6 @@ CapsuleCollider2D:
|
|||
m_IsTrigger: 0
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: -0.062099952, y: -0.9213682}
|
||||
m_Size: {x: 0.7099047, y: 0.07086252}
|
||||
m_Offset: {x: -0.062099952, y: -0.92672855}
|
||||
m_Size: {x: 0.70990473, y: 0.0815834}
|
||||
m_Direction: 1
|
||||
|
|
|
|||
|
|
@ -18,12 +18,14 @@ public class Claudia : MonoBehaviour
|
|||
Rigidbody2D rb;
|
||||
Transform enemyGFX;
|
||||
Animator animator;
|
||||
Collider2D groundCheckCollider;
|
||||
|
||||
[Header("Health")]
|
||||
public int health = 100;
|
||||
public GameObject deathEffect;
|
||||
|
||||
[Header("Ground Check")]
|
||||
public Collider2D groundCheckCollider;
|
||||
|
||||
bool StopHurting = false;
|
||||
bool StopAttack = false;
|
||||
bool Stop = false;
|
||||
|
|
@ -34,7 +36,6 @@ public class Claudia : MonoBehaviour
|
|||
{
|
||||
seeker = GetComponent<Seeker>();
|
||||
rb = GetComponent<Rigidbody2D>();
|
||||
groundCheckCollider = GetComponent<Collider2D>();
|
||||
animator = GetComponentInChildren<Animator>();
|
||||
player = GameObject.FindGameObjectWithTag("Player").transform;
|
||||
|
||||
|
|
@ -69,7 +70,7 @@ public class Claudia : MonoBehaviour
|
|||
}
|
||||
|
||||
float distance = Vector2.Distance(transform.position, player.position);
|
||||
if (Stop == false && InNear == true && StopAttack == false)
|
||||
if (!Stop && InNear && !StopAttack)
|
||||
{
|
||||
if (path == null)
|
||||
{
|
||||
|
|
@ -117,10 +118,8 @@ public class Claudia : MonoBehaviour
|
|||
// check if the enemy is not on the ground
|
||||
if (!IsOnGround())
|
||||
{
|
||||
// destroy the enemy game object
|
||||
DestroyEnemy();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void OnCollisionEnter2D(Collision2D collision)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue