//===================================================================== #region Protected methods //===================================================================== /// <summary> /// Sources and initializes component variables. /// </summary> protected void InitVars(IGrenadeDWGO weapon, GameObject attacker) { base.InitVars(weapon, attacker); // Initialise IGrenade variables this.ExplosionDamage = weapon.ExplosionDamage; this.ExplosionEffect = weapon.ExplosionEffect; this.ExplosionEffectDuration = weapon.ExplosionEffectDuration; this.ExplosionForce = weapon.ExplosionForce; this.ExplosionRadius = weapon.ExplosionRadius; this.ExplosionSound = weapon.ExplosionSound; this.ExplosionVolume = weapon.ExplosionVolume; this.VerticalLift = weapon.VerticalLift; }
//===================================================================== #region Public methods //===================================================================== /// <summary> /// Initializes the grenade variables, sets the appropraite GameObject /// rotation, throws the grenade in the desired direction, and starts /// the self destruct countdown. /// </summary> /// <param name="weapon"> /// The weapon script that fired this GameObject. /// </param> /// <param name="attacker"> /// The GameObject initiating the attack/heal. /// </param> /// <param name="direction"> /// The direction that the attack is to be made. /// </param> public void Init(IGrenadeDWGO weapon, GameObject attacker, Vector3 direction) { InitVars(weapon, attacker); StartCoroutine(StartSelfDestructCountdown()); TossGrenade(direction); }