//this method manages when the dummy is hit, showing visual and audio feedback void DummyAttacked() { swordHit = FindObjectOfType <SwordHitFeedback>(); swordHit.hitEnemy = true; PlayerManager.instance.playerHitEnemy = true; PlayerManager.instance.comboCounter++; Instantiate(dummyAttacked, gameObject.transform.position, gameObject.transform.rotation); }
void PlayerDealtDamage(int damage, float shakeLength, float shakePower) { swordHit = FindObjectOfType <SwordHitFeedback>(); swordHit.hitEnemy = true; PlayerManager.instance.playerHitEnemy = true; PlayerManager.instance.comboCounter++; cameraVar.Shake(shakeLength, shakePower); Instantiate(bloodParticle, bloodParticleReferences [Random.Range(0, 4)].position, bloodParticleReferences [Random.Range(0, 4)].rotation); curHealth -= damage; //I could just change the curHealth here, but maybe I will use an //plays an animation of the enemy flashing red indicating damage (maybe I will use this later, that's why I'm keeping this here) //gameObject.GetComponent<Animation>().Play("Player_RedFlash"); }
void PlayerDealtDamage(int damage) { swordHit = FindObjectOfType <SwordHitFeedback>(); swordHit.hitEnemy = true; PlayerManager.instance.playerHitEnemy = true; PlayerManager.instance.comboCounter++; source.PlayOneShot(beingHitSound, 0.8f); particleCorrectPosition = gameObject.transform.position; particleCorrectPosition.y += 3f; Instantiate(spiritHitParticle, particleCorrectPosition, gameObject.transform.rotation); curHealth -= damage; //I could just change the curHealth here, but maybe I will use an //plays an animation of the enemy flashing red indicating damage (maybe I will use this later, that's why I'm keeping this here) //gameObject.GetComponent<Animation>().Play("Player_RedFlash"); }
//if the player hits the enemy with a sword attack in the human form, it will deal damage, play the slashing animation and shake the camera void OnTriggerEnter2D(Collider2D coll) { if (curHealth > 0) { if (coll.CompareTag("Player")) { Debug.Log("ATACA ELE MANO"); touchingPlayer = true; } if (coll.CompareTag("Attack_Human")) { swordHit = FindObjectOfType <SwordHitFeedback>(); swordHit.hitEnemy = true; PlayerManager.instance.playerHitEnemy = true; PlayerManager.instance.comboCounter++; cameraVar.Shake(0.55f, 0.15f); curHealth -= 20; //I could just change the curHealth here, but maybe I will use an //plays an animation of the enemy flashing red indicating damage (maybe I will use this later, that's why I'm keeping this here) //gameObject.GetComponent<Animation>().Play("Player_RedFlash"); } if (coll.CompareTag("Attack_Spirit")) { if (PlayerManager.instance.isInSpecial == true || PlayerManager.instance.isInSuperSpecial) { swordHit = FindObjectOfType <SwordHitFeedback>(); swordHit.hitEnemy = true; PlayerManager.instance.playerHitEnemy = true; PlayerManager.instance.comboCounter++; curHealth -= 20; //I could just change the curHealth here, but maybe I will use an //plays an animation of the enemy flashing red indicating damage (maybe I will use this later, that's why I'm keeping this here) //gameObject.GetComponent<Animation>().Play("Player_RedFlash"); } } } }