2024-04-20 22:19:23 +02:00
|
|
|
using System;
|
2024-04-19 23:32:37 +02:00
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.Assertions;
|
|
|
|
|
|
|
|
public abstract class Tower : MonoBehaviour
|
|
|
|
{
|
2024-04-21 01:12:48 +02:00
|
|
|
[SerializeField]
|
|
|
|
private GameObject selectedUI;
|
|
|
|
|
2024-04-20 22:42:06 +02:00
|
|
|
protected bool selected = false;
|
2024-04-20 13:15:33 +02:00
|
|
|
protected HealthComponent healthComp;
|
2024-04-20 22:54:08 +02:00
|
|
|
protected Outline outline;
|
2024-04-19 23:32:37 +02:00
|
|
|
|
2024-04-20 01:40:53 +02:00
|
|
|
// Getters
|
2024-04-20 22:42:06 +02:00
|
|
|
public virtual void TowerSelected(bool selected)
|
|
|
|
{
|
|
|
|
this.selected = selected;
|
2024-04-20 22:54:08 +02:00
|
|
|
|
|
|
|
outline.enabled = selected;
|
2024-04-21 01:12:48 +02:00
|
|
|
selectedUI.SetActive(selected);
|
2024-04-20 22:42:06 +02:00
|
|
|
}
|
2024-04-20 01:40:53 +02:00
|
|
|
|
|
|
|
protected virtual void Awake()
|
2024-04-19 23:32:37 +02:00
|
|
|
{
|
|
|
|
healthComp = GetComponent<HealthComponent>();
|
2024-04-20 22:54:08 +02:00
|
|
|
outline = GetComponent<Outline>();
|
2024-04-19 23:32:37 +02:00
|
|
|
Assert.IsNotNull(healthComp);
|
2024-04-20 22:54:08 +02:00
|
|
|
Assert.IsNotNull(outline);
|
2024-04-20 22:19:23 +02:00
|
|
|
}
|
2024-04-19 23:32:37 +02:00
|
|
|
|
2024-04-20 23:32:42 +02:00
|
|
|
protected virtual void Start()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2024-04-20 13:15:33 +02:00
|
|
|
protected virtual void OnDestroy()
|
|
|
|
{
|
2024-04-19 23:32:37 +02:00
|
|
|
}
|
2024-04-20 19:22:52 +02:00
|
|
|
|
|
|
|
protected virtual void Update()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
protected virtual void FixedUpdate()
|
|
|
|
{
|
|
|
|
}
|
2024-04-19 23:32:37 +02:00
|
|
|
}
|