Buildings added, Info and Upgrade Menus Display data, Scriptable Object improved
This commit is contained in:
@@ -5,20 +5,28 @@ using UnityEngine;
|
||||
public class Building : MonoBehaviour
|
||||
{
|
||||
public BuildingData buildingData;
|
||||
public Outline outline;
|
||||
public int curLevel;
|
||||
public Outline[] outlines;
|
||||
|
||||
void Awake(){
|
||||
if(outline == null){outline = GetComponent<Outline>();}
|
||||
outline.enabled=false;
|
||||
//if(outline == null){outline = GetComponent<Outline>();}
|
||||
outlines = GetComponentsInChildren<Outline>();
|
||||
ToggleOutlines(false);
|
||||
Selector.OnSelectedChanged.AddListener(OnSelectedChanged);
|
||||
}
|
||||
|
||||
void OnSelectedChanged(){
|
||||
if(Selector.selectedBuilding == null){outline.enabled=false; return;}
|
||||
if(Selector.selectedBuilding == null){ToggleOutlines(false); return;}
|
||||
|
||||
outline.enabled = Selector.selectedBuilding == this;
|
||||
ToggleOutlines(Selector.selectedBuilding == this);
|
||||
// Debug.Log(buildingName);
|
||||
}
|
||||
|
||||
void ToggleOutlines(bool value){
|
||||
foreach(Outline outline in outlines){
|
||||
outline.enabled = value;
|
||||
}
|
||||
}
|
||||
|
||||
/* */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user