/// <summary> /// The run method, runs your example design pattern /// and gathers output for the Console in the /// passed in StringBuilder. /// </summary> /// <param name="builder">The StringBuilder to gather output for the Console.</param> public override void Run(StringBuilder builder) { base.Run(builder); lock (builder) { var meleeRate = ((int)(_gun.MeleeRate * 1000)); var shotRate = ((int)(_gun.ShotRate * 1000)); _gun.Melee(); Thread.Sleep(meleeRate); _gun.Shoot(); Thread.Sleep(shotRate); _gun.Shoot(); Thread.Sleep(shotRate); _gun.Shoot(); Thread.Sleep(shotRate); _gun.Melee(); Thread.Sleep(meleeRate); var gun = _gun as IBurstFireGun; if (gun != null) { gun.IsBurstFireEngaged = false; } _gun.Shoot(); Thread.Sleep(shotRate); _gun.Shoot(); _gun.Reload(_ammunitionContainer); } }
public void Reload() { if (_equippedGun == null) { return; } _equippedGun.Reload(); }
protected void AttackSeq() { if (_canInteract) { return; } _animation.AttackSeq(); _weapon?.Reload(); }
///────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── /// <summary> /// If the Weapon is a Gun Reload /// </summary> public virtual void PistolReload() { if (Gun.Reload()) //If the Gun can Reload Activate the Reload Animation and Reload { RC.SetAction((RC.Active_IMWeapon.RightHand ? WeaponActions.ReloadRight : WeaponActions.ReloadLeft)); //Set the Animator to the Reload Animations } else { RC.SetAction(WeaponActions.Idle); } }
/// <summary>If the Weapon is a Gun Reload </summary> public virtual void PistolReload() { if (Gun.Reload()) //If the Gun can Reload Activate the Reload Animation and Reload { RC.WeaponAction = RC.Weapon_is_RightHand ? WA.ReloadRight : WA.ReloadLeft; //Set the Animator to the Reload Animations } else { RC.WeaponAction = WA.Idle; } }
private void SetBulletBySettingsIndex(int index) { _curentBulletIndex = index; if (!_isArmed) { return; } var newBullet = new SimpleBullet(_bulletTypes[index]); _weapon.Reload(newBullet); _curentBulletTypeName = _bulletTypes[index].name; Debug.Log("<color=green>Bullet type switched successful</color>"); }
public void Shoot(Vector3 muzzlePosition, Vector3 direction) { if (!m_gun.Shoot()) { m_gun.Reload(); return; } RaycastHit hitInfo; if (!m_unityService.RayCast(muzzlePosition, direction, out hitInfo)) { return; } hitInfo.transform.GetComponent <IDamage>().Take(m_gun.Config.Damage); }