diff --git a/singleTap/SingleTap/Assets/Materials/BackGround.mat b/singleTap/SingleTap/Assets/Materials/BackGround.mat new file mode 100644 index 0000000..636b85f Binary files /dev/null and b/singleTap/SingleTap/Assets/Materials/BackGround.mat differ diff --git a/singleTap/SingleTap/Assets/Materials/BackGround.mat.meta b/singleTap/SingleTap/Assets/Materials/BackGround.mat.meta new file mode 100644 index 0000000..d342872 --- /dev/null +++ b/singleTap/SingleTap/Assets/Materials/BackGround.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0e8c53a8841f1d04a857fdc959f50a30 +timeCreated: 1471477532 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/singleTap/SingleTap/Assets/Materials/MissileMaterial.mat b/singleTap/SingleTap/Assets/Materials/MissileMaterial.mat new file mode 100644 index 0000000..94e10ef Binary files /dev/null and b/singleTap/SingleTap/Assets/Materials/MissileMaterial.mat differ diff --git a/singleTap/SingleTap/Assets/Materials/MissileMaterial.mat.meta b/singleTap/SingleTap/Assets/Materials/MissileMaterial.mat.meta new file mode 100644 index 0000000..0c59913 --- /dev/null +++ b/singleTap/SingleTap/Assets/Materials/MissileMaterial.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 050d321b8c53c7f4f893f7e604850662 +timeCreated: 1471482226 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/singleTap/SingleTap/Assets/Particle.mat b/singleTap/SingleTap/Assets/Materials/Particle.mat similarity index 100% rename from singleTap/SingleTap/Assets/Particle.mat rename to singleTap/SingleTap/Assets/Materials/Particle.mat diff --git a/singleTap/SingleTap/Assets/Particle.mat.meta b/singleTap/SingleTap/Assets/Materials/Particle.mat.meta similarity index 100% rename from singleTap/SingleTap/Assets/Particle.mat.meta rename to singleTap/SingleTap/Assets/Materials/Particle.mat.meta diff --git a/singleTap/SingleTap/Assets/Materials/Player.mat b/singleTap/SingleTap/Assets/Materials/Player.mat index 03e5a11..b8ad6bb 100644 Binary files a/singleTap/SingleTap/Assets/Materials/Player.mat and b/singleTap/SingleTap/Assets/Materials/Player.mat differ diff --git a/singleTap/SingleTap/Assets/Materials/PlayerHealth1.mat b/singleTap/SingleTap/Assets/Materials/PlayerHealth1.mat new file mode 100644 index 0000000..6cefc00 Binary files /dev/null and b/singleTap/SingleTap/Assets/Materials/PlayerHealth1.mat differ diff --git a/singleTap/SingleTap/Assets/Materials/PlayerHealth1.mat.meta b/singleTap/SingleTap/Assets/Materials/PlayerHealth1.mat.meta new file mode 100644 index 0000000..e910d03 --- /dev/null +++ b/singleTap/SingleTap/Assets/Materials/PlayerHealth1.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 77c9f22d12edb01499287b4b87c39abe +timeCreated: 1471485949 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/singleTap/SingleTap/Assets/Materials/PlayerHealth2.mat b/singleTap/SingleTap/Assets/Materials/PlayerHealth2.mat new file mode 100644 index 0000000..079462d Binary files /dev/null and b/singleTap/SingleTap/Assets/Materials/PlayerHealth2.mat differ diff --git a/singleTap/SingleTap/Assets/Materials/PlayerHealth2.mat.meta b/singleTap/SingleTap/Assets/Materials/PlayerHealth2.mat.meta new file mode 100644 index 0000000..5985b07 --- /dev/null +++ b/singleTap/SingleTap/Assets/Materials/PlayerHealth2.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 706b2632b5216154686a63fd0522f3a7 +timeCreated: 1471485965 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/singleTap/SingleTap/Assets/Materials/PlayerPointer.mat b/singleTap/SingleTap/Assets/Materials/PlayerPointer.mat index a0aa3ba..e02ab08 100644 Binary files a/singleTap/SingleTap/Assets/Materials/PlayerPointer.mat and b/singleTap/SingleTap/Assets/Materials/PlayerPointer.mat differ diff --git a/singleTap/SingleTap/Assets/Objects.meta b/singleTap/SingleTap/Assets/Objects.meta new file mode 100644 index 0000000..cf6311c --- /dev/null +++ b/singleTap/SingleTap/Assets/Objects.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f4356aaaec66b214888e3b4b25eadc71 +folderAsset: yes +timeCreated: 1471484700 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/singleTap/SingleTap/Assets/Objects/16_9Tile.fbx b/singleTap/SingleTap/Assets/Objects/16_9Tile.fbx new file mode 100644 index 0000000..bcec083 Binary files /dev/null and b/singleTap/SingleTap/Assets/Objects/16_9Tile.fbx differ diff --git a/singleTap/SingleTap/Assets/Objects/16_9Tile.fbx.meta b/singleTap/SingleTap/Assets/Objects/16_9Tile.fbx.meta new file mode 100644 index 0000000..7c3d9db --- /dev/null +++ b/singleTap/SingleTap/Assets/Objects/16_9Tile.fbx.meta @@ -0,0 +1,76 @@ +fileFormatVersion: 2 +guid: 53fffb8f8bc7ba14f89452aff8b57784 +timeCreated: 1471477532 +licenseType: Free +ModelImporter: + serializedVersion: 19 + fileIDToRecycleName: + 100000: //RootNode + 400000: //RootNode + 2300000: //RootNode + 3300000: //RootNode + 4300000: Plane + materials: + importMaterials: 1 + materialName: 0 + materialSearch: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleRotations: 1 + optimizeGameObjects: 0 + motionNodeName: + animationImportErrors: + animationImportWarnings: + animationRetargetingWarnings: + animationDoRetargetingWarnings: 0 + animationCompression: 1 + animationRotationError: 0.5 + animationPositionError: 0.5 + animationScaleError: 0.5 + animationWrapMode: 0 + extraExposedTransformPaths: [] + clipAnimations: [] + isReadable: 1 + meshes: + lODScreenPercentages: [] + globalScale: 1 + meshCompression: 0 + addColliders: 0 + importBlendShapes: 1 + swapUVChannels: 0 + generateSecondaryUV: 0 + useFileUnits: 1 + optimizeMeshForGPU: 1 + keepQuads: 0 + weldVertices: 1 + secondaryUVAngleDistortion: 8 + secondaryUVAreaDistortion: 15.000001 + secondaryUVHardAngle: 88 + secondaryUVPackMargin: 4 + useFileScale: 1 + tangentSpace: + normalSmoothAngle: 60 + normalImportMode: 0 + tangentImportMode: 3 + importAnimation: 1 + copyAvatar: 0 + humanDescription: + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + rootMotionBoneName: + hasTranslationDoF: 0 + lastHumanDescriptionAvatarSource: {instanceID: 0} + animationType: 0 + humanoidOversampling: 1 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/singleTap/SingleTap/Assets/Prefabs.meta b/singleTap/SingleTap/Assets/Prefabs.meta new file mode 100644 index 0000000..f5d5621 --- /dev/null +++ b/singleTap/SingleTap/Assets/Prefabs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 974f51ff6466c334fa3c82d49b6e4fcb +folderAsset: yes +timeCreated: 1471484714 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/singleTap/SingleTap/Assets/bullet.prefab b/singleTap/SingleTap/Assets/Prefabs/Enemy.prefab similarity index 80% rename from singleTap/SingleTap/Assets/bullet.prefab rename to singleTap/SingleTap/Assets/Prefabs/Enemy.prefab index 64b6988..ffc7d8a 100644 Binary files a/singleTap/SingleTap/Assets/bullet.prefab and b/singleTap/SingleTap/Assets/Prefabs/Enemy.prefab differ diff --git a/singleTap/SingleTap/Assets/Prefabs/Enemy.prefab.meta b/singleTap/SingleTap/Assets/Prefabs/Enemy.prefab.meta new file mode 100644 index 0000000..ba1fb3e --- /dev/null +++ b/singleTap/SingleTap/Assets/Prefabs/Enemy.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9c3bdc3cf0409b244bd3d018994f45bb +timeCreated: 1471493774 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/singleTap/SingleTap/Assets/EnemyMissile.prefab b/singleTap/SingleTap/Assets/Prefabs/EnemyMissile.prefab similarity index 83% rename from singleTap/SingleTap/Assets/EnemyMissile.prefab rename to singleTap/SingleTap/Assets/Prefabs/EnemyMissile.prefab index 0ee52dc..08c9d7a 100644 Binary files a/singleTap/SingleTap/Assets/EnemyMissile.prefab and b/singleTap/SingleTap/Assets/Prefabs/EnemyMissile.prefab differ diff --git a/singleTap/SingleTap/Assets/EnemyMissile.prefab.meta b/singleTap/SingleTap/Assets/Prefabs/EnemyMissile.prefab.meta similarity index 100% rename from singleTap/SingleTap/Assets/EnemyMissile.prefab.meta rename to singleTap/SingleTap/Assets/Prefabs/EnemyMissile.prefab.meta diff --git a/singleTap/SingleTap/Assets/Prefabs/Mover.prefab b/singleTap/SingleTap/Assets/Prefabs/Mover.prefab new file mode 100644 index 0000000..836ded4 Binary files /dev/null and b/singleTap/SingleTap/Assets/Prefabs/Mover.prefab differ diff --git a/singleTap/SingleTap/Assets/Prefabs/Mover.prefab.meta b/singleTap/SingleTap/Assets/Prefabs/Mover.prefab.meta new file mode 100644 index 0000000..e76b3af --- /dev/null +++ b/singleTap/SingleTap/Assets/Prefabs/Mover.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3cce71904fda3cd4a8a338b2cfa6c9bf +timeCreated: 1471493768 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/singleTap/SingleTap/Assets/bullet.prefab.meta b/singleTap/SingleTap/Assets/Prefabs/bullet.prefab.meta similarity index 100% rename from singleTap/SingleTap/Assets/bullet.prefab.meta rename to singleTap/SingleTap/Assets/Prefabs/bullet.prefab.meta diff --git a/singleTap/SingleTap/Assets/Prefabs/explosion 1.prefab b/singleTap/SingleTap/Assets/Prefabs/explosion 1.prefab new file mode 100644 index 0000000..4fb8b84 Binary files /dev/null and b/singleTap/SingleTap/Assets/Prefabs/explosion 1.prefab differ diff --git a/singleTap/SingleTap/Assets/Prefabs/explosion 1.prefab.meta b/singleTap/SingleTap/Assets/Prefabs/explosion 1.prefab.meta new file mode 100644 index 0000000..2befe50 --- /dev/null +++ b/singleTap/SingleTap/Assets/Prefabs/explosion 1.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 61a40ddea037e1442928296063bc82b4 +timeCreated: 1471485417 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/singleTap/SingleTap/Assets/Scripts/BackgroundController.cs b/singleTap/SingleTap/Assets/Scripts/BackgroundController.cs new file mode 100644 index 0000000..f3e50d7 --- /dev/null +++ b/singleTap/SingleTap/Assets/Scripts/BackgroundController.cs @@ -0,0 +1,66 @@ +using UnityEngine; +using System.Collections; + +public class BackgroundController : MonoBehaviour { + + public float transistionSpeed = 1f; + public float waitTime = 10f; + + private Material mat; + + private float lastTransition = 0.0f; + private bool inverseDirection = false; + + + // Use this for initialization + void Start () { + mat = GetComponent().material; + } + + // Update is called once per frame + void FixedUpdate () { + + if (Time.time - lastTransition >= waitTime) { + lastTransition = Time.time; + StartCoroutine(transition(transistionSpeed)); + } + + } + + private IEnumerator transition(float time) { + + float transitionStart = -1; + float transitionEnd = 1; + + if (inverseDirection) { + mat.SetFloat("_InvertMap", 1); + }else { + mat.SetFloat("_InvertMap", 0); + } + + float elapsedTime = 0; + float transitionFrac = transitionStart; + + while ((elapsedTime/ time) <=1) { + transitionFrac = Mathf.Lerp(transitionStart, transitionEnd, (elapsedTime / time)); + + + transitionFrac = (inverseDirection)? transitionFrac : -transitionFrac; + + mat.SetFloat("_TimeNode", transitionFrac); + + elapsedTime += Time.deltaTime; + yield return new WaitForEndOfFrame(); + } + + if (inverseDirection) { + mat.SetFloat("_TimeNode", 1); + } else { + mat.SetFloat("_TimeNode", -1); + } + + inverseDirection = !inverseDirection; + } + + +} diff --git a/singleTap/SingleTap/Assets/Scripts/BackgroundController.cs.meta b/singleTap/SingleTap/Assets/Scripts/BackgroundController.cs.meta new file mode 100644 index 0000000..763f0d6 --- /dev/null +++ b/singleTap/SingleTap/Assets/Scripts/BackgroundController.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9a7bd545185bc6e4884a8571592f7e0d +timeCreated: 1471477977 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/singleTap/SingleTap/Assets/Scripts/EnemyController.cs b/singleTap/SingleTap/Assets/Scripts/EnemyController.cs index 524c402..48a65cf 100644 --- a/singleTap/SingleTap/Assets/Scripts/EnemyController.cs +++ b/singleTap/SingleTap/Assets/Scripts/EnemyController.cs @@ -11,11 +11,13 @@ public class EnemyController : InteractableObject { private Rigidbody2D playerRigid; public GameObject bullet; public float shotCoolDown = 0.5f; - private float lastShotTime = 0.0f; + public float initShotWait = 0.0f; + protected float lastShotTime = 0.0f; private GameObject healthDisp; // Use this for initialization - void Start () { + protected virtual void Start () { + lastShotTime += initShotWait; healthDisp = GetComponentInChildren().gameObject; player = GameObject.FindGameObjectWithTag("Player"); playerRigid = player.GetComponent(); @@ -35,7 +37,7 @@ public class EnemyController : InteractableObject { } - private void shoot(Vector2 startVelocity) { + protected void shoot(Vector2 startVelocity) { GameObject bulletClone = (GameObject)Instantiate(bullet, transform.position, transform.rotation); MissileController bulletScript = bulletClone.GetComponent(); bulletScript.startVelocity = startVelocity; @@ -62,7 +64,9 @@ public class EnemyController : InteractableObject { Vector3 newScale = new Vector3(health / 10f, health / 10f, health / 10f); Debug.Log("new scale = " + newScale); - healthDisp.transform.localScale = newScale; + if (healthDisp != null) { + healthDisp.transform.localScale = newScale; + } transform.localScale = newScale; } diff --git a/singleTap/SingleTap/Assets/Scripts/MissileController.cs b/singleTap/SingleTap/Assets/Scripts/MissileController.cs index b7a1d89..3a9447e 100644 --- a/singleTap/SingleTap/Assets/Scripts/MissileController.cs +++ b/singleTap/SingleTap/Assets/Scripts/MissileController.cs @@ -9,6 +9,8 @@ public class MissileController : MonoBehaviour { public float initVelocity = 5; public float boostCoolDown = 0.3f; public float difficulty = 0.0f; + public ParticleSystem boostEffect; + public GameObject Explosion; [HideInInspector] public Vector3 startVelocity; @@ -63,6 +65,13 @@ public class MissileController : MonoBehaviour { } private void moveTorwards(Vector3 pos) { + + if (boostEffect != null) { + Debug.Log("Playing Boost"); + boostEffect.startRotation = transform.rotation.eulerAngles.z * Mathf.Deg2Rad; + boostEffect.Play(); + } + Vector2 direction = (pos - transform.position).normalized; Debug.DrawLine(transform.position, pos, Color.green,0.3f); rigid.velocity = direction * speed; @@ -87,13 +96,18 @@ public class MissileController : MonoBehaviour { InteractableObject colScript = coll.gameObject.GetComponent(); if (colScript == null || colScript == spawningObject ) { - Debug.Log("I ignored " + coll.gameObject.name); + // Debug.Log("I ignored " + coll.gameObject.name); return; } Debug.Log("I hit " + coll.gameObject.name); colScript.shot(); + if (Explosion != null) + Instantiate(Explosion, transform.position,transform.rotation); + + Destroy(this.gameObject); + } diff --git a/singleTap/SingleTap/Assets/Scripts/MoverController.cs b/singleTap/SingleTap/Assets/Scripts/MoverController.cs new file mode 100644 index 0000000..47616f3 --- /dev/null +++ b/singleTap/SingleTap/Assets/Scripts/MoverController.cs @@ -0,0 +1,73 @@ +using UnityEngine; +using System.Collections; + +public class MoverController : EnemyController { + + public Transform[] moveRoute; + public float moveSpeed; + public float moveCoolDown = 2; + + public int routeLoc = 0; + private int routeMax; + + private bool isMove = false; + private float lastMoveTime = 0.5f; + + // Use this for initialization + protected override void Start () { + base.Start(); + routeMax = moveRoute.Length; + transform.position = moveRoute[routeLoc % routeMax].position; + } + + // Update is called once per frame + void FixedUpdate () { + + if (Time.time - lastShotTime >= shotCoolDown) { + lastShotTime = Time.time; + Vector3 dir1 = (moveRoute[(routeLoc + 1) % routeMax].position - moveRoute[routeLoc % routeMax].position).normalized; + Vector3 dir2 = (moveRoute[mod ((routeLoc - 1), routeMax)].position - moveRoute[routeLoc % routeMax].position).normalized; + + shoot(dir1); + shoot(dir2); + } + + if (Time.time - lastMoveTime >= moveCoolDown) { + lastMoveTime = Time.time; + StartCoroutine(moveLocation(moveSpeed)); + } + + + } + + private IEnumerator moveLocation(float time) { + + Vector3 start = moveRoute[routeLoc % routeMax].position; + Vector3 end = moveRoute[(routeLoc + 1 ) % routeMax].position; + + float elapsedTime = 0; + Vector3 pos = start; + + while ((elapsedTime / time) <= 1) { + pos = Vector3.Lerp(start, end, (elapsedTime / time)); + + + transform.position = pos; + + elapsedTime += Time.deltaTime; + yield return new WaitForEndOfFrame(); + } + transform.position = end; + routeLoc++; + + + } + + //c# modulo deals with negatives differently because it is a remainder call + //this fixes that + private int mod(int x, int m) { + return (x % m + m) % m; + } + + +} diff --git a/singleTap/SingleTap/Assets/Scripts/MoverController.cs.meta b/singleTap/SingleTap/Assets/Scripts/MoverController.cs.meta new file mode 100644 index 0000000..30c507f --- /dev/null +++ b/singleTap/SingleTap/Assets/Scripts/MoverController.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c208473e04a5251459c03316635f17fd +timeCreated: 1471490311 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/singleTap/SingleTap/Assets/Scripts/PlayerController.cs b/singleTap/SingleTap/Assets/Scripts/PlayerController.cs index b901c5c..7a4ca5d 100644 --- a/singleTap/SingleTap/Assets/Scripts/PlayerController.cs +++ b/singleTap/SingleTap/Assets/Scripts/PlayerController.cs @@ -2,22 +2,26 @@ using System.Collections; [RequireComponent(typeof(Rigidbody2D))] -public class PlayerController : MonoBehaviour { +public class PlayerController : InteractableObject { public GameObject bullet; public float speed; + public int health; + public Renderer healthMat; + public Color[] healthColor; + public GameObject Explosion; + public ParticleSystem boostEffect; private int bulletDirection = -1; private Rigidbody2D rigid; - private GameObject[] targets; + private float lastHit = 0.0f; + private bool isDead = false; // Use this for initialization void Start() { - targets = GameObject.FindGameObjectsWithTag("Enemy"); - rigid = GetComponent(); - rigid.AddForce(Vector2.up * 200); + rigid.AddForce(Vector2.right * 200); } @@ -30,6 +34,9 @@ public class PlayerController : MonoBehaviour { public void rotatePlayer() { + if (isDead) + return; + rigid.velocity = Vector3.zero; transform.Rotate(new Vector3(0, 0, 5f)); @@ -37,6 +44,12 @@ public class PlayerController : MonoBehaviour { } public void movePlayer() { + if (isDead) + return; + + //Debug.Log(transform.rotation.eulerAngles.z * Mathf.Deg2Rad); + boostEffect.startRotation = -transform.rotation.eulerAngles.z * Mathf.Deg2Rad; + boostEffect.Play(); rigid.AddForce(transform.right * speed,ForceMode2D.Impulse); @@ -44,7 +57,10 @@ public class PlayerController : MonoBehaviour { - GameObject findClosestTarget(GameObject[] targets) { + GameObject findClosestTarget() { + + GameObject[] targets = GameObject.FindGameObjectsWithTag("Enemy"); + GameObject tMin = null; float minDist = Mathf.Infinity; Vector3 currentPos = transform.position; @@ -59,13 +75,52 @@ public class PlayerController : MonoBehaviour { } public void shoot() { + if (isDead) + return; + GameObject bulletClone = (GameObject)Instantiate(bullet, transform.position + (transform.up * bulletDirection * 0.1f), transform.rotation); MissileController bulletScript = bulletClone.GetComponent(); bulletScript.startVelocity = transform.up * bulletDirection; bulletDirection = -bulletDirection; - bulletScript.target = findClosestTarget(targets); + bulletScript.ignoreList = GetComponents(); + bulletScript.target = findClosestTarget(); bulletScript.enabled = true; + } + + private void setDead() { + rigid.angularDrag = 0; + rigid.drag = 1; + rigid.constraints = RigidbodyConstraints2D.None; + } + + public override void shot() { + + if (Time.time - lastHit < 1) { + return; + } + + health--; + + if (isDead) { + if (Explosion != null) + Instantiate(Explosion, transform.position, transform.rotation); + + Destroy(this.gameObject, 0.1f); + } + + + if (health <= 0) { + isDead = true; + setDead(); + health = 0; + } + healthMat.material.color = healthColor[3-health]; + lastHit = Time.time; + + + + } } \ No newline at end of file diff --git a/singleTap/SingleTap/Assets/Scripts/SparkParticles.cs b/singleTap/SingleTap/Assets/Scripts/SparkParticles.cs new file mode 100644 index 0000000..871e4d8 --- /dev/null +++ b/singleTap/SingleTap/Assets/Scripts/SparkParticles.cs @@ -0,0 +1,49 @@ +using UnityEngine; +using System.Collections; + +public class SparkParticles : MonoBehaviour +{ + public Transform BillboardTarget; + ParticleSystem _particleSystem; + // There is a fixed buffer size for particles hacked into this script. + // This means the script will cap the max number of particles to whatever the length of this array is. + // It's ugly I know. Sorry! + ParticleSystem.Particle[] _particles = new ParticleSystem.Particle[25]; + + void Awake() + { + _particleSystem = GetComponent(); + + if (BillboardTarget == null) + BillboardTarget = Camera.main.transform; + } + + void FixParticleRotations() + { + int count = _particleSystem.GetParticles(_particles); + + for (int i = 0; i < count; i++) + { + Vector3 dir = _particles[i].velocity.normalized; + float rot = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg; + _particles[i].rotation = rot; + } + + _particleSystem.SetParticles(_particles, _particleSystem.particleCount); + } + + public void Play() + { + transform.LookAt(BillboardTarget); + _particleSystem.Play(); + StartCoroutine(LateFix()); + } + + // It seems setting the rotations on the frame you tell the system to Play is insufficient. + // So this handy coroutine delays that by a single frame. + IEnumerator LateFix() + { + yield return null; + FixParticleRotations(); + } +} \ No newline at end of file diff --git a/singleTap/SingleTap/Assets/Scripts/SparkParticles.cs.meta b/singleTap/SingleTap/Assets/Scripts/SparkParticles.cs.meta new file mode 100644 index 0000000..e5429cf --- /dev/null +++ b/singleTap/SingleTap/Assets/Scripts/SparkParticles.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a8609380967377848a5bdf3c1f9e19ac +timeCreated: 1459360624 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/singleTap/SingleTap/Assets/Scripts/TapDetector.cs b/singleTap/SingleTap/Assets/Scripts/TapDetector.cs index e41e71c..379e014 100644 --- a/singleTap/SingleTap/Assets/Scripts/TapDetector.cs +++ b/singleTap/SingleTap/Assets/Scripts/TapDetector.cs @@ -43,12 +43,12 @@ public class TapDetector : MonoBehaviour { private void longPressDown() { - Debug.Log("longPressDown"); + //Debug.Log("longPressDown"); //playerScript.linkHook(); } private void longPress() { - Debug.Log("holdingKey"); + //Debug.Log("holdingKey"); Debug.DrawRay(transform.position, Vector3.up * 20, Color.red); playerScript.rotatePlayer(); @@ -56,13 +56,13 @@ public class TapDetector : MonoBehaviour { } private void longPressUp() { - Debug.Log("LongPressUp"); + //Debug.Log("LongPressUp"); //playerScript.unlinkHook(); playerScript.movePlayer(); } private void shortPress() { - Debug.Log("shorPress"); + //Debug.Log("shorPress"); Debug.DrawRay(transform.position, Vector3.up * 20, Color.green,0.3f); playerScript.shoot(); diff --git a/singleTap/SingleTap/Assets/Shaders.meta b/singleTap/SingleTap/Assets/Shaders.meta new file mode 100644 index 0000000..c6c4443 --- /dev/null +++ b/singleTap/SingleTap/Assets/Shaders.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d7c85864f881a3448b4988f3f2c65edc +folderAsset: yes +timeCreated: 1471484757 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/singleTap/SingleTap/Assets/Shaders/BackGroundEffect.shader b/singleTap/SingleTap/Assets/Shaders/BackGroundEffect.shader new file mode 100644 index 0000000..2ffe2a6 --- /dev/null +++ b/singleTap/SingleTap/Assets/Shaders/BackGroundEffect.shader @@ -0,0 +1,81 @@ +// Shader created with Shader Forge v1.26 +// Shader Forge (c) Neat Corporation / Joachim Holmer - http://www.acegikmo.com/shaderforge/ +// Note: Manually altering this data may prevent you from opening it in Shader Forge +/*SF_DATA;ver:1.26;sub:START;pass:START;ps:flbk:,iptp:0,cusa:False,bamd:0,lico:1,lgpr:1,limd:0,spmd:1,trmd:0,grmd:0,uamb:True,mssp:True,bkdf:False,hqlp:False,rprd:False,enco:False,rmgx:True,rpth:0,vtps:0,hqsc:True,nrmq:1,nrsp:0,vomd:0,spxs:False,tesm:0,olmd:1,culm:0,bsrc:0,bdst:1,dpts:2,wrdp:True,dith:0,rfrpo:True,rfrpn:Refraction,coma:15,ufog:True,aust:True,igpj:False,qofs:0,qpre:1,rntp:1,fgom:False,fgoc:False,fgod:False,fgor:False,fgmd:0,fgcr:0.5,fgcg:0.5,fgcb:0.5,fgca:1,fgde:0.01,fgrn:0,fgrf:300,stcl:False,stva:128,stmr:255,stmw:255,stcp:6,stps:0,stfa:0,stfz:0,ofsf:0,ofsu:0,f2p0:False,fnsp:False,fnfb:False;n:type:ShaderForge.SFN_Final,id:9361,x:33209,y:32712,varname:node_9361,prsc:2|custl-6614-OUT;n:type:ShaderForge.SFN_Color,id:2943,x:32587,y:32901,ptovrint:False,ptlb:HighLight,ptin:_HighLight,varname:_HighLight,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0.3602941,c2:0.3602941,c3:0.3602941,c4:1;n:type:ShaderForge.SFN_Color,id:5129,x:32576,y:32684,ptovrint:False,ptlb:LowLight,ptin:_LowLight,varname:_LowLight,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0.7132353,c2:0.7132353,c3:0.7132353,c4:1;n:type:ShaderForge.SFN_Lerp,id:6614,x:32890,y:32938,varname:node_6614,prsc:2|A-5129-RGB,B-2943-RGB,T-1023-OUT;n:type:ShaderForge.SFN_Tex2d,id:7481,x:31875,y:33749,ptovrint:False,ptlb:GradienceMap,ptin:_GradienceMap,varname:_Gradience,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:cb89da7e1100944499f9783f8a750859,ntxv:0,isnm:False|UVIN-2380-UVOUT;n:type:ShaderForge.SFN_TexCoord,id:2380,x:31564,y:33766,varname:node_2380,prsc:2,uv:0;n:type:ShaderForge.SFN_Add,id:4392,x:32094,y:33110,varname:node_4392,prsc:2|A-4708-OUT,B-8125-OUT;n:type:ShaderForge.SFN_Lerp,id:8125,x:31852,y:33157,varname:node_8125,prsc:2|A-8573-RGB,B-714-OUT,T-288-OUT;n:type:ShaderForge.SFN_RemapRange,id:714,x:31618,y:33221,varname:node_714,prsc:2,frmn:0,frmx:1,tomn:1,tomx:0|IN-8573-RGB;n:type:ShaderForge.SFN_Tex2d,id:8573,x:31147,y:33174,ptovrint:False,ptlb:TimeMap,ptin:_TimeMap,varname:_TimeNode,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:b8f1d2aab7a1ed0478705fbbbbffde97,ntxv:0,isnm:False|UVIN-1982-UVOUT;n:type:ShaderForge.SFN_TexCoord,id:1982,x:30920,y:33087,varname:node_1982,prsc:2,uv:0;n:type:ShaderForge.SFN_ComponentMask,id:4482,x:32305,y:33086,varname:node_4482,prsc:2,cc1:0,cc2:-1,cc3:-1,cc4:-1|IN-4392-OUT;n:type:ShaderForge.SFN_Code,id:1023,x:32714,y:33346,varname:node_1023,prsc:2,code:IABmAGwAbwBhAHQAIAByAGUAdABWAGEAbAA7AA0ACgAgACAAIAAgACAAIAAgACAAIAAgAA0ACgAgAGYAbABvAGEAdAAgAHQAIAA9ACAAKAAoAEkAbgBwAHUAdAAgACsAIABTAGwAaQBkAGUAcgApAC8AKAAyACoAUwBsAGkAZABlAHIAKQApADsADQAKACAAcgBlAHQAVgBhAGwAIAA9ACAAbABlAHIAcAAgACgAMAAsADEALAB0ACkAOwANAAoAIAAgACAAIAAgACAAIAAgACAAIAAgACAADQAKACAAcgBlAHQAdQByAG4AIABjAGwAYQBtAHAAIAAoAHIAZQB0AFYAYQBsACwAIAAwAC4AMAAsACAAMQAuADAAKQA7AA==,output:0,fname:CieltoGrad,width:384,height:187,input:0,input:0,input_1_label:Input,input_2_label:Slider|A-5345-OUT,B-3076-OUT;n:type:ShaderForge.SFN_Slider,id:4708,x:31020,y:32871,ptovrint:False,ptlb:TimeNode,ptin:_TimeNode,varname:node_4708,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:-1,cur:-0.6582282,max:1;n:type:ShaderForge.SFN_ToggleProperty,id:288,x:31690,y:33410,ptovrint:False,ptlb:InvertMap,ptin:_InvertMap,varname:node_288,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,on:True;n:type:ShaderForge.SFN_Clamp01,id:5345,x:32503,y:33211,varname:node_5345,prsc:2|IN-4482-OUT;n:type:ShaderForge.SFN_Clamp01,id:5374,x:32066,y:33749,varname:node_5374,prsc:2|IN-7481-R;n:type:ShaderForge.SFN_RemapRange,id:3076,x:32297,y:33684,varname:node_3076,prsc:2,frmn:0,frmx:1,tomn:0.001,tomx:1|IN-5374-OUT;proporder:2943-5129-7481-8573-4708-288;pass:END;sub:END;*/ + +Shader "Shader Forge/BackGroundEffect" { + Properties { + _HighLight ("HighLight", Color) = (0.3602941,0.3602941,0.3602941,1) + _LowLight ("LowLight", Color) = (0.7132353,0.7132353,0.7132353,1) + _GradienceMap ("GradienceMap", 2D) = "white" {} + _TimeMap ("TimeMap", 2D) = "white" {} + _TimeNode ("TimeNode", Range(-1, 1)) = -0.6582282 + [MaterialToggle] _InvertMap ("InvertMap", Float ) = 1 + } + SubShader { + Tags { + "RenderType"="Opaque" + } + Pass { + Name "FORWARD" + Tags { + "LightMode"="ForwardBase" + } + + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #define UNITY_PASS_FORWARDBASE + #include "UnityCG.cginc" + #pragma multi_compile_fwdbase_fullshadows + #pragma multi_compile_fog + #pragma exclude_renderers gles3 metal d3d11_9x xbox360 xboxone ps3 ps4 psp2 + #pragma target 3.0 + uniform float4 _HighLight; + uniform float4 _LowLight; + uniform sampler2D _GradienceMap; uniform float4 _GradienceMap_ST; + uniform sampler2D _TimeMap; uniform float4 _TimeMap_ST; + float CieltoGrad( float Input , float Slider ){ + float retVal; + + float t = ((Input + Slider)/(2*Slider)); + retVal = lerp (0,1,t); + + return clamp (retVal, 0.0, 1.0); + } + + uniform float _TimeNode; + uniform fixed _InvertMap; + struct VertexInput { + float4 vertex : POSITION; + float2 texcoord0 : TEXCOORD0; + }; + struct VertexOutput { + float4 pos : SV_POSITION; + float2 uv0 : TEXCOORD0; + UNITY_FOG_COORDS(1) + }; + VertexOutput vert (VertexInput v) { + VertexOutput o = (VertexOutput)0; + o.uv0 = v.texcoord0; + o.pos = mul(UNITY_MATRIX_MVP, v.vertex ); + UNITY_TRANSFER_FOG(o,o.pos); + return o; + } + float4 frag(VertexOutput i) : COLOR { +////// Lighting: + float4 _TimeMap_var = tex2D(_TimeMap,TRANSFORM_TEX(i.uv0, _TimeMap)); + float node_5345 = saturate((_TimeNode+lerp(_TimeMap_var.rgb,(_TimeMap_var.rgb*-1.0+1.0),_InvertMap)).r); + float4 _GradienceMap_var = tex2D(_GradienceMap,TRANSFORM_TEX(i.uv0, _GradienceMap)); + float3 finalColor = lerp(_LowLight.rgb,_HighLight.rgb,CieltoGrad( node_5345 , (saturate(_GradienceMap_var.r)*0.999+0.001) )); + fixed4 finalRGBA = fixed4(finalColor,1); + UNITY_APPLY_FOG(i.fogCoord, finalRGBA); + return finalRGBA; + } + ENDCG + } + } + FallBack "Diffuse" + CustomEditor "ShaderForgeMaterialInspector" +} diff --git a/singleTap/SingleTap/Assets/Shaders/BackGroundEffect.shader.meta b/singleTap/SingleTap/Assets/Shaders/BackGroundEffect.shader.meta new file mode 100644 index 0000000..eb6081c --- /dev/null +++ b/singleTap/SingleTap/Assets/Shaders/BackGroundEffect.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f7bc2d33fe19cc54997cc96bab239558 +timeCreated: 1471477635 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/singleTap/SingleTap/Assets/Textures.meta b/singleTap/SingleTap/Assets/Textures.meta new file mode 100644 index 0000000..95ec8e5 --- /dev/null +++ b/singleTap/SingleTap/Assets/Textures.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 5620e7f621492d342bb3bd8371fb639a +folderAsset: yes +timeCreated: 1471484749 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/singleTap/SingleTap/Assets/Textures/ConeGradience.png b/singleTap/SingleTap/Assets/Textures/ConeGradience.png new file mode 100644 index 0000000..5bf3247 Binary files /dev/null and b/singleTap/SingleTap/Assets/Textures/ConeGradience.png differ diff --git a/singleTap/SingleTap/Assets/Textures/ConeGradience.png.meta b/singleTap/SingleTap/Assets/Textures/ConeGradience.png.meta new file mode 100644 index 0000000..b721c1b --- /dev/null +++ b/singleTap/SingleTap/Assets/Textures/ConeGradience.png.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: 1d3a9e5905874be40848a8e599ccf78f +timeCreated: 1471477641 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/singleTap/SingleTap/Assets/Textures/CubeNoise.jpg b/singleTap/SingleTap/Assets/Textures/CubeNoise.jpg new file mode 100644 index 0000000..1101311 Binary files /dev/null and b/singleTap/SingleTap/Assets/Textures/CubeNoise.jpg differ diff --git a/singleTap/SingleTap/Assets/Textures/CubeNoise.jpg.meta b/singleTap/SingleTap/Assets/Textures/CubeNoise.jpg.meta new file mode 100644 index 0000000..cdd3253 --- /dev/null +++ b/singleTap/SingleTap/Assets/Textures/CubeNoise.jpg.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: f1b1689e68f8ae24ebcaa24c1e8ca875 +timeCreated: 1471477643 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/singleTap/SingleTap/Assets/_Scenes/TestScene.unity b/singleTap/SingleTap/Assets/_Scenes/TestScene.unity index a31b318..cccd36e 100644 Binary files a/singleTap/SingleTap/Assets/_Scenes/TestScene.unity and b/singleTap/SingleTap/Assets/_Scenes/TestScene.unity differ