protected override void Start() { base.Start(); //initialize references m_Player = GameObject.FindGameObjectWithTag("Player"); m_Nav = GetComponent <NavMeshAgent>(); m_Anim = GetComponent <Animator>(); m_ShatteringScript = GetComponent <ShatteringScript>(); m_Trail = GetComponentsInChildren <TrailRenderer>(); //end of initialization //check if there is a trail renderer in any child objects of this script if (m_Trail.Length != 0) { for (int i = 0; i < m_Trail.Length; i++) { m_Trail[i].enabled = false; } } //set the path finder's stopping distance from the target m_Nav.stoppingDistance = stoppingDistance; //set the initial animation m_Anim.SetBool("IsMoving", true); barrier = GameObject.FindGameObjectWithTag("BossAreaBarrier"); }
protected void BossDeath() { m_Shattering = GetComponent <ShatteringScript>(); m_Dead = true; if (OnDeath != null) { OnDeath(); } m_Shattering.ShatterEffect(); float newVol = Random.Range(m_Volumes - 0.1f, m_Volumes); AudioScript.m_Audio.PlaySoundFx(m_DeathClip, newVol); GameObject.Destroy(gameObject); }