示例#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);
     }
 }
        static void Main(string[] args)
        {
            IGun gun = null;

            gun = GunFactory.CreateOne(1);
            gun.Shoot();

            gun = GunFactory.CreateOne(2);
            gun.Shoot();
        }
 void onGunButtonPressed()
 {
     for (int i = 0; i < _iGunList.Count; i++)
     {
         IGun gun = _iGunList[i];
         gun.Shoot();
     }
 }
    public void Excute(IMovable movement, IGun gun)
    {
        ChangeVelocity(movement, Go, Steering, DeltaTime);

        if (Shoot)
        {
            gun.Shoot();
        }
    }
示例#5
0
        private void UpdateGun()
        {
            if (gun == null)
            {
                return;
            }

            gun.Shoot();
        }
示例#6
0
        protected void Attack()
        {
            if (_canInteract)
            {
                return;
            }
            _animation.Attack();

            _weapon?.Shoot(new Ray(lookPoint.position, lookPoint.forward));
        }
示例#7
0
    private void Shooting()
    {
        bool firstPress = Input.GetMouseButtonDown(0);
        bool holding    = Input.GetMouseButton(0);

        if (firstPress || holding)
        {
            var        ray = Camera.main.ViewportPointToRay(new Vector3(.5f, .5f, 0f));
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                m_currentGun?.Shoot(hit.point, firstPress);
            }
            else
            {
                m_currentGun?.Shoot(transform.forward * 1000f + transform.position, firstPress);
            }
        }
    }
示例#8
0
        private void UpdateGun()
        {
            if (gun == null)
            {
                return;
            }

            if (IsFirePressed())
            {
                gun.Shoot();
            }
        }
    private void Update()
    {
        if (!_isNotFoundComponent)
        {
            Vector3 mouseWorldPos = GetMouseWorldPosition(Input.mousePosition);
            //Debug.Log(mouseWorldPos);
            _playerMovement.RotatePlayerAroundPlanet(mouseWorldPos, _speedRotateCoefficient, _maxSpeedRotate);
            _playerMovement.MovePlayerToSelectedPlanet(mouseWorldPos, Input.GetMouseButtonDown(1), _moveSpeed, _layerMask);

            if (Input.GetMouseButtonDown(0))
            {
                _gun.Shoot();
            }
        }
    }
示例#10
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);
    }
示例#11
0
 public void OnShoot()
 {
     currentWeapon.Shoot();
 }
示例#12
0
 public void InitiateFighting()
 {
     _drive.Jump();
     _gun.Shoot();
 }
示例#13
0
 private void HandleShoot()
 {
     gun.Shoot(gunPivot.position, transform.up);
 }