summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Boss1/Boss1MovementSCript.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Scripts/Boss1/Boss1MovementSCript.cs')
-rwxr-xr-xAssets/Scripts/Boss1/Boss1MovementSCript.cs41
1 files changed, 41 insertions, 0 deletions
diff --git a/Assets/Scripts/Boss1/Boss1MovementSCript.cs b/Assets/Scripts/Boss1/Boss1MovementSCript.cs
new file mode 100755
index 0000000..1a05521
--- /dev/null
+++ b/Assets/Scripts/Boss1/Boss1MovementSCript.cs
@@ -0,0 +1,41 @@
+using UnityEngine;
+using System.Collections;
+using System.Collections.Generic;
+
+public class Boss1MovementSCript : MonoBehaviour {
+
+ float counter;
+ float timer = 5f;
+ List<Vector3> positions;
+ int i = 2;
+ bool active;
+
+ void Start ()
+ {
+ positions = new List<Vector3> { new Vector3(120, 12), new Vector3(150, 12), new Vector3(135, 2.5f) };
+ }
+
+ void Update ()
+ {
+ if (active)
+ {
+ counter += Time.deltaTime;
+
+ if (counter >= timer)
+ {
+ counter = 0f;
+ gameObject.transform.position = positions[i];
+ i = ++i % 3;
+ }
+ }
+ }
+
+ public void EnableBoss1Movement()
+ {
+ active = true;
+ }
+ public void DisableBoss1Movement()
+ {
+ active = false;
+ }
+}