Commit 6618db9d authored by Jordan B Mckenney's avatar Jordan B Mckenney
Browse files

Added turtle enemy

parent ef138b1e
fileFormatVersion: 2
guid: 3012442563a124740896406d7298194d
guid: 0ba698c06397ec44e8ab14d4f7c8487a
timeCreated: 1479439371
licenseType: Free
NativeFormatImporter:
......
......@@ -19,6 +19,7 @@ public class Actions : MonoBehaviour {
public bool waterShieldUsable = true;
private float waterShieldTimer = 0.0f;
public float waterShieldCooldown = 5.0f;
public float fireballCooldown = 0.5f;
private Vector3 LastInput = new Vector2(0, -1);
......@@ -47,8 +48,8 @@ public class Actions : MonoBehaviour {
}
if(waterShieldUsable == false) {
waterShieldTimer += Time.deltaTime;
if(waterShieldTimer > waterShieldCooldown) {
waterShieldTimer -= Time.deltaTime;
if(waterShieldTimer <= 0) {
waterShieldUsable = true;
waterShieldTimer = 0.0f;
}
......@@ -92,9 +93,14 @@ public class Actions : MonoBehaviour {
switch(myCurrentAbility) {
case "Ability - Fireball":
if (waterShieldUsable == true) {
GameObject clone = Instantiate (currentAbility, this.transform.position, Quaternion.identity) as GameObject;
clone.GetComponent<FireballProjectile>().move = LastInput;
clone.GetComponent<FireballProjectile>().speed = fireballSpeed;
clone.GetComponent<FireballProjectile> ().move = LastInput;
clone.GetComponent<FireballProjectile> ().speed = fireballSpeed;
waterShieldTimer = fireballCooldown;
waterShieldUsable = false;
}
break;
case "Ability - Water Shield":
......@@ -102,6 +108,7 @@ public class Actions : MonoBehaviour {
GameObject myShield = (GameObject)Instantiate(currentAbility, transform.position, Quaternion.identity);
WaterShield waterShield = myShield.GetComponent<WaterShield>();
waterShieldTimer = waterShieldCooldown;
waterShieldUsable = false;
}
break;
......
......@@ -11,33 +11,39 @@ public class TurtleActions : MonoBehaviour {
private bool canShoot = true;
private float timer = 0f;
private float animTimer = 0f;
private Animator animator;
// Use this for initialization
void Start () {
animator = GetComponent<Animator>();
}
// Update is called once per frame
void Update () {
AminateMovement ();
dist = DistanceToPlayer ().magnitude;
p = DirectionToPlayer ();
if (health <= 0) {
Destroy (gameObject);
animator.SetBool ("isDead", true);
StartCoroutine (dead ());
}
if (DistanceToPlayer ().magnitude < 5 && canShoot == true) {
GameObject clone = Instantiate (projectile, this.transform.position, Quaternion.identity) as GameObject;
clone.GetComponent<TurtleProjectile> ().move = DirectionToPlayer ();
clone.GetComponent<TurtleProjectile> ().speed = speed;
timer = 0;
Debug.Log ("1");
StartCoroutine (attack ());
canShoot = false;
}
if (canShoot == false) {
timer += Time.deltaTime;
if (timer >= 2) {
canShoot = true;
timer = 0;
}
}
}
......@@ -81,4 +87,41 @@ public class TurtleActions : MonoBehaviour {
return dir;
}
//Animation Control
void AminateMovement() {
if (timer < 0.5) {
animator.SetBool ("isAttacking", true);
} else {
animator.SetFloat("X", Mathf.Abs(DirectionToPlayer().x));
animator.SetFloat("Y", DirectionToPlayer().y);
animator.SetBool ("isAttacking", false);
Vector2 scale = new Vector2(1, 1);
if(DirectionToPlayer().x != 0)
scale.x = DirectionToPlayer().x;
transform.localScale = scale;
}
}
IEnumerator attack(){
Vector2 dir = DirectionToPlayer ();
yield return new WaitForSeconds (0.3f);
if (animator.GetBool ("isDead") == false) {
Debug.Log ("2");
GameObject clone = Instantiate (projectile, this.transform.position, Quaternion.identity) as GameObject;
clone.GetComponent<TurtleProjectile> ().move = dir;
clone.GetComponent<TurtleProjectile> ().speed = speed;
}
}
IEnumerator dead(){
yield return new WaitForSeconds (0.5f);
Destroy (this.gameObject);
}
}
fileFormatVersion: 2
guid: a25513e707cbe794aa471c196b40ee22
folderAsset: yes
timeCreated: 1475761198
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
......@@ -32,7 +32,7 @@ TextureImporter:
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
textureFormat: -3
maxTextureSize: 2048
textureSettings:
filterMode: 0
......
......@@ -32,7 +32,7 @@ TextureImporter:
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
textureFormat: -3
maxTextureSize: 2048
textureSettings:
filterMode: 0
......
......@@ -31,7 +31,7 @@ TextureImporter:
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
textureFormat: -3
maxTextureSize: 2048
textureSettings:
filterMode: 0
......
fileFormatVersion: 2
guid: b5c8349c3dcc74544a2c657ffc029ae9
folderAsset: yes
timeCreated: 1475801899
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: de34d2e5dacc1954db51bf3eb83a2bf1
timeCreated: 1479596022
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 229a89a03d477f24eb8a396178fb02f6
timeCreated: 1479596302
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 1f42adc9c6eebcd438edc4fce3785851
timeCreated: 1479434707
guid: bda143e81e957594dbf68ac33d929d87
timeCreated: 1479595168
licenseType: Free
NativeFormatImporter:
userData:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment