void Awake() { enemyAnimator = GetComponent <EnemyAnimator>(); navMeshAgent = GetComponent <NavMeshAgent>(); target = GameObject.FindWithTag(Tags.PLAYER).transform; enemySounds = GetComponentInChildren <EnemySounds>(); }
public void playSound(EnemySounds soundType) { if (bSoundEnabled && asEnemySounds[(int)soundType].isPlaying == false) { asEnemySounds[(int)soundType].Play(); } }
public void PlaySound(EnemySounds sound) { switch (sound) { case EnemySounds.Attack: //enemySoundbank.enemyAttack.PlayDefault(); break; case EnemySounds.GetHit: enemySoundbank.enemyDamaged.PlayDefault(); break; case EnemySounds.InRange: enemySoundbank.enemyInRangeBrute.PlayDefault(); // fix - this shouldn't happen on shooters, i think break; case EnemySounds.Spawned: enemySoundbank.enemySpawn.PlayDefault(); break; case EnemySounds.Stunned: enemySoundbank.enemyStunned.PlayDefault(); break; case EnemySounds.Dead: enemySoundbank.enemyKilled.PlayDefault(); break; default: break; } }
// Use this for initialization public void Start() { // Find EnemySounds GameObject _SoundStorage = GameObject.FindGameObjectWithTag("Sounds").GetComponent <EnemySounds>(); // Find Player GameObject _Player = GameObject.FindGameObjectWithTag("Player"); _ripple = GameObject.FindGameObjectWithTag("RipplePlane").GetComponent <rippleSharp>();; }
public bool isPlaying(EnemySounds sound) { if (asEnemySounds[(int)sound].isPlaying) { return(true); } else { return(false); } }
// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); player = GameObject.FindGameObjectWithTag("Player").transform; rend = GetComponent <SpriteRenderer>(); playerHealth = player.GetComponent <PlayerHealth>(); runSpeed = runDefSpeed; healthBar = GetComponent <EnemyHealthBarScript>(); healthBar.InitHealthBarValues(health); sounds = GetComponent <EnemySounds>(); }
// Start is called before the first frame update void Start() { sprite = GetComponent <SpriteRenderer>(); anim = GetComponent <Animator>(); startPos = transform.position; rb = GetComponent <Rigidbody2D>(); playerGO = GameObject.FindGameObjectWithTag("Player"); playerHealth = playerGO.GetComponent <PlayerHealth>(); playerTransform = playerGO.transform; healthBar = GetComponent <EnemyHealthBarScript>(); healthBar.InitHealthBarValues(health); sounds = GetComponent <EnemySounds>(); }
void Start() { base.Initialize(); onGround = true; audioSource = GetComponent <AudioSource> (); enemySounds = GetComponent <EnemySounds> (); filling = GetComponent <EnemySpriteManager> ().filling; border = GetComponent <EnemySpriteManager> ().border; idleFillSprite = filling.sprite; idleBorderSprite = border.sprite; }
void Awake() { if (isAnimal) { enemyAnimator = GetComponent <EnemyAnimator>(); enemyController = GetComponent <EnemyController>(); navMeshAgent = GetComponent <NavMeshAgent>(); enemySounds = GetComponentInChildren <EnemySounds>(); } if (isPlayer) { playerStats = GetComponent <PlayerStats>(); } }
void Start() { lastShotTime = Time.time; rb = GetComponent <Rigidbody2D> (); player = GameObject.FindGameObjectWithTag("Player").transform; audioSource = GetComponent <AudioSource> (); enemySounds = GetComponent <EnemySounds> (); enemyHealth = GetComponent <EnemyHealth> (); filling = GetComponent <EnemySpriteManager> ().filling; border = GetComponent <EnemySpriteManager> ().border; idleSpriteFill = filling.sprite; idleSpriteBorder = border.sprite; }
/* * FUNCTION: Stops all sounds except background music */ public void stopAllSounds() { for (int i = 0; i < CharacterSounds.GetValues(typeof(CharacterSounds)).Length; i++) { asCharacterSounds [i].Stop(); } for (int i = 0; i < PowerupSounds.GetValues(typeof(PowerupSounds)).Length; i++) { asPowerupSounds [i].Stop(); } for (int i = 0; i < MenuSounds.GetValues(typeof(MenuSounds)).Length; i++) { asMenuSounds [i].Stop(); } for (int i = 0; i < EnemySounds.GetValues(typeof(EnemySounds)).Length; i++) { asEnemySounds [i].Stop(); } bFootstepsPlaying = false; }
private void Start() { walkParticle = transform.Find("walk").GetComponent <ParticleSystem>(); walkParticle.Stop(); Target = GameObject.FindGameObjectWithTag("Player"); navAgent = GetComponent <NavMeshAgent>(); enemyAnimation = GetComponent <EnemyAnimation>(); CurrentState = new ThrowState(); RgdBody = GetComponent <Rigidbody>(); if (!throwingBall) { throwingBall = UnityEngine.Resources.Load <GameObject>("StrandBall"); } enemySound = GetComponent <EnemySounds>(); if (Target == null) { Destroy(this); } }
private void Start() { _renderer = GetComponent <Renderer>(); _originalColor = _renderer.material.color; _sound = GameObject.FindGameObjectWithTag("Sounds").GetComponent <EnemySounds>(); }
public bool isPlaying (EnemySounds sound) { if (asEnemySounds [(int)sound].isPlaying) return true; else return false; }
public void stopSound (EnemySounds soundType) { asEnemySounds [(int)soundType].Stop (); }
public void playSound (EnemySounds soundType) { if (bSoundEnabled && asEnemySounds [(int)soundType].isPlaying == false) asEnemySounds [(int)soundType].Play (); }
void Start() { #region Use the GravMultiplier to adjust enemy speeds accordingly. WalkSpeed = WalkSpeed * GravMultiplier; TurningSpeed = TurningSpeed * GravMultiplier; #endregion agent = GetComponent <NavMeshAgent>(); agent.speed = WalkSpeed; defaultStoppingDistance = agent.stoppingDistance; enemySounds = GetComponent <EnemySounds>(); Player = GameObject.FindGameObjectWithTag("Player"); // The player is found in the scene automatically and set here. disturbanceCam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>(); // Find the main camera and set it here. NOTE: This will be removed soon. Should only be found in my test scene. _musicManager = GameObject.FindWithTag("MusicManager").GetComponent <MusicManager>(); // Get access to the enemy object's children. foreach (Transform child in transform) { if (child.tag == "EnemyPOV" && POV_GO == null) { POV_GO = child.gameObject; // Get access to the enemy's POV. } if (child.tag == "BackupCall" && BackupCallZone == null) { BackupCallZone = child.gameObject.GetComponent <SphereCollider>(); } if (child.tag == "SurveyPoint") { surveyPoints.Add(child); // Get the enemy's survey points. } if (child.tag == "PlayerTracker" && PlayerTracker == null) { PlayerTracker = child.GetComponent <PlayerTracker>(); // Get the enemy's player tracker script. } if (child.tag == "HitScanner") { HitScanner = child.GetComponent <HitScanner>(); } } POV = POV_GO.GetComponent <Camera>(); if (Player != null) { playerRenderer = Player.transform.Find("Protagonist/Mesh").GetComponent <Renderer>(); } movement = GetComponent <EnemyMovement>(); if (movement != null) { movement.enabled = false; } // Get Enemy Flashlight. Flashlight = transform.Find("PAC-AUG/Flashlight Attachment").GetComponent <Light>(); BackupCallZone.enabled = false; // Disable the backup call zone since it should only be active when the enemy is alerted. #region Set the enemy's patrol route, if we haven't given them one, assign them a post. if (GetComponent <Patrol>() != null) // Set the enemy's patrol route if we have given them one in the editor. { patrolRoute = GetComponent <Patrol>(); // NOTE: We can only set enemy phase directly (Like the line below.) in this Start method. Everywhere else, we should use the SetPhase(newPhase) method. enemyPhase = Phase.PATROL; UpdateBehaviour(); } // If we haven't given them a patrol route, assign their starting location as their post. (An area they've been assigned to keep watch at.) else { post = GetComponent <Transform>().position; // REMINDER: Everywhere else, we use the SetPhase(newPhase) method. enemyPhase = Phase.VIGIL; vigil = true; UpdateBehaviour(); } #endregion }
public void stopSound(EnemySounds soundType) { asEnemySounds[(int)soundType].Stop(); }