This commit is contained in:
Garrett Kaiser
2026-01-13 15:34:35 -08:00
parent 6a89355a5e
commit 3d0dbd029a
2 changed files with 29 additions and 4 deletions

Binary file not shown.

View File

@@ -2,6 +2,7 @@ using UnityEngine;
public class SteampunkBoss : MonoBehaviour public class SteampunkBoss : MonoBehaviour
{ {
public PlayerMovement playerMovement;
public GameObject Player; public GameObject Player;
public int randomNumber = 0; public int randomNumber = 0;
public float stallTimer = 0; public float stallTimer = 0;
@@ -9,6 +10,8 @@ public class SteampunkBoss : MonoBehaviour
public Vector3 TargetPosition; public Vector3 TargetPosition;
public bool setposition = false; public bool setposition = false;
public GameObject JumpHitbox;
// 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()
{ {
@@ -62,9 +65,11 @@ public class SteampunkBoss : MonoBehaviour
if ((transform.position.x == TargetPosition.x) && (transform.position.z == TargetPosition.z)) if ((transform.position.x == TargetPosition.x) && (transform.position.z == TargetPosition.z))
{ {
transform.position = Vector3.MoveTowards(transform.position, TargetPosition, 80 * Time.deltaTime); transform.position = Vector3.MoveTowards(transform.position, TargetPosition, 80 * Time.deltaTime);
JumpHitbox.SetActive(true);
} }
if (transform.position == TargetPosition) if (transform.position == TargetPosition)
{ {
JumpHitbox.SetActive(false);
stallTimer -= Time.deltaTime; stallTimer -= Time.deltaTime;
} }
if (stallTimer <= 0) if (stallTimer <= 0)
@@ -77,11 +82,23 @@ public class SteampunkBoss : MonoBehaviour
{ {
if (!setTimer) if (!setTimer)
{ {
stallTimer = 1; stallTimer = 3;
setTimer = true; setTimer = true;
} }
if (!setposition)
{
TargetPosition = Player.transform.position;
setposition = true;
}
if (stallTimer >= 2.6 && randomNumber == 2)
{
transform.position = Vector3.MoveTowards(transform.position, TargetPosition, -30 * Time.deltaTime);
}
stallTimer -= Time.deltaTime; stallTimer -= Time.deltaTime;
if (stallTimer <= 0)
{
setposition = false;
}
} }
void LungeAttack() void LungeAttack()
@@ -128,4 +145,12 @@ public class SteampunkBoss : MonoBehaviour
stallTimer -= Time.deltaTime; stallTimer -= Time.deltaTime;
} }
public void OnTriggerEnter(Collider other)
{
if (randomNumber == 1)
{
playerMovement.HP -= 1;
}
}
} }