diff --git a/Assets/Scenes/Scene1-Boss.unity b/Assets/Scenes/Scene1-Boss.unity index 347e5f9..c3f30e8 100644 --- a/Assets/Scenes/Scene1-Boss.unity +++ b/Assets/Scenes/Scene1-Boss.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:84039ec79fe1d902655c8dc1671f4411196df41548e9169a1f87dbf64fd71784 -size 1279581 +oid sha256:5fbd31f910a39e3cf560f649257246ecf6fcebebb2959611cddffd7803f11806 +size 1279626 diff --git a/Assets/Scripts/SteampunkBoss.cs b/Assets/Scripts/SteampunkBoss.cs index 84dbc6a..8ad0319 100644 --- a/Assets/Scripts/SteampunkBoss.cs +++ b/Assets/Scripts/SteampunkBoss.cs @@ -3,8 +3,10 @@ using UnityEngine; public class SteampunkBoss : MonoBehaviour { public GameObject Player; - - public Vector3 TargetJumpPosition; + public int randomNumber = 0; + public float stallTimer = 0; + public bool setTimer = false; + public Vector3 TargetPosition; public bool setposition = false; // Start is called once before the first execution of Update after the MonoBehaviour is created @@ -16,36 +18,114 @@ public class SteampunkBoss : MonoBehaviour // Update is called once per frame void Update() { - JumpAttack(); + if (stallTimer <= 0) + { + randomNumber = Random.Range(1, 6); + setTimer = false; + } + + if (randomNumber == 1) + { + JumpAttack(); + } + else if (randomNumber == 2) + { + RocketAttack(); + } + else if (randomNumber == 3) + { + LungeAttack(); + } + else if (randomNumber == 4) + { + SlashAttack(); + } + else if (randomNumber == 5) + { + Block(); + } } void JumpAttack() { + if (!setTimer) + { + stallTimer = 1; + setTimer = true; + } if (!setposition) { - TargetJumpPosition = Player.transform.position; + TargetPosition = Player.transform.position; setposition = true; } - transform.position = Vector3.MoveTowards(transform.position, new Vector3(TargetJumpPosition.x, 20, TargetJumpPosition.z), 20 * Time.deltaTime); + transform.position = Vector3.MoveTowards(transform.position, new Vector3(TargetPosition.x, 20, TargetPosition.z), 20 * Time.deltaTime); + if ((transform.position.x == TargetPosition.x) && (transform.position.z == TargetPosition.z)) + { + transform.position = Vector3.MoveTowards(transform.position, TargetPosition, 80 * Time.deltaTime); + } + if (transform.position == TargetPosition) + { + stallTimer -= Time.deltaTime; + } + if (stallTimer <= 0) + { + setposition = false; + } } void RocketAttack() { - + if (!setTimer) + { + stallTimer = 1; + setTimer = true; + } + + stallTimer -= Time.deltaTime; } void LungeAttack() { - + if (!setTimer) + { + stallTimer = 0.5f; + setTimer = true; + } + if (!setposition) + { + TargetPosition = Player.transform.position; + setposition = true; + } + transform.position = Vector3.MoveTowards(transform.position, TargetPosition, 30 * Time.deltaTime); + if (transform.position == TargetPosition) + { + stallTimer -= Time.deltaTime; + } + if (stallTimer <= 0) + { + setposition = false; + } } void SlashAttack() { - + if (!setTimer) + { + stallTimer = 1; + setTimer = true; + } + + stallTimer -= Time.deltaTime; } void Block() { - + if (!setTimer) + { + stallTimer = 1; + setTimer = true; + } + + stallTimer -= Time.deltaTime; } }