示例#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);
     }
 }
示例#2
0
 public void Reload()
 {
     if (_equippedGun == null)
     {
         return;
     }
     _equippedGun.Reload();
 }
示例#3
0
        protected void AttackSeq()
        {
            if (_canInteract)
            {
                return;
            }
            _animation.AttackSeq();

            _weapon?.Reload();
        }
示例#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);
     }
 }
示例#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>");
        }
示例#7
0
文件: Enemy.cs 项目: Miceroy/GGJ2020
    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);
    }