25 lines
810 B
C#
25 lines
810 B
C#
|
using UnityEngine;
|
||
|
using UnityEngine.Assertions;
|
||
|
|
||
|
[RequireComponent(typeof(HealthComponent))]
|
||
|
public abstract class Tower : MonoBehaviour
|
||
|
{
|
||
|
[SerializeField] private Vector2 horizontalRotationMinMax;
|
||
|
[SerializeField] private Vector2 verticalRotationMinMax;
|
||
|
|
||
|
[SerializeField] private float horizontalRotation;
|
||
|
[SerializeField] private float verticalRotation;
|
||
|
|
||
|
private HealthComponent healthComp;
|
||
|
|
||
|
private void Awake()
|
||
|
{
|
||
|
healthComp = GetComponent<HealthComponent>();
|
||
|
Assert.IsNotNull(healthComp);
|
||
|
|
||
|
// Set default rotation to average between min max
|
||
|
horizontalRotation = (horizontalRotationMinMax.x + horizontalRotationMinMax.y) / 2f;
|
||
|
verticalRotation = (verticalRotationMinMax.x + verticalRotationMinMax.y) / 2f;
|
||
|
}
|
||
|
}
|