private void Awake() { if (_instance != null && _instance != this) { Destroy(this.gameObject); } else { _instance = this; } }
void Awake() { if (singleton != null) { enabled = false; Destroy(this); return; } singleton = this; ouchSources = ouchSourcesObj.GetComponents <AudioSource>(); }
void Start() { if (enemySpawner != null) { enemySpawner.numbOfEnemies++; } rb2d = GetComponent <Rigidbody2D>(); state = stateMachine.roming; ogMoveSpeed = moveSpeed; enemySoundManager = GetComponent <EnemySoundManager>(); player = GameObject.FindGameObjectWithTag("Player"); }
public void BeenHit(bool wasWindballOrDrop, int charaID) { if (anim != null && hasParam) { anim.ResetTrigger("Hurt"); anim.SetTrigger("Hurt"); } StopCoroutine("SendFlyingCoro"); currentChara = PlayerManager.GetPlayer(charaID); SendFlying(wasWindballOrDrop); if (!infiniteHealth) { if (useBigOuchSounds) { EnemySoundManager.PlayBigOuchSound(); } else { EnemySoundManager.PlayOuchSound(); } } StopCoroutine("HitFlash"); StartCoroutine("HitFlash"); }
public void SetSoundManager(EnemySoundManager sm) { this.sm = sm; }
private void Awake() { instance = this; DontDestroyOnLoad(this); }
// public void Death() { if (enemyBarrier) { enemyBarrier.EnemyKilled(); } if (anim != null && hasParam) { anim.ResetTrigger("Hurt"); anim.SetTrigger("Hurt"); } if (useBigOuchSounds) { EnemySoundManager.PlayBigOuchSound(); } else { EnemySoundManager.PlayOuchSound(); } StopCoroutine("HitFlash"); StartCoroutine("HitFlash"); if (icodescript != null) { icodescript.enabled = false; } this.GetComponent <Collider>().enabled = false; if (anim) { anim.SetBool("Die", true); } if (icodescript == null) { GameObject.FindWithTag("FXPool").GetComponent <BerryPFX>().PlayEffect(3, this.transform.position, this.gameObject, Vector3.zero, false); } else { GameObject.FindWithTag("FXPool").GetComponent <BerryPFX>().PlayEffect(3, this.transform.position, icodescript.gameObject, Vector3.zero, true); } if (rb) { rb.isKinematic = false; rb.useGravity = true; } if (sound != null && dieSound != null) { sound.clip = dieSound; sound.Play(); } StartCoroutine(Killed()); // counter for trophies if (isDark) { // int darkKilledEnemies; if (!PlayerPrefs.HasKey("DarkEnemiesKilledCount")) { PlayerPrefs.SetInt("DarkEnemiesKilledCount", 0); darkKilledEnemies = 0; } else { darkKilledEnemies = PlayerPrefs.GetInt("DarkEnemiesKilledCount"); } // if (darkKilledEnemies < 100) { darkKilledEnemies++; PlayerPrefs.SetInt("DarkEnemiesKilledCount", darkKilledEnemies); // if (PlayerPrefs.HasKey("DarkEnemiesAchiev")) { if (PlayerPrefs.GetInt("DarkEnemiesAchiev") == 0 && darkKilledEnemies >= 100) { SetDarkAchievs(); } } else { PlayerPrefs.SetInt("DarkEnemiesAchiev", 0); } } else { SetDarkAchievs(); } } else { // int normalKilledEnemies; if (!PlayerPrefs.HasKey("NormalEnemiesKilledCount")) { PlayerPrefs.SetInt("NormalEnemiesKilledCount", 0); normalKilledEnemies = 0; } else { normalKilledEnemies = PlayerPrefs.GetInt("NormalEnemiesKilledCount"); } // if (normalKilledEnemies < 100) { normalKilledEnemies++; PlayerPrefs.SetInt("NormalEnemiesKilledCount", normalKilledEnemies); // if (PlayerPrefs.HasKey("NormalEnemiesAchiev")) { if (PlayerPrefs.GetInt("NormalEnemiesAchiev") == 0 && normalKilledEnemies >= 100) { SetNormalAchievs(); } } else { PlayerPrefs.SetInt("NormalEnemiesAchiev", 0); } } else { SetNormalAchievs(); } } }
private void Awake() { enemySoundManager = FindObjectOfType <EnemySoundManager>(); }
public virtual void Awake() { enemySoundManager = Instantiate(enemySoundManagerClass, transform.localPosition, transform.localRotation, this.transform); }
private void Awake() { enemySoundManager = GetComponentInParent <EnemySoundManager>(); }
void Start() { source = GetComponent<AudioSource>(); esm = GameObject.FindGameObjectWithTag("GameController").GetComponent<EnemySoundManager>(); }