//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(); } }
//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(); }
private void DoResult(DamageResult Res) { if (Res.mSound != null) { Vector3 position = Camera.main.transform.position + (Res.mAffectedObject.transform.position - Camera.main.transform.position).normalized * 5f; AudioSource.PlayClipAtPoint(Res.mSound, position, GameData.mGameSettings.mSoundVolume); } switch (Res.mEffect) { case ObjectEffects.DisableObject: Res.mAffectedObject.SetActiveRecursively(state: false); break; case ObjectEffects.ShieldWallEffect: { ShieldWall shieldWall = null; if ((bool)(shieldWall = (Res.mAffectedObject.GetComponent(typeof(ShieldWall)) as ShieldWall))) { shieldWall.KillTrigger(); } break; } case ObjectEffects.SpawnObject: if (Res.mAffectedObject != null) { UnityEngine.Object.Instantiate(Res.mAffectedObject, base.transform.position + Res.mOffsetPosition, Quaternion.identity); } break; } }