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

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

            gun = GunFactory.CreateOne(2);
            gun.Shoot();
        }
コード例 #3
0
 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();
            }
        }
コード例 #9
0
    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);
 }