using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

public abstract class DegreableObject : MonoBehaviour
{
    public float angle = 378.475f;
    public float backAngle = 198.5f;
    public void Move(float distance)
    {
        if (distance > 0f)
        {
            MoveForward(distance);
        }
        else if (distance < 0f)
        {
            MoveBack(distance);
        }
    }

    public void MoveForward(float distance)
    {
        transform.position += Vector2Extensions.AngleVector2(angle).ToVector3() * distance;
    }
    public void MoveBack(float distance)
    {
        transform.position -= Vector2Extensions.AngleVector2(backAngle).ToVector3() * distance;
    }
    public void MoveLocal(float distance)
    {
        if (distance > 0f)
        {
            MoveForwardLocal(distance);
        }
        else if (distance < 0f)
        {
            MoveBackLocal(distance);
        }
    }

    public void MoveForwardLocal(float distance)
    {

        transform.localPosition += Vector2Extensions.AngleVector2(angle).ToVector3() * distance;
    }
    public void MoveBackLocal(float distance)
    {
        transform.localPosition -= Vector2Extensions.AngleVector2(backAngle).ToVector3() * distance;
    }
}
