예제 #1
0
        protected override void ProcessHandling(MovementSystem movementSystem)
        {
#if UNITY_EDITOR
            movementSystem.LateralMovement(Input.GetAxis("Horizontal") * Time.deltaTime);
            movementSystem.LongitudinalMovement(Input.GetAxis("Vertical") * Time.deltaTime);
#endif
            movementSystem.LateralMovement(Joystick.Horizontal / 5f * Time.deltaTime);
            movementSystem.LongitudinalMovement(Joystick.Vertical / 5f * Time.deltaTime);
            //bounds
            var pos = Camera.main.WorldToViewportPoint(transform.position);
            pos.x = Mathf.Clamp(pos.x, _minXBound, _maxXBound);
            pos.y = Mathf.Clamp(pos.y, _minYBound, _maxYBound);
            transform.position = Camera.main.ViewportToWorldPoint(pos);
        }
 //обработка движения
 protected override void ProcessHandling(MovementSystem movementSystem)
 {
     movementSystem.LongitudinalMovement(Time.deltaTime);                            //по оси Y
     // по оси X
     if (_isMovingRight)                                                             // вправо
     {
         if ((transform.position - _initialPosition).x < _horizontalMovementRange.y) // проверка на достижение левой границы
         {
             movementSystem.LateralMovement(Time.deltaTime * Vector3.left.x);
         }
         else
         {
             _isMovingRight = false;
         }
     }
     else //влево
     {
         if ((transform.position - _initialPosition).x > _horizontalMovementRange.x) // проверка на достижение правой границы
         {
             movementSystem.LateralMovement(Time.deltaTime * Vector3.right.x);
         }
         else
         {
             _isMovingRight = true;
         }
     }
 }
예제 #3
0
 protected override void ProcessHandling(MovementSystem movementSystem)
 {
     movementSystem.LongitudinalMovement(Time.deltaTime);
     if (rotate)                                                  // РАЗРЕШЕНИЕ НА ПОВОРОТ
     {
         movementSystem.RoteteToTarget(enemytarget, rotateSpeed); // ПОВОРОТ НА ЦЕЛЬ
     }
 }
예제 #4
0
 protected override void ProcessHandling(MovementSystem movementSystem)
 {
     movementSystem.LongitudinalMovement(Time.deltaTime);
     if (newTimer != 0)
     {
         HorizontalMove();
         movementSystem.LateralMovement(direction * Time.deltaTime / 5);
     }
 }
        //Кастомное движение объекта
        protected override void ProcessHandling(MovementSystem movementSystem)
        {
            if (!GameAreaHelper.IsAllObjectInGameplayArea(gameObject.transform, _collider2D.bounds))
            {
                _isShipTouchedBorder = !_isShipTouchedBorder;
            }

            movementSystem.LongitudinalMovement(Time.deltaTime);
            movementSystem.LateralMovement(Time.deltaTime, _isShipTouchedBorder);
        }
예제 #6
0
    protected override void ProcessHandling(MovementSystem movementSystem)
    {
        switch (_movementBehaviour)
        {
        case MovementBehaviour.Linear:
            movementSystem.LongitudinalMovement(Time.deltaTime);
            break;

        case MovementBehaviour.Sinusoid:
            movementSystem.LongitudinalMovement(Time.deltaTime);
            movementSystem.LateralMovement((float)Mathf.Sin(transform.position.y));
            break;

        case MovementBehaviour.Random:
            movementSystem.LongitudinalMovement(Time.deltaTime);
            movementSystem.LateralMovement(Random.Range(-1, 2) * Time.deltaTime);
            break;
        }
    }
    private float _elapsedTimeLaterialMovement;     // время в течении которого корабль движется боком

    protected override void ProcessHandling(MovementSystem movementSystem)
    {
        movementSystem.LongitudinalMovement(Time.deltaTime);

        if (!_complicatedMovement)                  // если сложного движения нет, выходим из метода минуя логику бокового движения
        {
            return;
        }

        ProcessLateralMovement(movementSystem);     // процесс бокового движения
    }
예제 #8
0
    protected override void ProcessHandling(MovementSystem movementSystem)
    {
        movementSystem.LongitudinalMovement(Time.deltaTime);

        // Меняем направление движения противника.

        if (MoveRight)
        {
            movementSystem.LateralMovement(Time.deltaTime);
        }
        if (MoveLeft)
        {
            movementSystem.LateralMovement(Time.deltaTime * -1);
        }
    }
예제 #9
0
 //движение врага по прямой (по направлению корабля)
 protected override void ProcessHandling(MovementSystem movementSystem)
 {
     movementSystem.LongitudinalMovement(Time.deltaTime);
 }
 // Both longitudinal and lateral movements
 protected override void ProcessHandling(MovementSystem movementSystem)
 {
     movementSystem.LongitudinalMovement(Time.deltaTime);
     movementSystem.LateralMovement(Time.deltaTime * _evasionDirection);
 }
 protected void ProcessHandling()
 {
     _moveController.LongitudinalMovement(Time.deltaTime);
 }
        bool rocketReadyToFire = true;          //Готовность ракет

        protected override void ProcessHandling(MovementSystem movementSystem)
        {
            movementSystem.LateralMovement(Input.GetAxis("Mouse X") * Time.deltaTime);
            movementSystem.LongitudinalMovement(Input.GetAxis("Mouse Y") * Time.deltaTime);
        }
예제 #13
0
 protected override void Move(MovementSystem movementSystem)
 {
     movementSystem.LongitudinalMovement(-Time.deltaTime);
 }
 protected override void ProcessHandling(MovementSystem movementSystem)
 {
     movementSystem.LongitudinalMovement(Time.deltaTime);
     movementSystem.SetPosition(new Vector2(Mathf.Sign(startArguement) * amplitude * Mathf.Sin(startArguement + transform.position.y / frequency),
                                            transform.position.y));
 }
예제 #15
0
 public void Update()
 {
     _movementSystem.LongitudinalMovement(Time.deltaTime);
 }