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

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":
GameObject clone = Instantiate (currentAbility, this.transform.position, Quaternion.identity) as GameObject;
clone.GetComponent<FireballProjectile>().move = LastInput;
clone.GetComponent<FireballProjectile>().speed = fireballSpeed;
if (waterShieldUsable == true) {
GameObject clone = Instantiate (currentAbility, this.transform.position, Quaternion.identity) as GameObject;
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:
......
fileFormatVersion: 2
guid: a715821072aa2a54fa345cca8d5bfc91
timeCreated: 1479598616
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: e6bfb87bb92dc9c4e90a271292c1b7d2
timeCreated: 1479598689
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 26d354517141a5646a1be5864d5330fe
timeCreated: 1479596287
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: d175414cf1a815b4faa223e51d66f665
timeCreated: 1479598548
licenseType: Free
TextureImporter:
fileIDToRecycleName:
21300000: turtleBubble_0
21300002: turtleBubble_1
21300004: turtleBubble_2
21300006: turtleBubble_3
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
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: 0
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 16
alphaIsTransparency: 1
textureType: 8
buildTargetSettings: []
spriteSheet:
sprites:
- name: turtleBubble_0
rect:
serializedVersion: 2
x: 0
y: 0
width: 8
height: 8
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- name: turtleBubble_1
rect:
serializedVersion: 2
x: 8
y: 0
width: 8
height: 8
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- name: turtleBubble_2
rect:
serializedVersion: 2
x: 16
y: 0
width: 8
height: 8
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
- name: turtleBubble_3
rect:
serializedVersion: 2
x: 24
y: 0
width: 8
height: 8
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
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