Building Selection started + Outline
This commit is contained in:
21
Assets/Game/Scripts/Building.cs
Normal file
21
Assets/Game/Scripts/Building.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Building : MonoBehaviour
|
||||
{
|
||||
public string buildingName = "building01";
|
||||
public Outline outline;
|
||||
|
||||
void Awake(){
|
||||
if(outline == null){outline = GetComponent<Outline>();}
|
||||
outline.enabled=false;
|
||||
Selector.OnSelectedChanged.AddListener(OnSelectedChanged);
|
||||
}
|
||||
|
||||
void OnSelectedChanged(){
|
||||
if(Selector.selectedBuilding == null){outline.enabled=false; return;}
|
||||
|
||||
outline.enabled = Selector.selectedBuilding == this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user