summaryrefslogtreecommitdiff
path: root/Assets/Scripts
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
download01-master.tar.gz
01-master.zip
Initial commitHEADmaster
Diffstat (limited to 'Assets/Scripts')
-rwxr-xr-xAssets/Scripts/.vs/ProjectSettings.json3
-rwxr-xr-xAssets/Scripts/.vs/slnx.sqlitebin0 -> 94208 bytes
-rwxr-xr-xAssets/Scripts/BaseGroundScript.cs12
-rwxr-xr-xAssets/Scripts/BaseGroundScript.cs.meta12
-rwxr-xr-xAssets/Scripts/Boss1.meta9
-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
-rwxr-xr-xAssets/Scripts/BossCameraScript.cs31
-rwxr-xr-xAssets/Scripts/BossCameraScript.cs.meta12
-rwxr-xr-xAssets/Scripts/BossFighthandlerScript.cs75
-rwxr-xr-xAssets/Scripts/BossFighthandlerScript.cs.meta12
-rwxr-xr-xAssets/Scripts/CameraScript.cs32
-rwxr-xr-xAssets/Scripts/CameraScript.cs.meta12
-rwxr-xr-xAssets/Scripts/DialogueScript.cs100
-rwxr-xr-xAssets/Scripts/DialogueScript.cs.meta12
-rwxr-xr-xAssets/Scripts/Enemy.meta9
-rwxr-xr-xAssets/Scripts/Enemy/EnemyAttackScript.cs50
-rwxr-xr-xAssets/Scripts/Enemy/EnemyAttackScript.cs.meta13
-rwxr-xr-xAssets/Scripts/Enemy/EnemyBulletScript.cs32
-rwxr-xr-xAssets/Scripts/Enemy/EnemyBulletScript.cs.meta12
-rwxr-xr-xAssets/Scripts/Enemy/EnemyFireScript.cs90
-rwxr-xr-xAssets/Scripts/Enemy/EnemyFireScript.cs.meta13
-rwxr-xr-xAssets/Scripts/Enemy/EnemyHealthScript.cs31
-rwxr-xr-xAssets/Scripts/Enemy/EnemyHealthScript.cs.meta12
-rwxr-xr-xAssets/Scripts/Enemy/EnemyMovementScript.cs22
-rwxr-xr-xAssets/Scripts/Enemy/EnemyMovementScript.cs.meta12
-rwxr-xr-xAssets/Scripts/Enemy2.meta9
-rwxr-xr-xAssets/Scripts/Enemy2/NewEnemyAttack.cs49
-rwxr-xr-xAssets/Scripts/Enemy2/NewEnemyAttack.cs.meta12
-rwxr-xr-xAssets/Scripts/Enemy2/NewEnemyHealth.cs34
-rwxr-xr-xAssets/Scripts/Enemy2/NewEnemyHealth.cs.meta12
-rwxr-xr-xAssets/Scripts/Enemy2/NewEnemyTrigger.cs48
-rwxr-xr-xAssets/Scripts/Enemy2/NewEnemyTrigger.cs.meta12
-rwxr-xr-xAssets/Scripts/Enemy3.meta9
-rwxr-xr-xAssets/Scripts/Enemy3/Enemy3AttackScript.cs60
-rwxr-xr-xAssets/Scripts/Enemy3/Enemy3AttackScript.cs.meta12
-rwxr-xr-xAssets/Scripts/Enemy3/Enemy3BulletScript.cs32
-rwxr-xr-xAssets/Scripts/Enemy3/Enemy3BulletScript.cs.meta12
-rwxr-xr-xAssets/Scripts/Enemy3/Enemy3FireScript.cs43
-rwxr-xr-xAssets/Scripts/Enemy3/Enemy3FireScript.cs.meta12
-rwxr-xr-xAssets/Scripts/Enemy3/Enemy3HealthScript.cs34
-rwxr-xr-xAssets/Scripts/Enemy3/Enemy3HealthScript.cs.meta12
-rwxr-xr-xAssets/Scripts/Enemy3/Enemy3TriggerScript.cs35
-rwxr-xr-xAssets/Scripts/Enemy3/Enemy3TriggerScript.cs.meta12
-rwxr-xr-xAssets/Scripts/GunPickup.cs27
-rwxr-xr-xAssets/Scripts/GunPickup.cs.meta12
-rwxr-xr-xAssets/Scripts/LevelEnd.meta9
-rwxr-xr-xAssets/Scripts/LevelEnd/EndLevel.cs26
-rwxr-xr-xAssets/Scripts/LevelEnd/EndLevel.cs.meta12
-rwxr-xr-xAssets/Scripts/NPCScript.cs46
-rwxr-xr-xAssets/Scripts/NPCScript.cs.meta12
-rwxr-xr-xAssets/Scripts/PauseMenu.cs69
-rwxr-xr-xAssets/Scripts/PauseMenu.cs.meta12
-rwxr-xr-xAssets/Scripts/Player.meta9
-rwxr-xr-xAssets/Scripts/Player/Bullet.cs54
-rwxr-xr-xAssets/Scripts/Player/Bullet.cs.meta14
-rwxr-xr-xAssets/Scripts/Player/GroundCheckScript.cs25
-rwxr-xr-xAssets/Scripts/Player/GroundCheckScript.cs.meta12
-rwxr-xr-xAssets/Scripts/Player/PlayerHealthScript.cs66
-rwxr-xr-xAssets/Scripts/Player/PlayerHealthScript.cs.meta12
-rwxr-xr-xAssets/Scripts/Player/PlayerMovementScript.cs120
-rwxr-xr-xAssets/Scripts/Player/PlayerMovementScript.cs.meta12
-rwxr-xr-xAssets/Scripts/Player/PlayerShootingScript.cs33
-rwxr-xr-xAssets/Scripts/Player/PlayerShootingScript.cs.meta13
72 files changed, 1958 insertions, 0 deletions
diff --git a/Assets/Scripts/.vs/ProjectSettings.json b/Assets/Scripts/.vs/ProjectSettings.json
new file mode 100755
index 0000000..f8b4888
--- /dev/null
+++ b/Assets/Scripts/.vs/ProjectSettings.json
@@ -0,0 +1,3 @@
+{
+ "CurrentProjectSetting": null
+} \ No newline at end of file
diff --git a/Assets/Scripts/.vs/slnx.sqlite b/Assets/Scripts/.vs/slnx.sqlite
new file mode 100755
index 0000000..0853ae5
--- /dev/null
+++ b/Assets/Scripts/.vs/slnx.sqlite
Binary files differ
diff --git a/Assets/Scripts/BaseGroundScript.cs b/Assets/Scripts/BaseGroundScript.cs
new file mode 100755
index 0000000..f0ccd2b
--- /dev/null
+++ b/Assets/Scripts/BaseGroundScript.cs
@@ -0,0 +1,12 @@
+using UnityEngine;
+using System.Collections;
+
+public class BaseGroundScript : MonoBehaviour {
+
+ void OnTriggerEnter2D(Collider2D other)
+ {
+ var player = other.gameObject.GetComponentInParent<PlayerHealthScript>();
+ if(player!= null)
+ player.TakeDamage(100f);
+ }
+} \ No newline at end of file
diff --git a/Assets/Scripts/BaseGroundScript.cs.meta b/Assets/Scripts/BaseGroundScript.cs.meta
new file mode 100755
index 0000000..9fdd876
--- /dev/null
+++ b/Assets/Scripts/BaseGroundScript.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: bb77aa8a7f7ad2f4fb1560292c302177
+timeCreated: 1467954303
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Boss1.meta b/Assets/Scripts/Boss1.meta
new file mode 100755
index 0000000..3cb092d
--- /dev/null
+++ b/Assets/Scripts/Boss1.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 3d9173cc6ccd6cf488881d6f20cdba58
+folderAsset: yes
+timeCreated: 1481799276
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
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:
diff --git a/Assets/Scripts/BossCameraScript.cs b/Assets/Scripts/BossCameraScript.cs
new file mode 100755
index 0000000..c257982
--- /dev/null
+++ b/Assets/Scripts/BossCameraScript.cs
@@ -0,0 +1,31 @@
+using UnityEngine;
+using System.Collections;
+
+public class BossCameraScript : MonoBehaviour {
+
+ public GameObject Camera;
+ bool BossCamEnabled;
+
+ // Use this for initialization
+ void Start () {
+
+ }
+
+ // Update is called once per frame
+ void FixedUpdate () {
+ if (BossCamEnabled)
+ Camera.transform.position = new Vector3(Mathf.Lerp(Camera.transform.position.x,135.5f,.2f), 10.8f,-10);
+ }
+
+ public void EnableBossCamera()
+ {
+ Camera.GetComponent<CameraScript>().enabled = false;
+ BossCamEnabled = true;
+ }
+
+ public void DisableBossCamera()
+ {
+ BossCamEnabled = false;
+ Camera.GetComponent<CameraScript>().enabled = true;
+ }
+}
diff --git a/Assets/Scripts/BossCameraScript.cs.meta b/Assets/Scripts/BossCameraScript.cs.meta
new file mode 100755
index 0000000..15ae4de
--- /dev/null
+++ b/Assets/Scripts/BossCameraScript.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 7fd6d497c99fe5141adc2dd2fc014df2
+timeCreated: 1491240300
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/BossFighthandlerScript.cs b/Assets/Scripts/BossFighthandlerScript.cs
new file mode 100755
index 0000000..b95095b
--- /dev/null
+++ b/Assets/Scripts/BossFighthandlerScript.cs
@@ -0,0 +1,75 @@
+using UnityEngine;
+using System.Collections;
+
+public class BossFighthandlerScript : MonoBehaviour {
+
+ public GameObject Boundry;
+ public GameObject Boss1;
+ public BossCameraScript BossCamera;
+ DialogueScript dialogueScript;
+ public GameObject DestroyAnimation;
+
+ // only trigger for once
+ bool triggered;
+
+ // Use this for initialization
+ void Start ()
+ {
+ dialogueScript = GameObject.FindGameObjectWithTag("DialogueSystem").GetComponent<DialogueScript>();
+ }
+
+ // Update is called once per frame
+ void Update ()
+ {
+
+ }
+
+ private void OnTriggerEnter2D(Collider2D collision)
+ {
+ if (collision.tag == "PlayerCollider" && !triggered)
+ {
+ triggered = true;
+ StartCoroutine(start());
+ }
+ }
+
+ IEnumerator start()
+ {
+ Boundry.gameObject.SetActive(true);
+ BossCamera.EnableBossCamera();
+ yield return new WaitForSeconds(2);
+ Boss1.SetActive(true);
+ yield return new WaitForSeconds(.5f);
+ dialogueScript.ShowDialogue("You'll have to kill me to go beyond this point");
+ dialogueScript.FromBoss1 = true;
+ }
+
+
+ // Wait for Dialogue Panel to be dismissed
+ public void StartBossFight()
+ {
+ Boss1.GetComponent<Boss1MovementSCript>().EnableBoss1Movement();
+ Boss1.GetComponentInChildren<Boss1FireScript>().EnableBoss1Fire();
+ }
+
+
+ // Called by Boss1HealthScript
+ public void EndBossFight()
+ {
+ var animation = Instantiate(DestroyAnimation, Boss1.transform.position, Quaternion.identity);
+ Boss1.GetComponent<Boss1MovementSCript>().DisableBoss1Movement();
+ Boss1.GetComponentInChildren<Boss1FireScript>().DisableBoss1Fire();
+ Boss1.GetComponentInChildren<Boss1AttackScript>().DisableBoss1Attack();
+ Destroy(animation, 4f);
+ Destroy(Boss1, 4f);
+ StartCoroutine(end());
+ }
+ IEnumerator end()
+ {
+ yield return new WaitForSeconds(3);
+ BossCamera.DisableBossCamera();
+ Boundry.gameObject.SetActive(false);
+ }
+
+
+}
diff --git a/Assets/Scripts/BossFighthandlerScript.cs.meta b/Assets/Scripts/BossFighthandlerScript.cs.meta
new file mode 100755
index 0000000..2dc03c0
--- /dev/null
+++ b/Assets/Scripts/BossFighthandlerScript.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 7b7b77c83a498b8449f3da5747d01d50
+timeCreated: 1491240649
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/CameraScript.cs b/Assets/Scripts/CameraScript.cs
new file mode 100755
index 0000000..93bc548
--- /dev/null
+++ b/Assets/Scripts/CameraScript.cs
@@ -0,0 +1,32 @@
+using UnityEngine;
+using System.Collections;
+
+public class CameraScript : MonoBehaviour {
+
+ GameObject Player;
+ Vector3 newPosition;
+ public float MinYOffset = 10.8f;
+
+ void Start ()
+ {
+ newPosition = new Vector3();
+ Player = GameObject.FindGameObjectWithTag("Player");
+ }
+
+
+ void FixedUpdate ()
+ {
+ newPosition.x = Mathf.Lerp(gameObject.transform.position.x, Player.transform.position.x, .2f);
+
+ var y = ((int)(Player.transform.position.y / 15) * 15) + MinYOffset;
+ if (y < MinYOffset) { y = MinYOffset; }
+ newPosition.y = Mathf.Lerp(gameObject.transform.position.y, (float)y, .05f);
+
+ newPosition.z = gameObject.transform.position.z;
+
+ gameObject.transform.position = newPosition;
+
+ //gameObject.transform.position = new Vector3(Player.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z);
+
+ }
+}
diff --git a/Assets/Scripts/CameraScript.cs.meta b/Assets/Scripts/CameraScript.cs.meta
new file mode 100755
index 0000000..44cbc18
--- /dev/null
+++ b/Assets/Scripts/CameraScript.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 33ed8db12bebd574ab871e8b52ce253a
+timeCreated: 1466911000
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/DialogueScript.cs b/Assets/Scripts/DialogueScript.cs
new file mode 100755
index 0000000..b6fc42c
--- /dev/null
+++ b/Assets/Scripts/DialogueScript.cs
@@ -0,0 +1,100 @@
+using UnityEngine;
+using System.Collections;
+using UnityEngine.UI;
+
+public class DialogueScript : MonoBehaviour
+{
+ //Player reference
+ GameObject player;
+ PlayerMovementScript playerMovementScript;
+ PlayerShootingScript playerShootingScript;
+
+ //Single dialogue
+ GameObject dialoguePanle;
+ Text dialogueText;
+ bool isDialogueActive;
+
+ //Multi Dialogue
+ bool isMultiDialogueActive;
+ string[] multiDialogueText;
+ int multiDialogueLength;
+ int multiDialogueCounter;
+
+ //Animator for DialoguePanel
+ Animator anim;
+
+ // for Boss1
+ public bool FromBoss1;
+
+ void Awake()
+ {
+ dialoguePanle = GameObject.FindGameObjectWithTag("HUD").transform.Find("DialoguePanel").gameObject;
+ anim = dialoguePanle.GetComponent<Animator>();
+ player = GameObject.FindGameObjectWithTag("Player");
+ playerMovementScript = player.GetComponent<PlayerMovementScript>();
+ playerShootingScript = player.GetComponentInChildren<PlayerShootingScript>();
+ dialogueText = dialoguePanle.GetComponentInChildren<Text>();
+ dialogueText.text = "";
+ }
+
+ void Start ()
+ {
+
+ }
+
+ void Update ()
+ {
+ if (isDialogueActive && Input.GetButtonDown("Jump"))
+ {
+ anim.SetBool("isActive", false);
+ //dialoguePanle.GetComponent<RectTransform>().localScale = new Vector3(0, 0, 0);
+ playerMovementScript.enabled = true;
+ playerShootingScript.enabled = true;
+ isDialogueActive = false;
+
+ if (FromBoss1)
+ {
+ GameObject.FindGameObjectWithTag("Boss1FightHandler").GetComponent<BossFighthandlerScript>().StartBossFight();
+ }
+ }
+
+ if (isMultiDialogueActive && Input.GetButtonDown("Jump") && multiDialogueCounter <= multiDialogueLength)
+ {
+ if (multiDialogueCounter < multiDialogueLength)
+ {
+ dialogueText.text = multiDialogueText[multiDialogueCounter];
+ multiDialogueCounter++;
+ }
+ else if (multiDialogueCounter == multiDialogueLength)
+ {
+ anim.SetBool("isActive", false);
+ playerMovementScript.enabled = true;
+ playerShootingScript.enabled = true;
+ isMultiDialogueActive = false;
+ }
+ }
+ }
+
+ public void ShowDialogue(string message)
+ {
+ isDialogueActive = true;
+ playerMovementScript.StopPlayer();
+ playerMovementScript.enabled = false;
+ playerShootingScript.enabled = false;
+ dialogueText.text = message;
+ anim.SetBool("isActive", true);
+ }
+
+ public void ShowMultiDialogue(string message)
+ {
+ isMultiDialogueActive = true;
+ playerMovementScript.StopPlayer();
+ playerMovementScript.enabled = false;
+ playerShootingScript.enabled = false;
+ multiDialogueText = message.Split(new string[] {"\\n"},System.StringSplitOptions.None);
+ multiDialogueLength = multiDialogueText.Length;
+ multiDialogueCounter = 1;
+ dialogueText.text = multiDialogueText[0];
+ anim.SetBool("isActive", true);
+ }
+}
diff --git a/Assets/Scripts/DialogueScript.cs.meta b/Assets/Scripts/DialogueScript.cs.meta
new file mode 100755
index 0000000..237377a
--- /dev/null
+++ b/Assets/Scripts/DialogueScript.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 9adedd3dd9f4d7e428f91c10700d45d1
+timeCreated: 1473487230
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Enemy.meta b/Assets/Scripts/Enemy.meta
new file mode 100755
index 0000000..00da0a6
--- /dev/null
+++ b/Assets/Scripts/Enemy.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: f9e138fbf8edebd4493e8c73086c69d4
+folderAsset: yes
+timeCreated: 1468166685
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Enemy/EnemyAttackScript.cs b/Assets/Scripts/Enemy/EnemyAttackScript.cs
new file mode 100755
index 0000000..80fa46f
--- /dev/null
+++ b/Assets/Scripts/Enemy/EnemyAttackScript.cs
@@ -0,0 +1,50 @@
+using UnityEngine;
+using System.Collections;
+
+
+/// <summary>
+/// Includes both collision attack and bullet firing
+/// </summary>
+public class EnemyAttackScript : MonoBehaviour {
+
+ GameObject player;
+
+ public float Damage = 20;
+ float timer = .5f;
+ float counter;
+ bool playerInRange;
+
+ void Start()
+ {
+ counter = 0;
+ player = GameObject.FindGameObjectWithTag("Player");
+ }
+
+ void Update()
+ {
+ 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;
+ }
+ }
+} \ No newline at end of file
diff --git a/Assets/Scripts/Enemy/EnemyAttackScript.cs.meta b/Assets/Scripts/Enemy/EnemyAttackScript.cs.meta
new file mode 100755
index 0000000..fd13dd1
--- /dev/null
+++ b/Assets/Scripts/Enemy/EnemyAttackScript.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: a04479de3d839c14f954adcabdfb1263
+timeCreated: 1468151999
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences:
+ - Bullet: {fileID: 187558, guid: fb9814a46f3507c4e9b08a5fc84f727f, type: 2}
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Enemy/EnemyBulletScript.cs b/Assets/Scripts/Enemy/EnemyBulletScript.cs
new file mode 100755
index 0000000..c36461a
--- /dev/null
+++ b/Assets/Scripts/Enemy/EnemyBulletScript.cs
@@ -0,0 +1,32 @@
+using UnityEngine;
+using System.Collections;
+
+public class EnemyBulletScript : MonoBehaviour {
+
+ bool fired;
+
+ void Start ()
+ {
+ fired = false;
+ }
+
+
+ void Update ()
+ {
+
+ }
+
+ void OnTriggerEnter2D(Collider2D col)
+ {
+ if (!fired)
+ {
+ var player = col.gameObject.GetComponentInParent<PlayerHealthScript>();
+ if (player != null)
+ {
+ fired = true;
+ player.TakeDamage(20f);
+ Destroy(gameObject);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/Assets/Scripts/Enemy/EnemyBulletScript.cs.meta b/Assets/Scripts/Enemy/EnemyBulletScript.cs.meta
new file mode 100755
index 0000000..5aa7f90
--- /dev/null
+++ b/Assets/Scripts/Enemy/EnemyBulletScript.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: a6d565ef1445c7841bc7a12b9c23c7c6
+timeCreated: 1468153435
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Enemy/EnemyFireScript.cs b/Assets/Scripts/Enemy/EnemyFireScript.cs
new file mode 100755
index 0000000..b267871
--- /dev/null
+++ b/Assets/Scripts/Enemy/EnemyFireScript.cs
@@ -0,0 +1,90 @@
+using UnityEngine;
+using System.Collections;
+
+public class EnemyFireScript : MonoBehaviour {
+
+ public float FireRate = 1f;
+ float fireCounter;
+ bool PlayerInRange = false;
+ bool IsBulletTopDown = true;
+ public GameObject Bullet;
+ public float BulletSpeed ;
+
+
+ AudioSource EnemyFireAudio;
+ void Start ()
+ {
+ EnemyFireAudio = GameObject.FindGameObjectWithTag("EnemyFireAudio").GetComponent<AudioSource>();
+ }
+
+ void Update ()
+ {
+ fireCounter += Time.deltaTime;
+
+ if (fireCounter >= FireRate && PlayerInRange)
+ {
+ fireCounter = 0;
+ EnemyFireAudio.Play();
+ if (IsBulletTopDown)
+ {
+ Fire1();
+ }
+ else
+ {
+ Fire2();
+ }
+ IsBulletTopDown = !IsBulletTopDown;
+ }
+ }
+
+ void Fire1()
+ {
+ 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);
+ }
+
+ void Fire2()
+ {
+ var Bullet1 = Instantiate(Bullet, gameObject.transform.position, Quaternion.identity) as GameObject;
+ Bullet1.GetComponent<Rigidbody2D>().velocity = new Vector2(1,1) * BulletSpeed;
+ var Bullet2 = Instantiate(Bullet, gameObject.transform.position, Quaternion.identity) as GameObject;
+ Bullet2.GetComponent<Rigidbody2D>().velocity = new Vector2(-1, 1) * BulletSpeed;
+ var Bullet3 = Instantiate(Bullet, gameObject.transform.position, Quaternion.identity) as GameObject;
+ Bullet3.GetComponent<Rigidbody2D>().velocity = new Vector2(-1, -1) * BulletSpeed;
+ var Bullet4 = Instantiate(Bullet, gameObject.transform.position, Quaternion.identity) as GameObject;
+ Bullet4.GetComponent<Rigidbody2D>().velocity = new Vector2(1, -1) * BulletSpeed;
+ Destroy(Bullet1, 1.5f);
+ Destroy(Bullet2, 1.5f);
+ Destroy(Bullet3, 1.5f);
+ Destroy(Bullet4, 1.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;
+ }
+ }
+
+}
diff --git a/Assets/Scripts/Enemy/EnemyFireScript.cs.meta b/Assets/Scripts/Enemy/EnemyFireScript.cs.meta
new file mode 100755
index 0000000..c27efe4
--- /dev/null
+++ b/Assets/Scripts/Enemy/EnemyFireScript.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: ecf7680c5140a4448bedd6708868b15f
+timeCreated: 1468157244
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences:
+ - Bullet: {fileID: 128812, guid: ce5b25a0293ea634f899a29581bd8312, type: 2}
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Enemy/EnemyHealthScript.cs b/Assets/Scripts/Enemy/EnemyHealthScript.cs
new file mode 100755
index 0000000..c9d93be
--- /dev/null
+++ b/Assets/Scripts/Enemy/EnemyHealthScript.cs
@@ -0,0 +1,31 @@
+using UnityEngine;
+using System.Collections;
+
+public class EnemyHealthScript : MonoBehaviour {
+
+ public int Health = 100;
+
+ public GameObject DestroyAnimation;
+ GameObject DestroyAudio;
+
+ void Start () {
+ DestroyAudio = GameObject.FindGameObjectWithTag("EnemyDestroyAudio");
+ }
+
+ // Update is called once per frame
+ void Update () {
+
+ }
+
+ public void TakeDamage(int damage)
+ {
+ Health -= damage;
+ if (Health <= 0)
+ {
+ var animation = Instantiate(DestroyAnimation, transform.position, Quaternion.identity);
+ DestroyAudio.GetComponent<AudioSource>().Play();
+ Destroy(gameObject);
+ Destroy(animation, 1f);
+ }
+ }
+}
diff --git a/Assets/Scripts/Enemy/EnemyHealthScript.cs.meta b/Assets/Scripts/Enemy/EnemyHealthScript.cs.meta
new file mode 100755
index 0000000..fb2faf4
--- /dev/null
+++ b/Assets/Scripts/Enemy/EnemyHealthScript.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 8b5f0115d52bc064188b95026954340e
+timeCreated: 1468166845
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Enemy/EnemyMovementScript.cs b/Assets/Scripts/Enemy/EnemyMovementScript.cs
new file mode 100755
index 0000000..0e0cb81
--- /dev/null
+++ b/Assets/Scripts/Enemy/EnemyMovementScript.cs
@@ -0,0 +1,22 @@
+using UnityEngine;
+using System.Collections;
+
+public class EnemyMovementScript : MonoBehaviour {
+
+ public float radius = 10f;
+ public float speed = 1f;
+ Vector3 offset;
+
+ void Start ()
+ {
+ offset = transform.position;
+ }
+
+ void Update ()
+ {
+ transform.position = new Vector3(
+ (radius * Mathf.Cos(Time.time * speed)) + offset.x,
+ (radius * Mathf.Sin(Time.time * speed)) + offset.y,
+ offset.z);
+ }
+}
diff --git a/Assets/Scripts/Enemy/EnemyMovementScript.cs.meta b/Assets/Scripts/Enemy/EnemyMovementScript.cs.meta
new file mode 100755
index 0000000..ec3f6d8
--- /dev/null
+++ b/Assets/Scripts/Enemy/EnemyMovementScript.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 30081c15a054c094985700e86cd92a2d
+timeCreated: 1468166780
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Enemy2.meta b/Assets/Scripts/Enemy2.meta
new file mode 100755
index 0000000..b9d6442
--- /dev/null
+++ b/Assets/Scripts/Enemy2.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: b9f47d90ca8d2f3489db1cdf9f5d8773
+folderAsset: yes
+timeCreated: 1469160732
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Enemy2/NewEnemyAttack.cs b/Assets/Scripts/Enemy2/NewEnemyAttack.cs
new file mode 100755
index 0000000..d4db669
--- /dev/null
+++ b/Assets/Scripts/Enemy2/NewEnemyAttack.cs
@@ -0,0 +1,49 @@
+using UnityEngine;
+using System.Collections;
+
+public class NewEnemyAttack : MonoBehaviour {
+
+ public bool PlayerInRange;
+ Rigidbody2D rb2d;
+ GameObject Player;
+ public Vector2 Origin;
+ NewEnemyTrigger trigger;
+
+ void Awake()
+ {
+ Player = GameObject.FindGameObjectWithTag("Player");
+ rb2d = GetComponent<Rigidbody2D>();
+ Origin = transform.position;
+ trigger = GetComponentInParent<NewEnemyTrigger>();
+ }
+
+ void Start ()
+ {
+
+ }
+
+ void Update ()
+ {
+ if (PlayerInRange)
+ {
+ rb2d.position = Vector2.MoveTowards(rb2d.position, Player.transform.position,0.1f);
+ }
+ else if(!PlayerInRange)
+ {
+ rb2d.position = Vector2.MoveTowards(rb2d.position, Origin, 0.1f);
+ }
+ }
+
+ void OnCollisionEnter2D(Collision2D col)
+ {
+ if (col.gameObject.GetComponentInParent<PlayerHealthScript>())
+ {
+ col.gameObject.GetComponentInParent<PlayerHealthScript>().TakeDamage(10);
+ PlayerInRange = false;
+ trigger.counter = 0;
+ }
+ }
+
+
+
+}
diff --git a/Assets/Scripts/Enemy2/NewEnemyAttack.cs.meta b/Assets/Scripts/Enemy2/NewEnemyAttack.cs.meta
new file mode 100755
index 0000000..0ea6543
--- /dev/null
+++ b/Assets/Scripts/Enemy2/NewEnemyAttack.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 9cf821c73c7db734ba0edc06d66be8f2
+timeCreated: 1469082882
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Enemy2/NewEnemyHealth.cs b/Assets/Scripts/Enemy2/NewEnemyHealth.cs
new file mode 100755
index 0000000..4420252
--- /dev/null
+++ b/Assets/Scripts/Enemy2/NewEnemyHealth.cs
@@ -0,0 +1,34 @@
+using UnityEngine;
+using System.Collections;
+
+public class NewEnemyHealth : MonoBehaviour {
+
+ public int Health = 100;
+
+ public GameObject DestroyAnimation;
+ GameObject DestroyAudio;
+
+ void Start()
+ {
+ DestroyAudio = GameObject.FindGameObjectWithTag("EnemyDestroyAudio");
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+
+ public void TakeDamage(int damage)
+ {
+ Health -= damage;
+ if (Health <= 0)
+ {
+ var animation = Instantiate(DestroyAnimation, transform.position, Quaternion.identity);
+ DestroyAudio.GetComponent<AudioSource>().Play();
+ Destroy(animation, 1f);
+ Destroy(transform.parent.gameObject);
+ }
+
+ }
+}
diff --git a/Assets/Scripts/Enemy2/NewEnemyHealth.cs.meta b/Assets/Scripts/Enemy2/NewEnemyHealth.cs.meta
new file mode 100755
index 0000000..3e6f6d7
--- /dev/null
+++ b/Assets/Scripts/Enemy2/NewEnemyHealth.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: c780c97eeb936894faf63455af12c9fd
+timeCreated: 1469160284
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Enemy2/NewEnemyTrigger.cs b/Assets/Scripts/Enemy2/NewEnemyTrigger.cs
new file mode 100755
index 0000000..2102049
--- /dev/null
+++ b/Assets/Scripts/Enemy2/NewEnemyTrigger.cs
@@ -0,0 +1,48 @@
+using UnityEngine;
+using System.Collections;
+
+public class NewEnemyTrigger : MonoBehaviour {
+
+ NewEnemyAttack enemy;
+ public float counter;
+ float rate = 5f;
+
+ void Start () {
+ enemy = GetComponentInChildren<NewEnemyAttack>();
+ }
+
+
+ void Update () {
+
+ }
+
+ void OnTriggerStay2D(Collider2D col)
+ {
+ if (col.GetComponentInParent<PlayerHealthScript>())
+ {
+ counter += Time.deltaTime;
+ if (counter > rate)
+ {
+ counter = 0;
+ enemy.PlayerInRange = true;
+ }
+
+ }
+ }
+
+ void OnTriggerEnter2D(Collider2D col)
+ {
+ if (col.GetComponentInParent<PlayerHealthScript>())
+ {
+ enemy.PlayerInRange = true;
+ }
+ }
+
+ void OnTriggerExit2D(Collider2D col)
+ {
+ if (col.GetComponentInParent<PlayerHealthScript>())
+ {
+ enemy.PlayerInRange = false;
+ }
+ }
+}
diff --git a/Assets/Scripts/Enemy2/NewEnemyTrigger.cs.meta b/Assets/Scripts/Enemy2/NewEnemyTrigger.cs.meta
new file mode 100755
index 0000000..8f0d19a
--- /dev/null
+++ b/Assets/Scripts/Enemy2/NewEnemyTrigger.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 7b60d6a49475ddc46a967f9f2f5f8921
+timeCreated: 1469084262
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Enemy3.meta b/Assets/Scripts/Enemy3.meta
new file mode 100755
index 0000000..5cc1041
--- /dev/null
+++ b/Assets/Scripts/Enemy3.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 55f06959cf6a827429912a19d6990685
+folderAsset: yes
+timeCreated: 1491392539
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Enemy3/Enemy3AttackScript.cs b/Assets/Scripts/Enemy3/Enemy3AttackScript.cs
new file mode 100755
index 0000000..bd6048c
--- /dev/null
+++ b/Assets/Scripts/Enemy3/Enemy3AttackScript.cs
@@ -0,0 +1,60 @@
+using UnityEngine;
+using System.Collections;
+
+public class Enemy3AttackScript : MonoBehaviour {
+
+ public bool PlayerInRange;
+ Rigidbody2D rb2d;
+ GameObject Player;
+ public Vector2 Origin;
+ Enemy3TriggerScript trigger;
+
+ //Movement
+ public float counter;
+ public float rate;
+ public bool isRight;
+
+ void Awake()
+ {
+ Player = GameObject.FindGameObjectWithTag("Player");
+ rb2d = GetComponent<Rigidbody2D>();
+ Origin = transform.position;
+ trigger = GetComponentInParent<Enemy3TriggerScript>();
+ }
+
+ void Start()
+ {
+ counter = 0;
+ rate = 100;
+ }
+
+ void Update()
+ {
+ if (PlayerInRange)
+ {
+ counter = counter + .5f;
+ if (counter >= rate)
+ {
+ counter = 0;
+ isRight = !isRight;
+ }
+ if(isRight)
+ transform.position = new Vector3(transform.position.x + .1f, transform.position.y, transform.position.z);
+ else
+ transform.position = new Vector3(transform.position.x - .1f, transform.position.y, transform.position.z);
+ //rb2d.position = Vector2.MoveTowards(rb2d.position, Player.transform.position, 0.1f);
+ }
+ else if (!PlayerInRange)
+ {
+ rb2d.position = Origin;
+ }
+ }
+
+ void OnCollisionEnter2D(Collision2D col)
+ {
+ if (col.gameObject.GetComponentInParent<PlayerHealthScript>())
+ {
+ col.gameObject.GetComponentInParent<PlayerHealthScript>().TakeDamage(10);
+ }
+ }
+}
diff --git a/Assets/Scripts/Enemy3/Enemy3AttackScript.cs.meta b/Assets/Scripts/Enemy3/Enemy3AttackScript.cs.meta
new file mode 100755
index 0000000..f22ff0c
--- /dev/null
+++ b/Assets/Scripts/Enemy3/Enemy3AttackScript.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 6745149733c47a9418d917f47105f65a
+timeCreated: 1491392656
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Enemy3/Enemy3BulletScript.cs b/Assets/Scripts/Enemy3/Enemy3BulletScript.cs
new file mode 100755
index 0000000..49ede52
--- /dev/null
+++ b/Assets/Scripts/Enemy3/Enemy3BulletScript.cs
@@ -0,0 +1,32 @@
+using UnityEngine;
+using System.Collections;
+
+public class Enemy3BulletScript : MonoBehaviour {
+
+ bool fired;
+
+ void Start()
+ {
+ fired = false;
+ }
+
+
+ void Update()
+ {
+
+ }
+
+ void OnTriggerEnter2D(Collider2D col)
+ {
+ if (!fired)
+ {
+ var player = col.gameObject.GetComponentInParent<PlayerHealthScript>();
+ if (player != null)
+ {
+ fired = true;
+ player.TakeDamage(20f);
+ Destroy(gameObject);
+ }
+ }
+ }
+}
diff --git a/Assets/Scripts/Enemy3/Enemy3BulletScript.cs.meta b/Assets/Scripts/Enemy3/Enemy3BulletScript.cs.meta
new file mode 100755
index 0000000..d87cca5
--- /dev/null
+++ b/Assets/Scripts/Enemy3/Enemy3BulletScript.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 22cd3659d5f20084e8df95da380b2591
+timeCreated: 1491401851
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Enemy3/Enemy3FireScript.cs b/Assets/Scripts/Enemy3/Enemy3FireScript.cs
new file mode 100755
index 0000000..697cbdc
--- /dev/null
+++ b/Assets/Scripts/Enemy3/Enemy3FireScript.cs
@@ -0,0 +1,43 @@
+using UnityEngine;
+using System.Collections;
+
+public class Enemy3FireScript : MonoBehaviour {
+
+ float FireRate = 1f;
+ float fireCounter;
+ public bool PlayerInRange;
+ public GameObject Bullet;
+ public float BulletSpeed = 20;
+
+
+ Enemy3AttackScript enemy3AttackScript;
+ AudioSource EnemyFireAudio;
+
+ void Start()
+ {
+ enemy3AttackScript = GetComponent<Enemy3AttackScript>();
+ EnemyFireAudio = GameObject.FindGameObjectWithTag("EnemyFireAudio").GetComponent<AudioSource>();
+ }
+
+ void Update()
+ {
+ fireCounter += Time.deltaTime;
+
+ if (fireCounter >= FireRate && PlayerInRange)
+ {
+ fireCounter = 0;
+ EnemyFireAudio.Play();
+ if (enemy3AttackScript.isRight)
+ Fire(1);
+ else
+ Fire(-1);
+ }
+ }
+
+ void Fire(float x)
+ {
+ var Bullet1 = Instantiate(Bullet, gameObject.transform.position, Quaternion.identity) as GameObject;
+ Bullet1.GetComponent<Rigidbody2D>().velocity = Vector2.right * BulletSpeed * x;
+ Destroy(Bullet1, 2f);
+ }
+}
diff --git a/Assets/Scripts/Enemy3/Enemy3FireScript.cs.meta b/Assets/Scripts/Enemy3/Enemy3FireScript.cs.meta
new file mode 100755
index 0000000..7d369de
--- /dev/null
+++ b/Assets/Scripts/Enemy3/Enemy3FireScript.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 9bfe8475ce00b474f8103e449fd649e9
+timeCreated: 1491401900
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Enemy3/Enemy3HealthScript.cs b/Assets/Scripts/Enemy3/Enemy3HealthScript.cs
new file mode 100755
index 0000000..b2d8308
--- /dev/null
+++ b/Assets/Scripts/Enemy3/Enemy3HealthScript.cs
@@ -0,0 +1,34 @@
+using UnityEngine;
+using System.Collections;
+
+public class Enemy3HealthScript : MonoBehaviour {
+
+ public int Health = 100;
+
+ public GameObject DestroyAnimation;
+ GameObject DestroyAudio;
+
+ void Start()
+ {
+ DestroyAudio = GameObject.FindGameObjectWithTag("EnemyDestroyAudio");
+ }
+
+
+ void Update()
+ {
+
+ }
+
+ public void TakeDamage(int damage)
+ {
+ Health -= damage;
+ if (Health <= 0)
+ {
+ var animation = Instantiate(DestroyAnimation, transform.position, Quaternion.identity);
+ DestroyAudio.GetComponent<AudioSource>().Play();
+ Destroy(animation, 1f);
+ Destroy(transform.parent.gameObject);
+ }
+
+ }
+}
diff --git a/Assets/Scripts/Enemy3/Enemy3HealthScript.cs.meta b/Assets/Scripts/Enemy3/Enemy3HealthScript.cs.meta
new file mode 100755
index 0000000..5e52a96
--- /dev/null
+++ b/Assets/Scripts/Enemy3/Enemy3HealthScript.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 35dbfbf84998db94e984290eb1c09e70
+timeCreated: 1491392581
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Enemy3/Enemy3TriggerScript.cs b/Assets/Scripts/Enemy3/Enemy3TriggerScript.cs
new file mode 100755
index 0000000..944dc62
--- /dev/null
+++ b/Assets/Scripts/Enemy3/Enemy3TriggerScript.cs
@@ -0,0 +1,35 @@
+using UnityEngine;
+using System.Collections;
+
+public class Enemy3TriggerScript : MonoBehaviour {
+
+ Enemy3AttackScript attack;
+ Enemy3FireScript fire;
+
+ void Start()
+ {
+ attack = GetComponentInChildren<Enemy3AttackScript>();
+ fire = GetComponentInChildren<Enemy3FireScript>();
+ }
+
+
+ void Update()
+ {
+ }
+
+ void OnTriggerStay2D(Collider2D col)
+ {
+ if (col.tag == "PlayerCollider")
+ {
+ fire.PlayerInRange = attack.PlayerInRange = true;
+ }
+ }
+
+ void OnTriggerExit2D(Collider2D col)
+ {
+ if (col.tag == "PlayerCollider")
+ {
+ fire.PlayerInRange = attack.PlayerInRange = false;
+ }
+ }
+}
diff --git a/Assets/Scripts/Enemy3/Enemy3TriggerScript.cs.meta b/Assets/Scripts/Enemy3/Enemy3TriggerScript.cs.meta
new file mode 100755
index 0000000..68f2b1a
--- /dev/null
+++ b/Assets/Scripts/Enemy3/Enemy3TriggerScript.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: f40a9b1a293616e45b3024edffbb71d5
+timeCreated: 1491393459
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/GunPickup.cs b/Assets/Scripts/GunPickup.cs
new file mode 100755
index 0000000..b97d9eb
--- /dev/null
+++ b/Assets/Scripts/GunPickup.cs
@@ -0,0 +1,27 @@
+using UnityEngine;
+using System.Collections;
+
+public class GunPickup : MonoBehaviour
+{
+ DialogueScript dialogueScript;
+
+ void Start ()
+ {
+ dialogueScript = GameObject.FindGameObjectWithTag("DialogueSystem").GetComponent<DialogueScript>();
+ }
+
+ void Update ()
+ {
+
+ }
+
+ void OnTriggerEnter2D(Collider2D col)
+ {
+ if (col.tag == "PlayerCollider")
+ {
+ dialogueScript.ShowMultiDialogue("You picked up a gun, Now shoot;\nHello\najshgdkadh\nahksjdhasd");
+ GameObject.FindGameObjectWithTag("Player").GetComponentInChildren<PlayerShootingScript>().canShoot = true;
+ GameObject.Destroy(gameObject);
+ }
+ }
+}
diff --git a/Assets/Scripts/GunPickup.cs.meta b/Assets/Scripts/GunPickup.cs.meta
new file mode 100755
index 0000000..f3b4a32
--- /dev/null
+++ b/Assets/Scripts/GunPickup.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: e5634f9ab6d880444a939af6bc2540db
+timeCreated: 1473485197
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/LevelEnd.meta b/Assets/Scripts/LevelEnd.meta
new file mode 100755
index 0000000..87c5180
--- /dev/null
+++ b/Assets/Scripts/LevelEnd.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: c6d4130a2e209e14293f0c86ee643919
+folderAsset: yes
+timeCreated: 1491408840
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/LevelEnd/EndLevel.cs b/Assets/Scripts/LevelEnd/EndLevel.cs
new file mode 100755
index 0000000..76edea7
--- /dev/null
+++ b/Assets/Scripts/LevelEnd/EndLevel.cs
@@ -0,0 +1,26 @@
+using UnityEngine;
+using System.Collections;
+using UnityEngine.SceneManagement;
+
+public class EndLevel : MonoBehaviour {
+
+ public int Level;
+
+ // Use this for initialization
+ void Start () {
+
+ }
+
+ // Update is called once per frame
+ void Update () {
+
+ }
+
+ void OnTriggerEnter2D(Collider2D col)
+ {
+ if(col.tag == "PlayerCollider")
+ {
+ SceneManager.LoadScene(Level);
+ }
+ }
+}
diff --git a/Assets/Scripts/LevelEnd/EndLevel.cs.meta b/Assets/Scripts/LevelEnd/EndLevel.cs.meta
new file mode 100755
index 0000000..2166f6f
--- /dev/null
+++ b/Assets/Scripts/LevelEnd/EndLevel.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 3f9aa6e6e86289a4cbc2eb10d4b9cba0
+timeCreated: 1472992376
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/NPCScript.cs b/Assets/Scripts/NPCScript.cs
new file mode 100755
index 0000000..75db273
--- /dev/null
+++ b/Assets/Scripts/NPCScript.cs
@@ -0,0 +1,46 @@
+using UnityEngine;
+using System.Collections;
+using UnityEngine.UI;
+
+public class NPCScript : MonoBehaviour {
+
+
+ DialogueScript dialogueScript;
+ public string dialogue;
+ public GameObject TipCanvas;
+
+ void Start ()
+ {
+ dialogueScript = GameObject.FindGameObjectWithTag("DialogueSystem").GetComponent<DialogueScript>();
+ }
+
+ void Update ()
+ {
+ }
+
+
+ void OnTriggerStay2D(Collider2D col)
+ {
+
+
+ if (col.tag == "PlayerCollider" )
+ {
+ // Show controller tooltip
+ TipCanvas.SetActive(true);
+
+ // Show dialogue
+ if(Input.GetButtonDown("Action"))
+ dialogueScript.ShowMultiDialogue(dialogue);
+
+ //"Did you see that big holes in the code line ?\n"+
+ //"There must be something going on with th CPU.\n" +
+ //"You're a cursor, you can move around\n" +
+ //"Why don't you checkout what happened."
+ }
+ }
+
+ private void OnTriggerExit2D(Collider2D collision)
+ {
+ TipCanvas.SetActive(false);
+ }
+}
diff --git a/Assets/Scripts/NPCScript.cs.meta b/Assets/Scripts/NPCScript.cs.meta
new file mode 100755
index 0000000..fd176fb
--- /dev/null
+++ b/Assets/Scripts/NPCScript.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 9fc431c3f8c8a974d8cc9534bd88871e
+timeCreated: 1474277376
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/PauseMenu.cs b/Assets/Scripts/PauseMenu.cs
new file mode 100755
index 0000000..1876fc6
--- /dev/null
+++ b/Assets/Scripts/PauseMenu.cs
@@ -0,0 +1,69 @@
+using UnityEngine;
+using System.Collections;
+using UnityEngine.UI;
+using UnityEngine.SceneManagement;
+using UnityEngine.EventSystems;
+
+public class PauseMenu : MonoBehaviour {
+
+ bool Paused;
+ public GameObject PauseMenuPanel;
+ public Button ResumeButton;
+
+ GameObject player;
+ PlayerMovementScript playerMovementScript;
+
+ void Start ()
+ {
+ player = GameObject.FindGameObjectWithTag("Player");
+ playerMovementScript = player.GetComponent<PlayerMovementScript>();
+ //PauseMenuPanel = GameObject.FindGameObjectWithTag("PauseMenu");
+
+ }
+
+ void Update ()
+ {
+ if (Input.GetButtonDown("Pause"))
+ {
+ if (!Paused)
+ {
+ playerMovementScript.StopPlayer();
+ Paused = true;
+ PauseMenuPanel.SetActive(true);
+ Time.timeScale = 0;
+ }
+ else
+ {
+ Paused = false;
+ PauseMenuPanel.SetActive(false);
+ Time.timeScale = 1;
+ }
+ }
+ }
+
+ public void ResumeButtonClick()
+ {
+ if (Paused)
+ {
+ Paused = false;
+ PauseMenuPanel.SetActive(false);
+ Time.timeScale = 1;
+ }
+ }
+
+ public void MainMenuButtonClick(int scene)
+ {
+ SceneManager.LoadScene(scene);
+ Time.timeScale = 1;
+ }
+
+ public void OptionsButtonClick()
+ {
+ }
+
+ public void QuitButtonClick()
+ {
+ Application.Quit();
+ }
+
+}
diff --git a/Assets/Scripts/PauseMenu.cs.meta b/Assets/Scripts/PauseMenu.cs.meta
new file mode 100755
index 0000000..be3f677
--- /dev/null
+++ b/Assets/Scripts/PauseMenu.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 820e00a6969c27543b4d37392cf97cc7
+timeCreated: 1469331822
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Player.meta b/Assets/Scripts/Player.meta
new file mode 100755
index 0000000..dd3f982
--- /dev/null
+++ b/Assets/Scripts/Player.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 18ef75f970ccb3e4caa2785639dcbbd2
+folderAsset: yes
+timeCreated: 1468166690
+licenseType: Free
+DefaultImporter:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Player/Bullet.cs b/Assets/Scripts/Player/Bullet.cs
new file mode 100755
index 0000000..e96c245
--- /dev/null
+++ b/Assets/Scripts/Player/Bullet.cs
@@ -0,0 +1,54 @@
+using UnityEngine;
+using System.Collections;
+
+public class Bullet : MonoBehaviour {
+
+ public float Speed = 10;
+ Vector2 Direction;
+
+ GameObject Player;
+
+ void Start ()
+ {
+ Player = GameObject.FindGameObjectWithTag("Player") as GameObject;
+ if (Player.GetComponent<PlayerMovementScript>().FacingRight)
+ Direction = Vector2.right;
+ else
+ Direction = Vector2.left;
+ }
+
+ void Update ()
+ {
+ GetComponent<Rigidbody2D>().velocity = Direction * Speed;
+
+ //Destroy after 2 seconds
+ Destroy(gameObject, 2f);
+ }
+
+ void OnTriggerEnter2D(Collider2D col)
+ {
+ if(col.tag == "Enemy")
+ {
+ col.gameObject.GetComponent<EnemyHealthScript>().TakeDamage(25);
+ Destroy(gameObject);
+ }
+
+ if (col.tag == "Enemy2")
+ {
+ col.gameObject.GetComponent<NewEnemyHealth>().TakeDamage(25);
+ Destroy(gameObject);
+ }
+
+ if (col.tag == "Boss1")
+ {
+ col.gameObject.GetComponentInParent<Boss1HealthScript>().TakeDamage(25);
+ Destroy(gameObject);
+ }
+
+ if (col.tag == "Enemy3")
+ {
+ col.gameObject.GetComponent<Enemy3HealthScript>().TakeDamage(25);
+ Destroy(gameObject);
+ }
+ }
+}
diff --git a/Assets/Scripts/Player/Bullet.cs.meta b/Assets/Scripts/Player/Bullet.cs.meta
new file mode 100755
index 0000000..1d15cc9
--- /dev/null
+++ b/Assets/Scripts/Player/Bullet.cs.meta
@@ -0,0 +1,14 @@
+fileFormatVersion: 2
+guid: 51982e4f66782f348b0f711b4a4d3cc8
+timeCreated: 1467296479
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences:
+ - Enemy: {fileID: 132632, guid: 887f4befebfaeac41bced6bcba983245, type: 2}
+ - Player: {instanceID: 0}
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Player/GroundCheckScript.cs b/Assets/Scripts/Player/GroundCheckScript.cs
new file mode 100755
index 0000000..4dbace7
--- /dev/null
+++ b/Assets/Scripts/Player/GroundCheckScript.cs
@@ -0,0 +1,25 @@
+using UnityEngine;
+using System.Collections;
+
+public class GroundCheckScript : MonoBehaviour {
+
+ public PlayerMovementScript player;
+
+ void OnTriggerEnter2D(Collider2D col)
+ {
+ if (col.tag == "Ground" || col.tag == "Platform")
+ player.grounded = true;
+ }
+
+ void OnTriggerStay2D(Collider2D col)
+ {
+ if (col.tag == "Ground" || col.tag == "Platform")
+ player.grounded = true;
+ }
+
+ void OnTriggerExit2D(Collider2D col)
+ {
+ if (col.tag == "Ground" || col.tag == "Platform")
+ player.grounded = false;
+ }
+}
diff --git a/Assets/Scripts/Player/GroundCheckScript.cs.meta b/Assets/Scripts/Player/GroundCheckScript.cs.meta
new file mode 100755
index 0000000..5ae354a
--- /dev/null
+++ b/Assets/Scripts/Player/GroundCheckScript.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: d87d752f992bcf042ae9ba927253d1ce
+timeCreated: 1466852149
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Player/PlayerHealthScript.cs b/Assets/Scripts/Player/PlayerHealthScript.cs
new file mode 100755
index 0000000..38e354a
--- /dev/null
+++ b/Assets/Scripts/Player/PlayerHealthScript.cs
@@ -0,0 +1,66 @@
+using UnityEngine;
+using System.Collections;
+using UnityEngine.UI;
+using UnityEngine.SceneManagement;
+
+public class PlayerHealthScript : MonoBehaviour {
+
+ public float Health;
+ public float MaxHealth = 100;
+ bool Damaged;
+
+ //HUD
+ GameObject HUD;
+ Text HealthText;
+ Text GameOverText;
+ Image DamageIndicator;
+
+ void Start ()
+ {
+ HUD = GameObject.FindGameObjectWithTag("HUD");
+ HealthText = HUD.transform.Find("HealthText").GetComponent<Text>();
+ GameOverText = HUD.transform.Find("GameOverText").GetComponent<Text>();
+ DamageIndicator = HUD.transform.Find("DamageIndicatorImage").GetComponent<Image>();
+ Health = 100;
+ HealthText.text = Health + "/100";
+ }
+
+
+ void Update ()
+ {
+ //Damage Animation
+ if (Damaged)
+ {
+ DamageIndicator.color = new Color(1, 0, 0, .1f);
+ }
+ else
+ {
+ DamageIndicator.color = Color.Lerp(DamageIndicator.color, Color.clear, 1f * Time.deltaTime);
+ }
+ Damaged = false;
+ }
+
+ public void TakeDamage(float damage)
+ {
+ Health -= damage;
+ if (Health <= 0) Health = 0;
+ HealthText.text = Health + "/100";
+
+ Damaged = true;
+
+ if (Health <= 0)
+ {
+ Health = 0;
+ gameObject.GetComponent<PlayerMovementScript>().enabled = false;
+ gameObject.GetComponentInChildren<PlayerShootingScript>().enabled = false;
+ StartCoroutine(Restart());
+ }
+ }
+
+ IEnumerator Restart()
+ {
+ GameOverText.text = "Game Over";
+ yield return new WaitForSeconds(3f);
+ SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().name);
+ }
+}
diff --git a/Assets/Scripts/Player/PlayerHealthScript.cs.meta b/Assets/Scripts/Player/PlayerHealthScript.cs.meta
new file mode 100755
index 0000000..133d4f3
--- /dev/null
+++ b/Assets/Scripts/Player/PlayerHealthScript.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: e542a83a152079041999a3050d683b6f
+timeCreated: 1468167547
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Player/PlayerMovementScript.cs b/Assets/Scripts/Player/PlayerMovementScript.cs
new file mode 100755
index 0000000..c28067c
--- /dev/null
+++ b/Assets/Scripts/Player/PlayerMovementScript.cs
@@ -0,0 +1,120 @@
+using UnityEngine;
+using System.Collections;
+
+public class PlayerMovementScript : MonoBehaviour {
+
+ Rigidbody2D rb2d;
+
+ //Movement
+ float MaxSpeed;
+ public float MaxNormalSpeed = 10f;
+ public float MaxSprintSpeed = 15f;
+ public float ForceFactor = 60f;
+ public bool FacingRight = true;
+
+ //Movement animation
+ GameObject PlayerTrail;
+
+ //Jump
+ public float jumpShortSpeed = 10f;
+ public float jumpSpeed = 30f;
+ bool jump = false;
+ bool jumpCancal = false;
+ public bool grounded = true;
+
+ void Start ()
+ {
+ rb2d = gameObject.GetComponent<Rigidbody2D>();
+ MaxSpeed = MaxNormalSpeed;
+ PlayerTrail = GameObject.FindGameObjectWithTag("PlayerTrail");
+ }
+
+ void Update ()
+ {
+ //Jump
+ if (Input.GetButtonDown("Jump") && grounded)
+ {
+ jump = true;
+ }
+ if (Input.GetButtonUp("Jump") && !grounded)
+ {
+ jumpCancal = true;
+ }
+ }
+
+ void FixedUpdate()
+ {
+ //Horizontal
+ rb2d.AddForce(Vector2.right * Input.GetAxis("Horizontal") * ForceFactor);
+
+ //Left-Right Movement
+ if (rb2d.velocity.x > 0.0001f)
+ {
+ transform.localScale = new Vector3(1, 1, 1);
+ FacingRight = true;
+ }
+ if (rb2d.velocity.x < -0.0001f)
+ {
+ transform.localScale = new Vector3(-1, 1, 1);
+ FacingRight = false;
+ }
+
+ //Max Speed
+ if (rb2d.velocity.x > MaxSpeed)
+ {
+ rb2d.velocity = new Vector2(MaxSpeed, rb2d.velocity.y);
+ }
+ else if (rb2d.velocity.x < -MaxSpeed)
+ {
+ rb2d.velocity = new Vector2(-MaxSpeed, rb2d.velocity.y);
+ }
+
+ //Sprint
+ if (Input.GetAxis("Sprint") == 1)
+ {
+ MaxSpeed = MaxSprintSpeed;
+ }
+ if (Input.GetAxis("Sprint") == 0)
+ {
+
+ if (rb2d.velocity.x > MaxNormalSpeed )
+ {
+ MaxSpeed = Mathf.Lerp(rb2d.velocity.x, MaxNormalSpeed, .1f);
+ }
+ else if (rb2d.velocity.x < -MaxNormalSpeed)
+ {
+ MaxSpeed = Mathf.Lerp(-rb2d.velocity.x, MaxNormalSpeed, .1f);
+ }
+ }
+
+ //Sprint animation
+ if (rb2d.velocity.x == MaxSprintSpeed || rb2d.velocity.x == -MaxSprintSpeed)
+ {
+ PlayerTrail.SetActive(true);
+ }
+ else if (rb2d.velocity.x < 10.1f && rb2d.velocity.x > -10.1f)
+ PlayerTrail.SetActive(false);
+
+
+ //Jump
+
+ if (jump)
+ {
+ rb2d.velocity = new Vector2(rb2d.velocity.x, jumpSpeed);
+ jump = false;
+ }
+ if (jumpCancal)
+ {
+
+ if (rb2d.velocity.y > jumpShortSpeed)
+ rb2d.velocity = new Vector2(rb2d.velocity.x, Mathf.Lerp(rb2d.velocity.y, jumpShortSpeed, .6f));
+ jumpCancal = false;
+ }
+ }
+
+ public void StopPlayer()
+ {
+ rb2d.velocity = new Vector2(0, 0);
+ PlayerTrail.SetActive(false);
+ }
+}
diff --git a/Assets/Scripts/Player/PlayerMovementScript.cs.meta b/Assets/Scripts/Player/PlayerMovementScript.cs.meta
new file mode 100755
index 0000000..fdaa596
--- /dev/null
+++ b/Assets/Scripts/Player/PlayerMovementScript.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: b22f59be8664ecb47a0e2ab5536d50a4
+timeCreated: 1468167320
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/Player/PlayerShootingScript.cs b/Assets/Scripts/Player/PlayerShootingScript.cs
new file mode 100755
index 0000000..45c6aca
--- /dev/null
+++ b/Assets/Scripts/Player/PlayerShootingScript.cs
@@ -0,0 +1,33 @@
+using UnityEngine;
+using System.Collections;
+
+public class PlayerShootingScript : MonoBehaviour {
+
+ public bool canShoot;
+ public GameObject Bullet;
+ public float Firerate = 1f;
+ float fireCounter = 0;
+
+ // Use this for initialization
+ void Start () {
+
+ }
+
+ // Update is called once per frame
+ void Update ()
+ {
+ if (canShoot)
+ {
+ if (Input.GetAxis("Fire") == 1)
+ {
+ if (fireCounter > Firerate)
+ {
+ fireCounter = 0;
+ gameObject.GetComponent<AudioSource>().Play();
+ Instantiate(Bullet, gameObject.transform.position, Quaternion.identity);
+ }
+ }
+ fireCounter += Time.deltaTime;
+ }
+ }
+}
diff --git a/Assets/Scripts/Player/PlayerShootingScript.cs.meta b/Assets/Scripts/Player/PlayerShootingScript.cs.meta
new file mode 100755
index 0000000..66ecbfa
--- /dev/null
+++ b/Assets/Scripts/Player/PlayerShootingScript.cs.meta
@@ -0,0 +1,13 @@
+fileFormatVersion: 2
+guid: e7a6e88305369d54b8295eec8c87001c
+timeCreated: 1468072543
+licenseType: Free
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences:
+ - Bullet: {fileID: 187558, guid: fb9814a46f3507c4e9b08a5fc84f727f, type: 2}
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: