Commit 08af3fb3 authored by tmorga18's avatar tmorga18

resolved conflicts with melee

parent 85a7396c
......@@ -27,6 +27,10 @@ public class Actions : MonoBehaviour {
private Vector3 LastInput = new Vector2(0, -1);
private Animator animator;
public float meleeTime = 0.5f;
void Start () {
abilitiesImage = GameObject.FindGameObjectWithTag ("Cycle").GetComponent<Image>();
......@@ -36,23 +40,52 @@ public class Actions : MonoBehaviour {
abilityUnusable = new Color(255.0f,255.0f,255.0f,0.5f);
abilityUsable = new Color(255.0f,255.0f,255.0f,1.0f);
audio = GetComponent<AudioSource>();
animator = GetComponent<Animator>();
}
void Update () {
RaycastHit2D hit = Physics2D.Raycast(transform.position, GetLastDirection());
Debug.DrawRay(transform.position, GetLastDirection(), Color.red);
// Constantly check where the player is facing
GetLastDirection();
RaycastHit2D meleeRaycastHit = Physics2D.Raycast(transform.position, GetLastDirection(), 5);
Debug.DrawRay(transform.position, GetLastDirection(), Color.red);
if(meleeRaycastHit.collider.tag == "Enemy") {
Debug.Log(meleeRaycastHit.collider.gameObject);
}
// If the player right clicks the mouse...
if(Input.GetButtonDown("Fire1")) {
animator.SetBool("Attacking", true);
StartCoroutine(ResetAttack());
}
if(Input.GetButtonDown("Fire2")) {
UseAbility(currentAbility.name);
}
if(Input.GetButtonDown("Fire3")) {
// Increment the counter
abilitiesCounter++;
// If the counter goes out of range of the array's size, reset it to 0
if(abilitiesCounter > abilities.Length - 1) {
abilitiesCounter = 0;
}
// Call the ChooseAbility() function
CycleAbility();
}
// Checks to see if the water shield is off cooldown and changes the image opacity accordingly
if(waterShieldUsable == false) {
waterShieldTimer -= Time.deltaTime;
if(waterShieldTimer <= 0) {
......@@ -64,26 +97,11 @@ public class Actions : MonoBehaviour {
} else {
abilitiesImage.GetComponent<Image>().color = abilityUsable;
}
// If the player presses the button to choose an ability...
if(Input.GetButtonDown("Fire2")) {
// Increment the counter
abilitiesCounter++;
// Call the ChooseAbility() function
CycleAbility();
}
}
void CycleAbility() {
// If the counter goes out of range of the array's size, reset it to 0
if(abilitiesCounter > abilities.Length - 1) {
abilitiesCounter = 0;
}
// Set the currentAbility to the one chosen by the abilitiesCounter
currentAbility = abilities[abilitiesCounter];
......@@ -158,6 +176,10 @@ public class Actions : MonoBehaviour {
this.GetComponent<HeroMobility> ().canMove = false;
yield return new WaitForSeconds (0.2f);
this.GetComponent<HeroMobility> ().canMove = true;
}
IEnumerator ResetAttack() {
yield return new WaitForSeconds(meleeTime);
animator.SetBool("Attacking", false);
}
}
fileFormatVersion: 2
guid: 0d9ab217d1dc41b40ab94fee0e4e38a5
timeCreated: 1478834902
timeCreated: 1479436348
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
fileIDToRecycleName:
21300000: GADIG_Kamali_ATTACKDOWN_v5_0
21300002: GADIG_Kamali_ATTACKDOWN_v5_1
21300004: GADIG_Kamali_ATTACKDOWN_v5_2
21300006: GADIG_Kamali_ATTACKDOWN_v5_3
21300008: GADIG_Kamali_ATTACKDOWN_v5_4
21300010: GADIG_Kamali_ATTACKDOWN_v5_5
21300012: GADIG_Kamali_ATTACKDOWN_v5_6
21300014: GADIG_Kamali_ATTACKDOWN_v5_7
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
linearTexture: 0
correctGamma: 0
fadeOut: 0
......@@ -29,8 +37,8 @@ TextureImporter:
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
filterMode: 0
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0
......@@ -38,18 +46,194 @@ TextureImporter:
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 1
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: 100
spritePixelsToUnits: 16
alphaIsTransparency: 1
textureType: 8
buildTargetSettings: []
spriteSheet:
sprites: []
sprites:
- name: GADIG_Kamali_ATTACKDOWN_v5_0
rect:
serializedVersion: 2
x: 0
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: 4, y: 10}
- {x: -9, y: 10}
- {x: -9, y: -10}
- {x: 7, y: -10}
- {x: 9, y: -8}
- {x: 9, y: 8}
- name: GADIG_Kamali_ATTACKDOWN_v5_1
rect:
serializedVersion: 2
x: 64
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: 4, y: 9}
- {x: -7, y: 9}
- {x: -9, y: 6}
- {x: -10, y: 0}
- {x: -10, y: -8}
- {x: -8, y: -11}
- {x: 8, y: -11}
- {x: 9, y: -9}
- {x: 9, y: 7}
- name: GADIG_Kamali_ATTACKDOWN_v5_2
rect:
serializedVersion: 2
x: 128
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: 4, y: 8}
- {x: -7, y: 8}
- {x: -9, y: 5}
- {x: -9, y: -9}
- {x: -8, y: -13}
- {x: 3, y: -13}
- {x: 7, y: -12}
- {x: 9, y: -10}
- {x: 9, y: 6}
- name: GADIG_Kamali_ATTACKDOWN_v5_3
rect:
serializedVersion: 2
x: 192
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: -14, y: -7}
- {x: -14, y: -22}
- {x: -12, y: -24}
- {x: 5, y: -24}
- {x: 13, y: -22}
- {x: 13, y: -4}
- {x: 11, y: 6}
- {x: 5, y: 8}
- {x: -10, y: 8}
- {x: -11, y: 7}
- name: GADIG_Kamali_ATTACKDOWN_v5_4
rect:
serializedVersion: 2
x: 256
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: -8, y: 8}
- {x: -14, y: -7}
- {x: -14, y: -21}
- {x: -13, y: -23}
- {x: -7, y: -27}
- {x: 7, y: -27}
- {x: 13, y: -25}
- {x: 13, y: 8}
- name: GADIG_Kamali_ATTACKDOWN_v5_5
rect:
serializedVersion: 2
x: 320
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: -13, y: -16}
- {x: -14, y: -17}
- {x: -14, y: -29}
- {x: 11, y: -29}
- {x: 13, y: -23}
- {x: 13, y: -20}
- {x: 12, y: -16}
- - {x: -7, y: 8}
- {x: -9, y: 5}
- {x: -9, y: -11}
- {x: -5, y: -13}
- {x: 9, y: -13}
- {x: 9, y: 7}
- {x: 6, y: 8}
- name: GADIG_Kamali_ATTACKDOWN_v5_6
rect:
serializedVersion: 2
x: 384
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: 0, y: -21}
- {x: -3, y: -21}
- {x: -9, y: -27}
- {x: -9, y: -31}
- {x: -6, y: -32}
- {x: 4, y: -32}
- {x: 13, y: -27}
- {x: 13, y: -25}
- {x: 12, y: -23}
- {x: 6, y: -21}
- {x: 4, y: -23}
- - {x: -10, y: -20}
- {x: -13, y: -21}
- {x: -13, y: -26}
- {x: -11, y: -28}
- {x: -10, y: -28}
- {x: -6, y: -24}
- {x: -6, y: -23}
- {x: -8, y: -20}
- - {x: -7, y: 9}
- {x: -9, y: 6}
- {x: -9, y: -10}
- {x: -5, y: -12}
- {x: 9, y: -12}
- {x: 9, y: 8}
- {x: 6, y: 9}
- name: GADIG_Kamali_ATTACKDOWN_v5_7
rect:
serializedVersion: 2
x: 448
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: 4, y: 10}
- {x: -9, y: 10}
- {x: -9, y: -10}
- {x: 7, y: -10}
- {x: 9, y: -8}
- {x: 9, y: 8}
outline: []
spritePackingTag:
userData:
......
fileFormatVersion: 2
guid: 2cc4fed42b3726b408f52d16bef0345b
timeCreated: 1478834903
timeCreated: 1479436900
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
fileIDToRecycleName:
21300000: GADIG_Kamali_ATTACKUP_v4_0
21300002: GADIG_Kamali_ATTACKUP_v4_1
21300004: GADIG_Kamali_ATTACKUP_v4_2
21300006: GADIG_Kamali_ATTACKUP_v4_3
21300008: GADIG_Kamali_ATTACKUP_v4_4
21300010: GADIG_Kamali_ATTACKUP_v4_5
21300012: GADIG_Kamali_ATTACKUP_v4_6
21300014: GADIG_Kamali_ATTACKUP_v4_7
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
linearTexture: 0
correctGamma: 0
fadeOut: 0
......@@ -29,8 +37,8 @@ TextureImporter:
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
filterMode: 0
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0
......@@ -38,18 +46,193 @@ TextureImporter:
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 1
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: 100
spritePixelsToUnits: 16
alphaIsTransparency: 1
textureType: 8
buildTargetSettings: []
spriteSheet:
sprites: []
sprites:
- name: GADIG_Kamali_ATTACKUP_v4_0
rect:
serializedVersion: 2
x: 0
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: -7, y: 9}
- {x: -9, y: 8}
- {x: -9, y: -10}
- {x: -7, y: -11}
- {x: 9, y: -11}
- {x: 9, y: 6}
- {x: 8, y: 9}
- name: GADIG_Kamali_ATTACKUP_v4_1
rect:
serializedVersion: 2
x: 64
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: -7, y: 10}
- {x: -9, y: 9}
- {x: -9, y: -9}
- {x: -7, y: -10}
- {x: 9, y: -10}
- {x: 9, y: 7}
- {x: 8, y: 10}
- name: GADIG_Kamali_ATTACKUP_v4_2
rect:
serializedVersion: 2
x: 128
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: -7, y: 11}
- {x: -9, y: 10}
- {x: -9, y: -8}
- {x: -7, y: -9}
- {x: 9, y: -9}
- {x: 9, y: 8}
- {x: 8, y: 11}
- name: GADIG_Kamali_ATTACKUP_v4_3
rect:
serializedVersion: 2
x: 192
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: -8, y: 19}
- {x: -13, y: 16}
- {x: -13, y: -1}
- {x: -12, y: -9}
- {x: 9, y: -9}
- {x: 14, y: 5}
- {x: 14, y: 15}
- {x: 8, y: 19}
- name: GADIG_Kamali_ATTACKUP_v4_4
rect:
serializedVersion: 2
x: 256
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: 11, y: 18}
- {x: 7, y: 22}
- {x: -7, y: 22}
- {x: -11, y: 21}
- {x: -15, y: 15}
- {x: -12, y: 10}
- {x: -7, y: 11}
- {x: -9, y: 8}
- {x: -10, y: -7}
- {x: -7, y: -9}
- {x: 7, y: -9}
- {x: 9, y: -7}
- {x: 12, y: 6}
- {x: 12, y: 12}
- name: GADIG_Kamali_ATTACKUP_v4_5
rect:
serializedVersion: 2
x: 320
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: -7, y: 11}
- {x: -9, y: 10}
- {x: -9, y: -8}
- {x: -7, y: -9}
- {x: 9, y: -9}
- {x: 9, y: 8}
- {x: 8, y: 11}
- - {x: -15, y: 13}
- {x: -14, y: 11}
- {x: 10, y: 11}
- {x: 12, y: 12}
- {x: 12, y: 20}
- {x: 10, y: 24}
- {x: -10, y: 24}
- {x: -15, y: 18}
- name: GADIG_Kamali_ATTACKUP_v4_6
rect:
serializedVersion: 2
x: 384
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: -7, y: 11}
- {x: -9, y: 10}
- {x: -9, y: -8}
- {x: -7, y: -9}
- {x: 9, y: -9}
- {x: 9, y: 8}
- {x: 8, y: 11}
- - {x: 5, y: 17}
- {x: 8, y: 14}
- {x: 11, y: 15}
- {x: 12, y: 20}
- {x: 9, y: 22}
- {x: 5, y: 18}
- - {x: 5, y: 26}
- {x: -2, y: 27}
- {x: -4, y: 27}
- {x: -14, y: 20}
- {x: -14, y: 16}
- {x: -9, y: 15}
- {x: 4, y: 15}
- {x: 8, y: 23}
- {x: 8, y: 26}
- name: GADIG_Kamali_ATTACKUP_v4_7
rect:
serializedVersion: 2
x: 448
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: -7, y: 10}
- {x: -9, y: 9}
- {x: -9, y: -9}
- {x: -7, y: -10}
- {x: 9, y: -10}
- {x: 9, y: 7}
- {x: 8, y: 10}
outline: []
spritePackingTag:
userData:
......
fileFormatVersion: 2
guid: c3c22475c98b94e4484099aba50fc56a
timeCreated: 1478834903
timeCreated: 1479437097
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
fileIDToRecycleName:
21300000: GADIG_Kamali_ATTACK_v12_0
21300002: GADIG_Kamali_ATTACK_v12_1
21300004: GADIG_Kamali_ATTACK_v12_2
21300006: GADIG_Kamali_ATTACK_v12_3
21300008: GADIG_Kamali_ATTACK_v12_4
21300010: GADIG_Kamali_ATTACK_v12_5
21300012: GADIG_Kamali_ATTACK_v12_6
21300014: GADIG_Kamali_ATTACK_v12_7
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
linearTexture: 0
correctGamma: 0
fadeOut: 0
......@@ -29,8 +37,8 @@ TextureImporter:
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
filterMode: 0
aniso: 16
mipBias: -1
wrapMode: 1
nPOTScale: 0
......@@ -38,18 +46,185 @@ TextureImporter:
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 1
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: 100
spritePixelsToUnits: 16
alphaIsTransparency: 1
textureType: 8
buildTargetSettings: []
spriteSheet:
sprites: []
sprites:
- name: GADIG_Kamali_ATTACK_v12_0
rect:
serializedVersion: 2
x: 0
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: -7, y: 10}
- {x: -8, y: 6}
- {x: -8, y: -7}
- {x: -7, y: -10}
- {x: 7, y: -10}
- {x: 7, y: 10}
- name: GADIG_Kamali_ATTACK_v12_1
rect:
serializedVersion: 2
x: 64
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: 6, y: -10}
- {x: 9, y: -9}
- {x: 9, y: 10}
- {x: -5, y: 10}
- {x: -7, y: 9}
- {x: -7, y: -10}
- name: GADIG_Kamali_ATTACK_v12_2
rect:
serializedVersion: 2
x: 128
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: 7, y: 10}
- {x: -3, y: 10}
- {x: -6, y: 7}
- {x: -6, y: -10}
- {x: 12, y: -10}
- {x: 17, y: -7}
- {x: 17, y: 1}
- {x: 12, y: 9}
- name: GADIG_Kamali_ATTACK_v12_3
rect:
serializedVersion: 2
x: 192
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: -5, y: -13}
- {x: 26, y: -13}
- {x: 28, y: -10}
- {x: 28, y: 11}
- {x: 25, y: 14}
- {x: 5, y: 14}
- {x: -5, y: 10}
- name: GADIG_Kamali_ATTACK_v12_4
rect:
serializedVersion: 2
x: 256
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: 29, y: 12}
- {x: 23, y: 16}
- {x: 17, y: 14}
- {x: 13, y: -5}
- {x: 13, y: -8}
- {x: 17, y: -11}
- {x: 20, y: -11}
- {x: 26, y: -9}
- {x: 30, y: -6}
- {x: 30, y: 8}
- - {x: -5, y: 9}
- {x: -5, y: -10}
- {x: 10, y: -10}
- {x: 15, y: -8}
- {x: 15, y: 9}
- name: GADIG_Kamali_ATTACK_v12_5
rect:
serializedVersion: 2
x: 320
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: -5, y: 10}
- {x: -5, y: -9}
- {x: -3, y: -10}
- {x: 8, y: -10}
- {x: 10, y: -7}
- {x: 10, y: 9}
- {x: 8, y: 10}
- - {x: 23, y: 16}
- {x: 20, y: 13}
- {x: 20, y: -3}
- {x: 24, y: -6}
- {x: 28, y: -6}
- {x: 32, y: -2}
- {x: 32, y: 10}
- {x: 25, y: 16}
- name: GADIG_Kamali_ATTACK_v12_6
rect:
serializedVersion: 2
x: 384
y: 0
width: 64
height: 64
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
outline:
- - {x: 7, y: 10}
- {x: -5, y: 10}
- {x: -6, y: 9}
- {x: -6, y: -8}
- {x: -4, y: -10}
- {x: 4, y: -10}