IEnumerator ChaseSound() { while (true) { yield return(new WaitForSeconds(2)); enemy.PlaySound(enemy.enemyAudio, enemy.chaseAndEngardeSound); } }
IEnumerator PatrolSound() { while (true) { yield return(new WaitForSeconds(10)); enemy.PlaySound(enemy.enemyAudio, enemy.patrolSound); } }
void Updating() { //shoot out raycasts and wait for amount of time before returning back to patrol if (!soundStarted) { soundStarted = true; enemy.PlaySound(enemy.enemyAudio, enemy.investigateSound); } enemy.Investigate(); //TRANSITIONS GO HERE }
public void DamageEnemy(float damage) { //TODO: TRIGGER ANIMATION AND SOUND aiStates.PlaySound(aiStates.enemyAudio, aiStates.damageSound); health -= damage; rightController = GameObject.FindGameObjectWithTag("Right Hand").GetComponent <Right_VR_Cont>(); if (this.gameObject.activeSelf) { StartCoroutine(rightController.PulsedVibration(30, 10, 0.001f, 1f)); } if (health <= 0) { swordUI.IncreaseScore(75); if (this.gameObject.activeSelf) { StartCoroutine(TriggerDeath()); } } }
void Updating() { //aim enemy sword/projectile at player and attack if (!startedAttack) { enemy.PlaySound(enemy.enemyAudio, enemy.attackSound); startedAttack = true; enemy.Attack(); } if (enemy.GetRigidBody().velocity.magnitude >= 0 && enemy.GetRigidBody().velocity.magnitude <= 0.1f) { endedAttack = true; } //TRANSITIONS GO HERE if ((enemy.PlayerInFieldOfView() || enemy.PlayerDetected()) && !enemy.PlayerIsWithinStrikingDistance() && (endedAttack || (enemy.GetRigidBody().velocity.magnitude >= 0 && enemy.GetRigidBody().velocity.magnitude <= 0.1f))) { startedAttack = false; endedAttack = false; enemy.ResetAnimatorBools(enemy.anim); enemy.anim.SetBool("chase", true); ToChaseState(); } else if (enemy.PlayerInFieldOfView() && enemy.PlayerIsWithinStrikingDistance() && (endedAttack || (enemy.GetRigidBody().velocity.magnitude >= 0 && enemy.GetRigidBody().velocity.magnitude <= 0.1f))) { startedAttack = false; endedAttack = false; enemy.ResetAnimatorBools(enemy.anim); enemy.anim.SetBool("engarde", true); ToEngardeState(); } else { startedAttack = false; endedAttack = false; enemy.ResetAnimatorBools(enemy.anim); enemy.anim.SetBool("patrol", true); ToPatrolState(); } }
void Updating() { //dodge sword enemy.PlaySound(enemy.enemyAudio, enemy.attackSound); enemy.AvoidSword(); //TRANSITIONS GO HERE if (!enemy.PlayerInFieldOfView() && !enemy.PlayerIsWithinStrikingDistance() && !enemy.PlayerDetected()) { enemy.ResetAnimatorBools(enemy.anim); enemy.anim.SetBool("patrol", true); ToPatrolState(); } else { enemy.ResetAnimatorBools(enemy.anim); enemy.anim.SetBool("chase", true); ToChaseState(); } }