3DTD/Assets/Scripts/Tower/Tower.cs

26 lines
800 B
C#

using UnityEngine;
using UnityEngine.Assertions;
[RequireComponent(typeof(HealthComponent))]
public abstract class Tower : MonoBehaviour
{
[SerializeField] private EditableArc horizontalArc;
[SerializeField] private EditableArc verticalArc;
private HealthComponent healthComp;
// Getters
public Vector2 HorizontalRotationMinMax => horizontalArc.RotationMinMax;
public Vector2 VerticalRotationMinMax => verticalArc.RotationMinMax;
public float HorizontalRotation => horizontalArc.Value;
public float VerticalRotation => verticalArc.Value;
protected virtual void Awake()
{
healthComp = GetComponent<HealthComponent>();
Assert.IsNotNull(healthComp);
// Set default rotation to average between min max
}
}