summaryrefslogtreecommitdiff
path: root/Assets/Scripts/Boss1
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
download01-master.tar.gz
01-master.zip
Initial commitHEADmaster
Diffstat (limited to 'Assets/Scripts/Boss1')
-rwxr-xr-xAssets/Scripts/Boss1/Boss1AttackScript.cs61
-rwxr-xr-xAssets/Scripts/Boss1/Boss1AttackScript.cs.meta12
-rwxr-xr-xAssets/Scripts/Boss1/Boss1BulletScript.cs15
-rwxr-xr-xAssets/Scripts/Boss1/Boss1BulletScript.cs.meta12
-rwxr-xr-xAssets/Scripts/Boss1/Boss1FireScript.cs89
-rwxr-xr-xAssets/Scripts/Boss1/Boss1FireScript.cs.meta12
-rwxr-xr-xAssets/Scripts/Boss1/Boss1HealthScript.cs30
-rwxr-xr-xAssets/Scripts/Boss1/Boss1HealthScript.cs.meta12
-rwxr-xr-xAssets/Scripts/Boss1/Boss1MovementSCript.cs41
-rwxr-xr-xAssets/Scripts/Boss1/Boss1MovementSCript.cs.meta12
10 files changed, 296 insertions, 0 deletions
diff --git a/Assets/Scripts/Boss1/Boss1AttackScript.cs b/Assets/Scripts/Boss1/Boss1AttackScript.cs
new file mode 100755
index 0000000..69d3de1
--- /dev/null
+++ b/Assets/Scripts/Boss1/Boss1AttackScript.cs
@@ -0,0 +1,61 @@
+using UnityEngine;
+using System.Collections;
+
+public class Boss1AttackScript : MonoBehaviour {
+
+ GameObject player;
+
+ public float Damage = 20;
+ float timer = .5f;
+ float counter;
+ bool playerInRange;
+ bool active;
+
+ void Start()
+ {
+ counter = 0;
+ player = GameObject.FindGameObjectWithTag("Player");
+ }
+
+ void Update()
+ {
+ if (active)
+ {
+ counter += Time.deltaTime;
+ if (counter >= timer && playerInRange)
+ {
+ counter = 0f;
+ player.GetComponent<PlayerHealthScript>().TakeDamage(Damage);
+ }
+ }
+ }
+
+ void OnTriggerEnter2D(Collider2D other)
+ {
+ var player = other.gameObject.GetComponentInParent<PlayerHealthScript>();
+ if (player != null)
+ {
+ playerInRange = true;
+ }
+ }
+
+ void OnTriggerExit2D(Collider2D other)
+ {
+ var player = other.gameObject.GetComponentInParent<PlayerHealthScript>();
+ if (player != null)
+ {
+ playerInRange = false;
+ }
+ }
+
+
+ public void EnableBoss1Attack()
+ {
+ active = true;
+ }
+ public void DisableBoss1Attack()
+ {
+ active = false;
+ }
+
+}
diff --git a/Assets/Scripts/Boss1/Boss1AttackScript.cs.meta b/Assets/Scripts/Boss1/Boss1AttackScript.cs.meta
new file mode 100755
index 0000000..36bab03
--- /dev/null
+++ b/Assets/Scripts/Boss1/Boss1AttackScript.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: fe6cb779e310100448a0ae4eb03cde38
+timeCreated: 1481800106
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Boss1/Boss1BulletScript.cs b/Assets/Scripts/Boss1/Boss1BulletScript.cs
new file mode 100755
index 0000000..c4b54b0
--- /dev/null
+++ b/Assets/Scripts/Boss1/Boss1BulletScript.cs
@@ -0,0 +1,15 @@
+using UnityEngine;
+using System.Collections;
+
+public class Boss1BulletScript : MonoBehaviour {
+
+ // Use this for initialization
+ void Start () {
+
+ }
+
+ // Update is called once per frame
+ void Update () {
+
+ }
+}
diff --git a/Assets/Scripts/Boss1/Boss1BulletScript.cs.meta b/Assets/Scripts/Boss1/Boss1BulletScript.cs.meta
new file mode 100755
index 0000000..4e5677b
--- /dev/null
+++ b/Assets/Scripts/Boss1/Boss1BulletScript.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: a0f3d8740407c8f4592cedba32c3a2be
+timeCreated: 1481799868
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Boss1/Boss1FireScript.cs b/Assets/Scripts/Boss1/Boss1FireScript.cs
new file mode 100755
index 0000000..35978b3
--- /dev/null
+++ b/Assets/Scripts/Boss1/Boss1FireScript.cs
@@ -0,0 +1,89 @@
+using UnityEngine;
+using System.Collections;
+
+public class Boss1FireScript : MonoBehaviour {
+ public float FireRate = 1.5f;
+ float fireCounter;
+ bool PlayerInRange = false;
+ public GameObject Bullet;
+ public float BulletSpeed = 20;
+ bool active;
+
+ AudioSource EnemyFireAudio;
+
+
+ void Start()
+ {
+ EnemyFireAudio = GameObject.FindGameObjectWithTag("EnemyFireAudio").GetComponent<AudioSource>();
+ }
+
+ void Update()
+ {
+ if (active)
+ {
+ fireCounter += Time.deltaTime;
+ if (fireCounter >= FireRate && PlayerInRange)
+ {
+ fireCounter = 0;
+ EnemyFireAudio.Play();
+ Fire();
+
+ }
+ }
+ }
+
+ void Fire()
+ {
+ //var Bullet1 = Instantiate(Bullet, gameObject.transform.position, Quaternion.identity) as GameObject;
+ //Bullet1.GetComponent<Rigidbody2D>().velocity = Vector2.up * BulletSpeed;
+ //var Bullet2 = Instantiate(Bullet, gameObject.transform.position, Quaternion.identity) as GameObject;
+ //Bullet2.GetComponent<Rigidbody2D>().velocity = Vector2.right * BulletSpeed;
+ //var Bullet3 = Instantiate(Bullet, gameObject.transform.position, Quaternion.identity) as GameObject;
+ //Bullet3.GetComponent<Rigidbody2D>().velocity = Vector2.down * BulletSpeed;
+ //var Bullet4 = Instantiate(Bullet, gameObject.transform.position, Quaternion.identity) as GameObject;
+ //Bullet4.GetComponent<Rigidbody2D>().velocity = Vector2.left * BulletSpeed;
+ //Destroy(Bullet1, 1.5f);
+ //Destroy(Bullet2, 1.5f);
+ //Destroy(Bullet3, 1.5f);
+ //Destroy(Bullet4, 1.5f);
+
+ for (int i = 0; i < 24; i++)
+ {
+ var b = Instantiate(Bullet, gameObject.transform.position, Quaternion.identity) as GameObject;
+ b.GetComponent<Rigidbody2D>().velocity = new Vector2(
+ (Mathf.Cos(i*Mathf.PI*.1f)) * 20,
+ (Mathf.Sin(i*Mathf.PI*.1f)) * 20
+ );
+ Destroy(b, 2.5f);
+ }
+ }
+
+
+ void OnTriggerEnter2D(Collider2D other)
+ {
+ var player = other.gameObject.GetComponentInParent<PlayerHealthScript>();
+ if (player != null)
+ {
+ PlayerInRange = true;
+ }
+ }
+
+ void OnTriggerExit2D(Collider2D other)
+ {
+ var player = other.gameObject.GetComponentInParent<PlayerHealthScript>();
+ if (player != null)
+ {
+ PlayerInRange = false;
+ }
+ }
+
+ public void EnableBoss1Fire()
+ {
+ active = true;
+ }
+ public void DisableBoss1Fire()
+ {
+ active = false;
+ }
+
+}
diff --git a/Assets/Scripts/Boss1/Boss1FireScript.cs.meta b/Assets/Scripts/Boss1/Boss1FireScript.cs.meta
new file mode 100755
index 0000000..0c57b34
--- /dev/null
+++ b/Assets/Scripts/Boss1/Boss1FireScript.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: e75643e835b63714295d51c7a609788e
+timeCreated: 1481799698
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Boss1/Boss1HealthScript.cs b/Assets/Scripts/Boss1/Boss1HealthScript.cs
new file mode 100755
index 0000000..541345d
--- /dev/null
+++ b/Assets/Scripts/Boss1/Boss1HealthScript.cs
@@ -0,0 +1,30 @@
+using UnityEngine;
+using System.Collections;
+
+public class Boss1HealthScript : MonoBehaviour {
+
+ public int Health = 1000;
+
+
+
+ void Start()
+ {
+
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+
+ public void TakeDamage(int damage)
+ {
+ Health -= damage;
+ if (Health <= 0)
+ {
+ GameObject.FindGameObjectWithTag("Boss1FightHandler").GetComponent<BossFighthandlerScript>().EndBossFight();
+ }
+
+ }
+}
diff --git a/Assets/Scripts/Boss1/Boss1HealthScript.cs.meta b/Assets/Scripts/Boss1/Boss1HealthScript.cs.meta
new file mode 100755
index 0000000..936a191
--- /dev/null
+++ b/Assets/Scripts/Boss1/Boss1HealthScript.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 05975c33f1eec4340b019dae3cfacf91
+timeCreated: 1481799311
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
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;
+ }
+}
diff --git a/Assets/Scripts/Boss1/Boss1MovementSCript.cs.meta b/Assets/Scripts/Boss1/Boss1MovementSCript.cs.meta
new file mode 100755
index 0000000..3deb6d9
--- /dev/null
+++ b/Assets/Scripts/Boss1/Boss1MovementSCript.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 6398d504f643ec84a838837089e09665
+timeCreated: 1491237861
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: