//Override the DeActivate public void DeActivate() { if (!shieldWall) { shieldWall = transform.GetComponentInChildren <ShieldWall>(); shieldWall.SetHost(this); } Active = false; //shieldWall.gameObject.active = false; shieldWall.gameObject.SetActive(false); //StopCoroutine the gravity. GravityEffect.Stop(); //Set the animation tax to false to reset every time we finish using the shield. activationTax = false; //Stop the animation GetComponent <Animation>().Stop(); animationPlayed = false; //handle the cage. if (ShieldCage) { ShieldCage.SetActive(false); } GetComponent <AudioSource>().Stop(); }
//Overide the Activate public void Activate() { if (!shieldWall) { shieldWall = transform.GetComponentInChildren <ShieldWall>(); shieldWall.SetHost(this); } //Activate the black hole. Active = true; //Activate the object. //shieldWall.gameObject.active = true; shieldWall.gameObject.SetActive(true); //Play Gravity effect GravityEffect.Play(); //We set the activation tax bool to true so we are eligiable to get taxed once the animation finishes. activationTax = true; //Handle the shield animation if (!animationPlayed) { GetComponent <Animation>().Play(); animationPlayed = true; } // TODO: I belive this is why the shield sound is playing when SFX are off in options if (!GetComponent <AudioSource>().isPlaying) { GetComponent <AudioSource>().Play(); } }