Exemplo n.º 1
0
    protected virtual void Update()
    {
        var targeteVelocity = Vector3.zero;

        targeteVelocity.x = Input.GetAxisRaw("Horizontal");
        targeteVelocity.y = Input.GetAxisRaw("Vertical");

        if (targeteVelocity.magnitude > 0.01f)
        {
            targeteVelocity = targeteVelocity.normalized * Speed;
        }

        Velocity = D2D_Helper.Dampen3(Velocity, targeteVelocity, Dampening, Time.deltaTime, 0.1f);

        transform.Translate(Velocity * Time.deltaTime);
    }