Boss Hurts PLayer

This commit is contained in:
Garrett Kaiser
2026-01-15 14:54:58 -08:00
parent 3d0dbd029a
commit ef830fd4ac
6 changed files with 85 additions and 4 deletions

Binary file not shown.

View File

@@ -0,0 +1,29 @@
using UnityEngine;
public class JumpHitbox : MonoBehaviour
{
public PlayerMovement playerMovement;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Player"))
{
Debug.Log("Hit Player");
playerMovement.HP -= 1;
}
else{
Debug.Log("Failed");
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ba495adcc9de84e148094bc4f9073dfa

View File

@@ -0,0 +1,29 @@
using UnityEngine;
public class LungeHitbox : MonoBehaviour
{
public PlayerMovement playerMovement;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Player"))
{
Debug.Log("Hit Player");
playerMovement.HP -= 1.5f;
}
else{
Debug.Log("Failed");
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 982fdb439fe8344d68124ca1628747ae

View File

@@ -12,6 +12,9 @@ public class SteampunkBoss : MonoBehaviour
public GameObject JumpHitbox; public GameObject JumpHitbox;
public GameObject LungeHitbox;
public float lungeBackup;
// 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()
{ {
@@ -23,6 +26,7 @@ public class SteampunkBoss : MonoBehaviour
{ {
if (stallTimer <= 0) if (stallTimer <= 0)
{ {
transform.LookAt(Player.transform);
randomNumber = Random.Range(1, 6); randomNumber = Random.Range(1, 6);
setTimer = false; setTimer = false;
} }
@@ -113,13 +117,24 @@ public class SteampunkBoss : MonoBehaviour
TargetPosition = Player.transform.position; TargetPosition = Player.transform.position;
setposition = true; setposition = true;
} }
if (lungeBackup > 0)
{
transform.position = Vector3.MoveTowards(transform.position, TargetPosition, -10 * Time.deltaTime);
lungeBackup -= Time.deltaTime;
}
if (lungeBackup <= 0)
{
LungeHitbox.SetActive(true);
transform.position = Vector3.MoveTowards(transform.position, TargetPosition, 30 * Time.deltaTime); transform.position = Vector3.MoveTowards(transform.position, TargetPosition, 30 * Time.deltaTime);
}
if (transform.position == TargetPosition) if (transform.position == TargetPosition)
{ {
LungeHitbox.SetActive(false);
stallTimer -= Time.deltaTime; stallTimer -= Time.deltaTime;
} }
if (stallTimer <= 0) if (stallTimer <= 0)
{ {
lungeBackup = 1;
setposition = false; setposition = false;
} }
} }
@@ -148,9 +163,13 @@ public class SteampunkBoss : MonoBehaviour
public void OnTriggerEnter(Collider other) public void OnTriggerEnter(Collider other)
{ {
if (randomNumber == 1) if (other.CompareTag("Player"))
{ {
Debug.Log("Hit Player");
playerMovement.HP -= 1; playerMovement.HP -= 1;
} }
else{
Debug.Log("Failed");
}
} }
} }