Implemented the functionality for monster rooms.
This commit is contained in:
parent
6a309804ad
commit
aa49815fb9
16 changed files with 1182 additions and 71 deletions
50
PuzzleGameProject/Assets/Scripts/Rooms/EmptyRoom.cs
Normal file
50
PuzzleGameProject/Assets/Scripts/Rooms/EmptyRoom.cs
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class EmptyRoom : Room
|
||||
{
|
||||
[SerializeField] private GameObject numberTextObject;
|
||||
[SerializeField] private int number;
|
||||
|
||||
protected override void InitializeRoom() {
|
||||
base.InitializeRoom();
|
||||
TextMeshProUGUI numberText = numberTextObject.GetComponent<TextMeshProUGUI>();
|
||||
if (keyType == KeyType.Number)
|
||||
{
|
||||
numberText.SetText(number.ToString());
|
||||
}
|
||||
else if (keyType == KeyType.MatchingDice)
|
||||
{
|
||||
numberText.SetText("=");
|
||||
}
|
||||
}
|
||||
|
||||
public override bool TryUnlock(DicePair pair)
|
||||
{
|
||||
switch (keyType)
|
||||
{
|
||||
case KeyType.Number:
|
||||
if (number == pair.Sum())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case KeyType.MatchingDice:
|
||||
if (pair.DoResultsMatch())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void SetRoomExplored() {
|
||||
_isExplored = true;
|
||||
UnhighlightRoomAsOption();
|
||||
gameObject.GetComponent<SpriteRenderer>().color =
|
||||
ColorHelper.AddColorTint(gameObject.GetComponent<SpriteRenderer>().color, Color.grey, 0.5f);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue