Implemented new dungeon room sprites for the different states they can be in and zooming.
This commit is contained in:
parent
9633b70828
commit
438d3a9a79
15 changed files with 90787 additions and 14695 deletions
|
|
@ -9,12 +9,15 @@ using UnityEngine.Serialization;
|
|||
|
||||
public abstract class Room : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject highlight;
|
||||
[SerializeField] private GameObject explored;
|
||||
[SerializeField] private Sprite litRoom;
|
||||
[FormerlySerializedAs("adjacentRooms")] [SerializeField] public List<GameObject> AdjacentRooms;
|
||||
public bool IsEntrance;
|
||||
[SerializeField] protected RoomReward roomReward;
|
||||
|
||||
public event EventHandler<Room> RoomExploredByDice;
|
||||
public static event Action<Room> RoomExploredByTorch;
|
||||
private Color _roomNumberOriginalColor;
|
||||
private DicePair _diceSelected;
|
||||
|
||||
protected bool _isExplored = false;
|
||||
|
|
@ -39,7 +42,6 @@ public abstract class Room : MonoBehaviour
|
|||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start() {
|
||||
InitializeRoom();
|
||||
_roomNumberOriginalColor = gameObject.GetComponentInChildren<TextMeshProUGUI>().color;
|
||||
}
|
||||
|
||||
public bool GetRoomExplored()
|
||||
|
|
@ -47,8 +49,21 @@ public abstract class Room : MonoBehaviour
|
|||
return _isExplored;
|
||||
}
|
||||
|
||||
public void SetRoomLit()
|
||||
{
|
||||
gameObject.GetComponent<SpriteRenderer>().sprite = litRoom;
|
||||
}
|
||||
|
||||
public abstract void SetRoomExplored();
|
||||
|
||||
protected void SetExploredGUI()
|
||||
{
|
||||
explored.SetActive(true);
|
||||
foreach (GameObject roomObject in AdjacentRooms)
|
||||
{
|
||||
roomObject.GetComponent<Room>().SetRoomLit();
|
||||
}
|
||||
}
|
||||
protected virtual void InitializeRoom() {
|
||||
if (IsEntrance) {
|
||||
SetPropertiesOfEntrance();
|
||||
|
|
@ -58,16 +73,16 @@ public abstract class Room : MonoBehaviour
|
|||
|
||||
protected void HighlightRoomAsOption()
|
||||
{
|
||||
gameObject.GetComponentInChildren<TextMeshProUGUI>().color = Color.blue;
|
||||
highlight.SetActive(true);
|
||||
}
|
||||
|
||||
protected void UnhighlightRoomAsOption()
|
||||
{
|
||||
gameObject.GetComponentInChildren<TextMeshProUGUI>().color = _roomNumberOriginalColor;
|
||||
highlight.SetActive(false);
|
||||
}
|
||||
|
||||
void SetPropertiesOfEntrance() {
|
||||
gameObject.GetComponent<SpriteRenderer>().color = Color.green;
|
||||
gameObject.GetComponent<SpriteRenderer>().color = Color.yellow;
|
||||
IsEntrance = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue