summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Boss1/Boss1MovementSCript.cs
diff options
context:
space:
mode:
authornirav <nirav@airmail.cc>2020-12-12 07:18:36 +0000
committernirav <nirav@airmail.cc>2020-12-12 07:18:36 +0000
commit115f77bda0246a00f6e17469685c67746bdbd29d (patch)
tree4bbea1e59109bb1d1fddc71736f89289bab03073 /Assets/Scripts/Boss1/Boss1MovementSCript.cs
download01-master.tar.gz
01-master.zip
Initial commitHEADmaster
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;
+ }
+}