Browse Source

Potential level2 with hord missiles

master
Joshua Reason 8 years ago
parent
commit
36b5ad8f90
14 changed files with 50 additions and 48 deletions
  1. +8
    -1
      .gitignore
  2. BIN
      singleTap/SingleTap/Assets/Prefabs/Enemy.prefab
  3. +0
    -8
      singleTap/SingleTap/Assets/Prefabs/Enemy.prefab.meta
  4. +0
    -8
      singleTap/SingleTap/Assets/Prefabs/EnemyMissile.prefab.meta
  5. BIN
      singleTap/SingleTap/Assets/Prefabs/Mover.prefab
  6. +0
    -8
      singleTap/SingleTap/Assets/Prefabs/Mover.prefab.meta
  7. +0
    -8
      singleTap/SingleTap/Assets/Prefabs/bullet.prefab.meta
  8. BIN
      singleTap/SingleTap/Assets/Prefabs/explosion 1.prefab
  9. +0
    -8
      singleTap/SingleTap/Assets/Prefabs/explosion 1.prefab.meta
  10. +3
    -2
      singleTap/SingleTap/Assets/Scripts/EnemyController.cs
  11. +10
    -5
      singleTap/SingleTap/Assets/Scripts/MissileController.cs
  12. +29
    -0
      singleTap/SingleTap/Assets/Utility/FPSDisplay.cs
  13. BIN
      singleTap/SingleTap/Assets/_Scenes/Level2.unity
  14. BIN
      singleTap/SingleTap/ProjectSettings/TagManager.asset

+ 8
- 1
.gitignore View File

@ -32,4 +32,11 @@ sysinfo.txt
# Builds # Builds
*.apk *.apk
*.unitypackage
*.unitypackage
*.prefab
*.meta
*.bin
*.info
*.bakert
*.tar
*.backup

BIN
singleTap/SingleTap/Assets/Prefabs/Enemy.prefab View File


+ 0
- 8
singleTap/SingleTap/Assets/Prefabs/Enemy.prefab.meta View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 9c3bdc3cf0409b244bd3d018994f45bb
timeCreated: 1471493774
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

+ 0
- 8
singleTap/SingleTap/Assets/Prefabs/EnemyMissile.prefab.meta View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 2faa0c07c34e0814992d73b936cd5d07
timeCreated: 1471242540
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

BIN
singleTap/SingleTap/Assets/Prefabs/Mover.prefab View File


+ 0
- 8
singleTap/SingleTap/Assets/Prefabs/Mover.prefab.meta View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 3cce71904fda3cd4a8a338b2cfa6c9bf
timeCreated: 1471493768
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

+ 0
- 8
singleTap/SingleTap/Assets/Prefabs/bullet.prefab.meta View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 437784b7e6a16fa47b262a7845234e4a
timeCreated: 1470889438
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

BIN
singleTap/SingleTap/Assets/Prefabs/explosion 1.prefab View File


+ 0
- 8
singleTap/SingleTap/Assets/Prefabs/explosion 1.prefab.meta View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 61a40ddea037e1442928296063bc82b4
timeCreated: 1471485417
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

+ 3
- 2
singleTap/SingleTap/Assets/Scripts/EnemyController.cs View File

@ -41,8 +41,9 @@ public class EnemyController : InteractableObject {
GameObject bulletClone = (GameObject)Instantiate(bullet, transform.position, transform.rotation); GameObject bulletClone = (GameObject)Instantiate(bullet, transform.position, transform.rotation);
MissileController bulletScript = bulletClone.GetComponent<MissileController>(); MissileController bulletScript = bulletClone.GetComponent<MissileController>();
bulletScript.startVelocity = startVelocity; bulletScript.startVelocity = startVelocity;
bulletScript.targetPos = player.transform.position;
if (player != null)
bulletScript.targetPos = player.transform.position;
bulletScript.target = player; bulletScript.target = player;
bulletScript.targetRigid = playerRigid; bulletScript.targetRigid = playerRigid;
bulletScript.ignoreList = GetComponentsInChildren<Collider2D>(); bulletScript.ignoreList = GetComponentsInChildren<Collider2D>();

+ 10
- 5
singleTap/SingleTap/Assets/Scripts/MissileController.cs View File

@ -9,6 +9,8 @@ public class MissileController : MonoBehaviour {
public float initVelocity = 5; public float initVelocity = 5;
public float boostCoolDown = 0.3f; public float boostCoolDown = 0.3f;
public float difficulty = 0.0f; public float difficulty = 0.0f;
public int totalBoosts = 2;
public ParticleSystem boostEffect; public ParticleSystem boostEffect;
public GameObject Explosion; public GameObject Explosion;
@ -42,20 +44,20 @@ public class MissileController : MonoBehaviour {
rigid = GetComponent<Rigidbody2D>(); rigid = GetComponent<Rigidbody2D>();
rigid.velocity = startVelocity * initVelocity; rigid.velocity = startVelocity * initVelocity;
Destroy(gameObject, 1.5f);
Destroy(gameObject, boostCoolDown * totalBoosts + 1);
} }
// Update is called once per frame // Update is called once per frame
void FixedUpdate () { void FixedUpdate () {
if (Time.time - startTime >= boostCoolDown && reCalibrate < 2) {
if (Time.time - startTime >= boostCoolDown && reCalibrate < totalBoosts) {
if (reCalibrate == 0) { if (reCalibrate == 0) {
targetPos = target.transform.position;
if (target != null) {
targetPos = target.transform.position;
}
} }
if (target != null) { if (target != null) {
moveTorwards(target); moveTorwards(target);
} else {
moveTorwards(targetPos);
} }
reCalibrate++; reCalibrate++;
startTime = Time.time; startTime = Time.time;
@ -79,6 +81,9 @@ public class MissileController : MonoBehaviour {
} }
private void moveTorwards(GameObject target) { private void moveTorwards(GameObject target) {
if (target == null)
return;
if (targetRigid != null && reCalibrate == 1) { if (targetRigid != null && reCalibrate == 1) {
Debug.DrawLine(targetPos, target.transform.position, Color.blue, 0.3f); Debug.DrawLine(targetPos, target.transform.position, Color.blue, 0.3f);
Vector2 pos = Vector3.Lerp( targetPos,target.transform.position,difficulty); Vector2 pos = Vector3.Lerp( targetPos,target.transform.position,difficulty);

+ 29
- 0
singleTap/SingleTap/Assets/Utility/FPSDisplay.cs View File

@ -0,0 +1,29 @@
#if UNITY_EDITOR
using UnityEngine;
using System.Collections;
public class FPSDisplay : MonoBehaviour {
float deltaTime = 0.0f;
void Update() {
deltaTime += (Time.deltaTime - deltaTime) * 0.1f;
}
void OnGUI() {
int w = Screen.width, h = Screen.height;
GUIStyle style = new GUIStyle();
Rect rect = new Rect(0, 0, w, h * 2 / 100);
style.alignment = TextAnchor.UpperLeft;
style.fontSize = h * 2 / 100;
style.normal.textColor = new Color(0.0f, 0.0f, 0.5f, 1.0f);
float msec = deltaTime * 1000.0f;
float fps = 1.0f / deltaTime;
string text = string.Format("{0:0.0} ms ({1:0.} fps)", msec, fps);
GUI.Label(rect, text, style);
}
}
#endif

BIN
singleTap/SingleTap/Assets/Prefabs/EnemyMissile.prefab → singleTap/SingleTap/Assets/_Scenes/Level2.unity View File


BIN
singleTap/SingleTap/ProjectSettings/TagManager.asset View File


Loading…
Cancel
Save