private void Update() { var direction = Input.mousePosition - _camera.WorldToScreenPoint(transform.position); _ship.Rotation(direction); _ship.Move(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), Time.deltaTime); if (Input.GetKeyDown(KeyCode.LeftShift)) { _ship.AddAcceleration(); } if (Input.GetKeyUp(KeyCode.LeftShift)) { _ship.RemoveAcceleration(); } if (Input.GetButtonDown("Fire1")) { var temAmmunition = Instantiate(_bullet, _barrel.position, _barrel.rotation); temAmmunition.AddForce(_barrel.up * _force); } }
private void CheckInputKey(float deltaTime) { _ship.Move(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), deltaTime); if (Input.GetKeyDown(KeyCode.LeftShift)) { _ship.AddAcceleration(); } if (Input.GetKeyUp(KeyCode.LeftShift)) { _ship.RemoveAcceleration(); } if (Input.GetButtonDown("Fire1")) { _weapon.Shooting(); } if (Input.GetKeyDown(KeyCode.F)) { InteractionWithMuffler(); } if (Input.GetButtonDown("Fire2")) { _actionWithLaserAim.CheckStatusLaserAim(); } if (Input.GetKeyDown(KeyCode.I)) { //симуляция залочки стрельбы _data.Weapon.IsWeaponLocked = !_data.Weapon.IsWeaponLocked; _weapon.SetWeaponLocked(_data.Weapon.IsWeaponLocked); } if (Input.GetKeyDown(KeyCode.Y)) { //симуляция залочки прицела _actionWithLaserAim.IsLockedAim = !_actionWithLaserAim.IsLockedAim; _actionWithLaserAim.IsAim = true; } if (Input.GetKeyDown(KeyCode.U)) { //симуляция подбора и потери лазерного прицела InteractionWithLaserAim(_data.Weapon.RedLaserAim); } if (Input.GetKeyDown(KeyCode.Q)) { //реализация шаблона проектирования "Цепочка обязанностей" InteractionWithMufflerChainOfResponsibility(); } }
public void Execute(float deltaTime) { if (Input.GetKeyDown(KeyCode.LeftShift)) { _ship.AddAcceleration(); } if (Input.GetKeyUp(KeyCode.LeftShift)) { _ship.RemoveAcceleration(); } if (Input.GetButtonDown("Fire1")) { _fire.FireBullet(); } }
private void InputAcceleration() { if (Input.GetKeyDown(KeyCode.LeftShift)) { _ship.AddAcceleration(); #if UNITY_EDITOR Debug.Log($"Acceleration On {_ship.Speed}"); #endif } if (Input.GetKeyUp(KeyCode.LeftShift)) { _ship.RemoveAcceleration(); #if UNITY_EDITOR Debug.Log($"Acceleration Off {_ship.Speed}"); #endif } }
private void Update() { var direction = Input.mousePosition - _camera.WorldToScreenPoint(transform.position); _ship.Rotation(direction); if (Input.GetKey(KeyCode.W)) { _ship.MoveUp(); } if (Input.GetKey(KeyCode.S)) { _ship.MoveDown(); } if (Input.GetKey(KeyCode.A)) { _ship.MoveLeft(); } if (Input.GetKey(KeyCode.D)) { _ship.MoveRight(); } if (Input.GetKeyDown(KeyCode.LeftShift)) { _ship.AddAcceleration(); } if (Input.GetKeyUp(KeyCode.LeftShift)) { _ship.RemoveAcceleration(); } if (Input.GetButtonDown("Fire1")) { _ship.Shoot(); } }
public void ProcessUpdate(float deltaTime) { var direction = Input.mousePosition - _camera.WorldToScreenPoint(ship.GameTransform.position); ship.Rotation(direction); ship.Move(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), Time.deltaTime); if (Input.GetKeyDown(KeyCode.LeftShift)) { ship.AddAcceleration(); } if (Input.GetKeyUp(KeyCode.LeftShift)) { ship.RemoveAcceleration(); } if (Input.GetButtonDown("Fire1")) { ship.Shoot(); } }
public void Execute() { var direction = Input.mousePosition - _camera.WorldToScreenPoint(_transform.position); _ship.Rotation(direction); _ship.Move(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), Time.deltaTime); if (Input.GetKeyDown(KeyCode.LeftShift)) { _ship.AddAcceleration(); } if (Input.GetKeyUp(KeyCode.LeftShift)) { _ship.RemoveAcceleration(); } if (Input.GetButtonDown("Fire1")) { _ammunition.Fire(); } }