Ejemplo n.º 1
0
        PlayerCommand generatePlayerCommandWithNoBoom()
        {
            PlayerCommand playerCommand = new PlayerCommand();
            float         x_input       = unityService.GetAxisRaw("Horizontal");
            float         y_input       = unityService.GetAxisRaw("Vertical");

            if (perivousCommand.IsShooting)
            {
                playerCommand.IsShooting = !unityService.GetKeyUp(shootKey);
            }
            else
            {
                playerCommand.IsShooting = unityService.GetKeyDown(shootKey);
            }

            if (perivousCommand.IsFocused)
            {
                playerCommand.IsFocused = !unityService.GetKeyUp(focusedKey);
            }
            else
            {
                playerCommand.IsFocused = unityService.GetKeyDown(focusedKey);
            }

            if (perivousCommand.X_Input != x_input)
            {
                playerCommand.X_Input = x_input;
            }
            else
            {
                playerCommand.Y_Input = y_input;
            }

            return(playerCommand);
        }
Ejemplo n.º 2
0
 private void Update()
 {
     change   = Vector2.zero;
     change.x = unityService.GetAxisRaw("Horizontal");
     change.y = unityService.GetAxisRaw("Vertical");
     if (CrossPlatformInputManager.GetButtonDown("attack"))
     {
         StartCoroutine(AttackCo());
     }
     UpdateAnimationAndMove();
 }
Ejemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        _direction = _movement.Calculate2D(_unityService.GetAxisRaw("Horizontal"), _unityService.GetAxisRaw("Vertical"), _unityService.GetDeltaTime()).normalized;


        animator.SetFloat("Horizontal", _direction.x);
        animator.SetFloat("Vertical", _direction.y);
        animator.SetFloat("Magnitude", _direction.magnitude);


        Attack();
        HandleAnimation(animator, _rb);
    }
Ejemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        directionFace = _movement.Calculate2D(_unityService.GetAxisRaw("Horizontal"), _unityService.GetAxisRaw("Vertical"), _unityService.GetDeltaTime());
        transform.Translate(directionFace);



        Vector2 input = new Vector2(_unityService.GetAxisRaw("Horizontal"), _unityService.GetAxisRaw("Vertical"));

        _animator.SetFloat("Horizontal", input.x);
        _animator.SetFloat("Vertical", input.y);
        _animator.SetFloat("Magnitude", input.magnitude);


        Attack();
        HandleAnimation(_animator, _rigidbody2D);
    }