Ejemplo n.º 1
0
 /// <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);
     }
 }
Ejemplo n.º 2
0
 public void Reload()
 {
     if (_equippedGun == null)
     {
         return;
     }
     _equippedGun.Reload();
 }
Ejemplo n.º 3
0
        protected void AttackSeq()
        {
            if (_canInteract)
            {
                return;
            }
            _animation.AttackSeq();

            _weapon?.Reload();
        }
Ejemplo n.º 4
0
 ///──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 /// <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);
     }
 }
Ejemplo n.º 5
0
 /// <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>");
        }
Ejemplo n.º 7
0
    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);
    }