// Start is called before the first frame update private void FixedUpdate() { _shootingController.Shoot(_shootDirections); var inputVector = Vector2.zero; switch (_moveDirections) { case PlayerDirections.None: break; case PlayerDirections.Up: ApplyUp(); break; case PlayerDirections.Down: ApplyDown(); break; case PlayerDirections.Left: ApplyLeft(); break; case PlayerDirections.Right: ApplyRight(); break; case PlayerDirections.UpLeft: ApplyUp(); ApplyLeft(); break; case PlayerDirections.UpRight: ApplyUp(); ApplyRight(); break; case PlayerDirections.DownLeft: ApplyDown(); ApplyLeft(); break; case PlayerDirections.DownRight: ApplyDown(); ApplyRight(); break; default: throw new ArgumentOutOfRangeException(); } _rigidbody.MovePosition((Vector2)_rigidbody.transform.position + (_moveSpeed * Time.fixedDeltaTime * inputVector.normalized)); void ApplyRight() => inputVector.x = 1; void ApplyLeft() => inputVector.x = -1; void ApplyDown() => inputVector.y = -1; void ApplyUp() => inputVector.y = 1; }
private void Update() { if (Input.GetMouseButtonDown(0)) { if (shooting.Shoot()) { GameManager.Instance.DonePlayerTurn(); } } }
private void TryShoot() { //Check line of sight var direction = (PlaneController.Instance.transform.position - m_towerEye.position).normalized; var player = Physics.Raycast(m_towerEye.position, direction, m_playerLayer); if (!player) { return; } m_shootingController.Shoot(); }
private void ShootingLogic() { if (Input.GetButtonDown("Fire1")) { playerShootingController.Shoot(); Debug.Log("Disparo"); } if (Input.GetMouseButtonDown(1)) { playerShootingController.CombineBullets(); Debug.Log("Combino balas"); } }
void Update() { if (target) { Move(); if (properties.stopDistance >= playerDistance) { movementController.Rotate(playerDirection); if (Time.time >= attackTime) { shootingController.Shoot(properties.projectileSpeed, properties.damage); attackTime = Time.time + properties.timeBetweenAttack; } } } }
void Update() { movementController.Rotate(playerInput.DirectionVector); movementController.Move(playerInput.MovementVector, properties.speed); if (playerInput.ShootAction && Time.time >= attackTime) { shootingController.Shoot(properties.projectileSpeed, properties.damage); attackTime = Time.time + properties.timeBetweenAttack; } if (playerInput.DashAction) { Vector2 direction = playerInput.MovementVector != Vector2.zero ? playerInput.MovementVector : (Vector2)transform.up; movementController.Dash(direction, properties.speed, ref dashTime); } else { dashTime = properties.dashTime; } }
// Update is called once per frame private void Update() { if (!_controller.IsReady) { return; } var direction = 360f / _bulletCount; var directions = new List <float> { 0f }; for (int i = 1; i < _bulletCount; i++) { directions.Add(direction * i); } _controller.Shoot(directions); }
private void Update() { if (!Input.GetKey(KeyCode.Space)) { m_shootingController.Shoot(); m_currentMoveSpeed = m_moveSpeedMin; } else { m_currentMoveSpeed = m_moveSpeedMax; } if (Input.GetKeyDown(KeyCode.Space)) { m_circleParticles.Play(); m_camera.Shake(); } var horizontalInput = Input.GetAxisRaw("Horizontal"); var verticalInput = Input.GetAxisRaw("Vertical"); float roll = 0; if (horizontalInput > 0) { roll = -45f; } else if (horizontalInput < 0) { roll = 45f; } m_pitchYawRoll.z = Mathf.Lerp(m_pitchYawRoll.z, roll, m_rollLerpSpeed * Time.deltaTime); m_pitchYawRoll.y += horizontalInput * Time.deltaTime * m_horizontalSpeed; m_pitchYawRoll.x += verticalInput * Time.deltaTime * m_verticalSpeed; transform.eulerAngles = m_pitchYawRoll; }
public void ShootAtPlayer() { shooting.Shoot(); }
/** * <summary>Player shoots on the target</summary> **/ private void Shoot() { ArcherAnimator.State = ArcherAnimationStateEnum.Shooting; ShootingController.Shoot(); }