Boss Hurts PLayer
This commit is contained in:
@@ -12,6 +12,9 @@ public class SteampunkBoss : MonoBehaviour
|
||||
|
||||
public GameObject JumpHitbox;
|
||||
|
||||
public GameObject LungeHitbox;
|
||||
public float lungeBackup;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
@@ -23,6 +26,7 @@ public class SteampunkBoss : MonoBehaviour
|
||||
{
|
||||
if (stallTimer <= 0)
|
||||
{
|
||||
transform.LookAt(Player.transform);
|
||||
randomNumber = Random.Range(1, 6);
|
||||
setTimer = false;
|
||||
}
|
||||
@@ -113,13 +117,24 @@ public class SteampunkBoss : MonoBehaviour
|
||||
TargetPosition = Player.transform.position;
|
||||
setposition = true;
|
||||
}
|
||||
transform.position = Vector3.MoveTowards(transform.position, TargetPosition, 30 * Time.deltaTime);
|
||||
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);
|
||||
}
|
||||
if (transform.position == TargetPosition)
|
||||
{
|
||||
LungeHitbox.SetActive(false);
|
||||
stallTimer -= Time.deltaTime;
|
||||
}
|
||||
if (stallTimer <= 0)
|
||||
{
|
||||
lungeBackup = 1;
|
||||
setposition = false;
|
||||
}
|
||||
}
|
||||
@@ -148,9 +163,13 @@ public class SteampunkBoss : MonoBehaviour
|
||||
|
||||
public void OnTriggerEnter(Collider other)
|
||||
{
|
||||
if (randomNumber == 1)
|
||||
if (other.CompareTag("Player"))
|
||||
{
|
||||
Debug.Log("Hit Player");
|
||||
playerMovement.HP -= 1;
|
||||
}
|
||||
else{
|
||||
Debug.Log("Failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user