Exemplo n.º 1
0
    private void Update()
    {
        if (!stunned)
        {
            //float translation = Input.GetAxis(_Joystick) * moveSpeed;
            float translation = Input.GetAxis("Horizontal") * moveSpeed;
            if (translation < 0)
            {
                _playerAttack.ChangeHitbox("left");
            }
            else if (translation > 0)
            {
                _playerAttack.ChangeHitbox("right");
            }

            translation        *= Time.deltaTime;
            transform.position += new Vector3(translation, 0, 0);

            _playerJump.Jump(jump);
            _playerAttack.Attack(punch);
        }
        if (stunned)
        {
            if (t == null)
            {
                t = Timer.StartNew(gameObject, 1f, ChangeStun);
            }
        }
    }
Exemplo n.º 2
0
    private void Update()
    {
        if (!stunned)
        {
            translation = Input.GetAxis(_joystick) * moveSpeed;
            //translation = Input.GetAxis("Horizontal") * moveSpeed;
            if (translation < 0)
            {
                _playerAttack.ChangeHitbox("left");
            }
            else if (translation > 0)
            {
                _playerAttack.ChangeHitbox("right");
            }

            translation        *= Time.deltaTime;
            transform.position += new Vector3(translation, 0, 0);

            _playerJump.Jump(jump);
            _playerAttack.Attack(punch);
        }
        if (stunned)
        {
            if (t == null)
            {
                t = Timer.StartNew(gameObject, 1f, ChangeStun);
            }
        }
        if (shielded)
        {
            if (t == null)
            {
                shield = Instantiate(shield, new Vector2(transform.position.x, transform.position.y), Quaternion.identity);
                t      = Timer.StartNew(gameObject, 5f, ChangeShielded);
            }

            shield.transform.position = transform.position;
        }
    }