Exemplo n.º 1
0
        private void Move(Vector2 dir)
        {
            if (_dead)
            {
                return;
            }

            if (Mathf.Abs(dir.x) > 0)
            {
                _dir = Mathf.Sign(dir.x);
                SetSide();
            }

//            if(transform.eulerAngles.magnitude > 0)
//                transform.eulerAngles = Vector3.zero;

            _charged = Time.time - _shootHoldingTime >= ChargeTime && _shootHolding;

            _physics.Move(dir, Speed);
            _animation.Charged(_charged);
            Sfx.Charged(_charged);
            _animation.SetSpeed(_physics.Speed());
            Sfx.SetSpeed(_physics.Speed());
            _animation.SetSliding(_physics.Sliding);
            Sfx.SetSliding(_physics.Sliding);
            _animation.Dash(_physics.Dashing);
            Sfx.Dash(_physics.Dashing);

            if (transform.position.y < YKill)
            {
                OnDie();
            }
        }