outline on selected

This commit is contained in:
Sveske Juice 2024-04-20 22:54:08 +02:00
parent 0ac1402616
commit edd234916b
5 changed files with 8 additions and 5 deletions

View File

@ -152,7 +152,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 872127579833310669}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5fea29bb7c508c244a1f805a5fd3fc4d, type: 3}
m_Name:

View File

@ -12,7 +12,6 @@ public class GameManager : MonoBehaviour
selectedTower = value;
selectedTower.TowerSelected(true);
Debug.Log($"Selected: {selectedTower}");
}}
private void Awake()

View File

@ -1,6 +1,5 @@
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
public class CameraSlotClickDetect : MonoBehaviour

View File

@ -28,6 +28,8 @@ public class AimTower : Tower
protected override void Awake()
{
base.Awake();
horizontalArc.Value.AddListener(UpdateBarrelRotation);
verticalArc.Value.AddListener(UpdateBarrelRotation);
@ -80,7 +82,6 @@ public class AimTower : Tower
}
if (!this.selected) return;
Debug.Log("UPAD");
Vector3 origin = barrel.Tip.position;
Vector3 dir = barrel.transform.forward;
List<Vector3> pointsInTrajectory = new();

View File

@ -6,18 +6,22 @@ public abstract class Tower : MonoBehaviour
{
protected bool selected = false;
protected HealthComponent healthComp;
protected Outline outline;
// Getters
public virtual void TowerSelected(bool selected)
{
this.selected = selected;
outline.enabled = selected;
}
protected virtual void Awake()
{
healthComp = GetComponent<HealthComponent>();
outline = GetComponent<Outline>();
Assert.IsNotNull(healthComp);
Assert.IsNotNull(outline);
}
protected virtual void OnDestroy()