/// <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(); } }
private void UpdateGun() { if (gun == null) { return; } gun.Shoot(); }
protected void Attack() { if (_canInteract) { return; } _animation.Attack(); _weapon?.Shoot(new Ray(lookPoint.position, lookPoint.forward)); }
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); } } }
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(); } } }
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); }
public void OnShoot() { currentWeapon.Shoot(); }
public void InitiateFighting() { _drive.Jump(); _gun.Shoot(); }
private void HandleShoot() { gun.Shoot(gunPivot.position, transform.up); }