예제 #1
0
    // 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;
    }
예제 #2
0
 private void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         if (shooting.Shoot())
         {
             GameManager.Instance.DonePlayerTurn();
         }
     }
 }
예제 #3
0
    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();
    }
예제 #4
0
    private void ShootingLogic()
    {
        if (Input.GetButtonDown("Fire1"))
        {
            playerShootingController.Shoot();
            Debug.Log("Disparo");
        }

        if (Input.GetMouseButtonDown(1))
        {
            playerShootingController.CombineBullets();
            Debug.Log("Combino balas");
        }
    }
예제 #5
0
 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;
             }
         }
     }
 }
예제 #6
0
 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;
     }
 }
예제 #7
0
    // 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);
    }
예제 #8
0
    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;
    }
예제 #9
0
 public void ShootAtPlayer()
 {
     shooting.Shoot();
 }
예제 #10
0
        /**
         * <summary>Player shoots on the target</summary>
         **/
        private void Shoot()
        {
            ArcherAnimator.State = ArcherAnimationStateEnum.Shooting;

            ShootingController.Shoot();
        }