public void ShieldBash(Player player) { //player.playerState.hitEnemyShield = true; player.playerDashChaining.PlayerShovedBack(); enemyAnimator.SetTrigger("shieldBash"); audioShieldHit.PlayOneShot(enemyAudioSource); }
public void PlayerDestroysShield() { //shieldAnimator.SetTrigger("shieldDestroyed"); playerDestroyShieldPooler.SpawnFromQueueAndPlay(null, transform.position, transform.forward); audioShieldDestroyed.PlayOneShot(enemyAudioSource); DestroyShieldObject(); }
public IEnumerator DashInDirection(Vector3 target) { playerAnimator.SetBool("isDashing", true); player.playerState.canDash = false; player.playerState.isDashing = true; transform.LookAt(target); Vector3 direction; //if the chainkill script events are in effect, the dash is no longer clamped to a maximum range if (!player.playerState.isLegendary) { direction = (transform.position + (target - transform.position).normalized * dashRadius) * 1.01f; } else { direction = transform.position + (target - transform.position); } //this is a precaution against certain rare flukes in which the player character learned to fly... direction.y = 0; audioPlayerKickoff.PlayOneShot(playerAudioSource); audioPlayerDash.PlayOneShot(playerAudioSource); playerDashKickoffPooled.SpawnFromQueueAndPlay(null, transform.position, direction); naginataControl.StartBladeTrail(); //move towards the current dash target as long as it has not been reached //and no enemy shield has been hit while (Vector3.Distance(transform.position, direction) > 0.05f && !player.playerState.hitEnemyShield) { transform.position = Vector3.MoveTowards(transform.position, direction, Time.deltaTime * dashSpeed); yield return(null); } if (player.playerState.hitEnemyShield) { //if an enemy shield has been hit, everything related to dashing is stopped //because the PlayerShovedBack method and ShovedBack coroutine take over yield break; } yield return(new WaitForSeconds(0.15f)); player.playerState.canDash = true; if (targetStash.Count > 0) { targetStashEmpty = false; yield break; } else { targetStashEmpty = true; } yield return(new WaitForSeconds(0.6f)); EndDashChain(); }
IEnumerator DashInDirection(Vector3 target, float dashTime) { playerAnimator.SetBool("isDashing", true); playerState.canDash = false; playerState.isDashing = true; target.y = 0; transform.LookAt(target); Vector3 direction = (target - transform.position).normalized; direction.y = 0; float timer = 0; Time.timeScale = 0.33f; audioPlayerDash.PlayOneShot(playerAudioSource); while (timer < dashTime && !playerState.hitEnemyShield) { transform.position = transform.position + (direction * Time.deltaTime * dashSpeed); timer += Time.deltaTime; yield return(null); } Time.timeScale = 1f; playerState.canDash = true; if (stashTarget != Vector3.zero) { DashToStashTarget(); } stashTarget = Vector3.zero; yield return(new WaitForSeconds(0.5f)); playerState.hitEnemyShield = false; yield return(new WaitForSeconds(0.25f)); playerAnimator.SetBool("isDashing", false); playerState.isDashing = false; player.ResetColliderWidth(); yield return(null); }
public void TakeDamage(float damage) { if (iFramesActive || currentHealth <= 0) { return; } currentHealth -= damage; audioTakeDamage.PlayOneShot(enemyAudioSource); healthBar.SetBarTo(currentHealth / maxHealth); if (currentHealth <= 0) { //the enemy has been killed, CUE DEATH enemy.StopMoving(); StartCoroutine(HasBeenKilled()); healthBar.SetBarTo(0f); return; } }
//currently, killed enemies sink into the ground. This should definitely change some time public IEnumerator HasBeenKilled() { killedPS.Play(); GetComponentInParent <EnemySpawn>().RemoveEnemy(enemy); if (hasShield) { enemyShieldCollision.DestroyShieldObject(); } foreach (Collider bc in GetComponentsInChildren <Collider>()) { bc.enabled = false; } audioEnemyDeath.PlayOneShot(enemyAudioSource); while (killedPS.isPlaying) { transform.position = Vector3.MoveTowards(transform.position, transform.position - Vector3.up, Time.deltaTime * 2f); yield return(null); } Destroy(healthBar.gameObject); Destroy(gameObject); yield return(null); }