Added final features for this release. Now only polishing (if needed) remains.
Features: Sacrifice-Node, Maintain-Node, Options for screen type, lightcolor and soundvolume, tied in sound effects, game pause when menu is open, visibly open up gate when opening it.
This commit is contained in:
@@ -58,6 +58,7 @@ public partial class UIHandler : Control
|
||||
public void HandleMenuButton()
|
||||
{
|
||||
OpenUIElement(menu);
|
||||
GameData.isPaused = menu.Visible || options.Visible;
|
||||
}
|
||||
|
||||
public void HandleMenu()
|
||||
@@ -67,7 +68,9 @@ public partial class UIHandler : Control
|
||||
|
||||
public void ShowOptions()
|
||||
{
|
||||
menu.Hide();
|
||||
OpenUIElement(options);
|
||||
GameData.isPaused = options.Visible;
|
||||
}
|
||||
|
||||
public void HandleMapButton()
|
||||
@@ -101,6 +104,7 @@ public partial class UIHandler : Control
|
||||
RAM.Text = memoryDisplay;
|
||||
DisplaySurvivalStats();
|
||||
DisplayWorldStats();
|
||||
DisplayLoseCondition();
|
||||
}
|
||||
|
||||
public void ExitGame()
|
||||
@@ -123,6 +127,7 @@ public partial class UIHandler : Control
|
||||
|
||||
public void OpenUIElement(Control element)
|
||||
{
|
||||
SoundManager.PlayButton();
|
||||
if (element.Visible)
|
||||
{
|
||||
element.Hide();
|
||||
@@ -141,6 +146,11 @@ public partial class UIHandler : Control
|
||||
if (child == element) continue;
|
||||
child.Visible = false;
|
||||
}
|
||||
|
||||
if (element != menu && element != options)
|
||||
{
|
||||
GameData.isPaused = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void DisplayRobotAlarm()
|
||||
@@ -201,15 +211,28 @@ public partial class UIHandler : Control
|
||||
unlockLayer.Disabled = !GameData.inventory.CanCraft(GameData.map[GameData.lowestLayer].gateIngredients, 1);
|
||||
}
|
||||
|
||||
private void DisplayLoseCondition()
|
||||
{
|
||||
if (!GameData.HasNoRobotRecovery()) return;
|
||||
|
||||
ShowGameOver("No robots remain and no robot can be spawned from inventory.");
|
||||
}
|
||||
|
||||
public void UnlockLayer()
|
||||
{
|
||||
if (GameData.inventory.CanCraft(GameData.map[GameData.lowestLayer].gateIngredients, 1))
|
||||
{
|
||||
int openedLayer = GameData.lowestLayer;
|
||||
foreach (Ingredient ingredient in GameData.map[GameData.lowestLayer].gateIngredients)
|
||||
{
|
||||
GameData.inventory.RemoveItem(ingredient.Item, ingredient.Amount);
|
||||
}
|
||||
GameData.lowestLayer++;
|
||||
World world = GetNodeOrNull<World>("/root/Main/World");
|
||||
if (world != null)
|
||||
{
|
||||
world.OpenGate(openedLayer);
|
||||
}
|
||||
if (GameData.lowestLayer == GameData.ruinSize)
|
||||
{
|
||||
gameOver.Show();
|
||||
@@ -218,9 +241,14 @@ public partial class UIHandler : Control
|
||||
}
|
||||
|
||||
public void ShowGameOver()
|
||||
{
|
||||
ShowGameOver($"You died!\rReason: {GameData.survival.deathReason}\rBetter luck next time.");
|
||||
}
|
||||
|
||||
public void ShowGameOver(string message)
|
||||
{
|
||||
if (gameOver.Visible) return;
|
||||
gameOver.GetNode<RichTextLabel>("./VBoxContainer/Content").Text = $"[font_size=32]You died!\rReason: {GameData.survival.deathReason}\rBetter luck next time.\r";
|
||||
gameOver.GetNode<RichTextLabel>("./VBoxContainer/Content").Text = $"[font_size=32]{message}\r";
|
||||
gameOver.Show();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user