using System.Collections;
using System.Collections.Generic;
using UnityEngine;

using JumpTower;

namespace JumpTower
{
    public class EnemyMovment : MonoBehaviour
    {
        [SerializeField] private Transform target;  // The target point or object to rotate around
        [SerializeField] private float rotationSpeed = 50f;// Rotation speed
        private float fixedRotationSpeed;
        private Vector3 rotationAxis = Vector3.up;  // Axis around which to rotate (default is Y-axis)

        private void Start()
        {
            fixedRotationSpeed = rotationSpeed;
        }
        void Update()
        {
            // Rotate the object around the target position, with the given axis and speed
            transform.RotateAround(target.position, rotationAxis, rotationSpeed * Time.deltaTime);
        }

        public void changeSpeedRotation(float a)
        {
            if (a > 1)
                a = 1;
            else
                a = -1;
            rotationSpeed = -1 * a * fixedRotationSpeed;
        }
    }
}
