Change affinity
This commit is contained in:
@@ -4,8 +4,10 @@ namespace GameJamDungeon;
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Chickensoft.Introspection;
|
||||
using Chickensoft.SaveFileBuilder;
|
||||
using GameJamDungeon.src.item_rescue;
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public interface IGame : IProvide<IGameRepo>, IProvide<IGameEventDepot>, IProvide<IGame>, INode3D
|
||||
{
|
||||
@@ -24,6 +26,8 @@ public interface IGame : IProvide<IGameRepo>, IProvide<IGameEventDepot>, IProvid
|
||||
|
||||
public void HealVT(int amountToRaise);
|
||||
public void RaiseVT(int amountToRaise);
|
||||
|
||||
public void DoubleEXP(TimeSpan lengthOfEffect);
|
||||
}
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
@@ -66,6 +70,8 @@ public partial class Game : Node3D, IGame
|
||||
[Node] public IPauseMenu PauseMenu { get; set; } = default!;
|
||||
|
||||
[Node] public InGameAudio InGameAudio { get; set; } = default!;
|
||||
|
||||
[Node] public Timer DoubleEXPTimer { get; set; } = default!;
|
||||
#endregion
|
||||
|
||||
public RescuedItemDatabase RescuedItems { get; set; } = default!;
|
||||
@@ -138,7 +144,7 @@ public partial class Game : Node3D, IGame
|
||||
GameRepo.PlayerData.Inventory.PickedUpItem += Inventory_PickedUpItem;
|
||||
GameRepo.PlayerData.Inventory.RaiseStatRequest += Inventory_RaiseStatRequest;
|
||||
FloorClearMenu.GoToNextFloor += FloorClearMenu_GoToNextFloor;
|
||||
FloorClearMenu.ReturnToHubWorld += ReturnToHubWorld;
|
||||
FloorClearMenu.SaveAndExit += FloorClearMenu_SaveAndExit;
|
||||
FloorClearMenu.TransitionCompleted += FloorClearMenu_TransitionCompleted;
|
||||
|
||||
Player.InventoryButtonPressed += Player_InventoryButtonPressed;
|
||||
@@ -147,11 +153,13 @@ public partial class Game : Node3D, IGame
|
||||
|
||||
GameEventDepot.EnemyDefeated += OnEnemyDefeated;
|
||||
GameEventDepot.RestorativePickedUp += GameEventDepot_RestorativePickedUp;
|
||||
|
||||
DoubleEXPTimer.Timeout += DoubleEXPTimer_Timeout;
|
||||
}
|
||||
|
||||
private void Inventory_PickedUpItem(string pickedUpItemName)
|
||||
{
|
||||
InGameUI.PlayerInfoUI.DisplayPickedUpMessage(pickedUpItemName);
|
||||
InGameUI.PlayerInfoUI.DisplayMessage($"{pickedUpItemName} picked up.");
|
||||
}
|
||||
|
||||
public void DropItem(IInventoryItem item)
|
||||
@@ -174,7 +182,7 @@ public partial class Game : Node3D, IGame
|
||||
|
||||
private void OnEnemyDefeated(Vector3 vector, EnemyStatResource resource)
|
||||
{
|
||||
GameRepo.PlayerData.SetCurrentExp(GameRepo.PlayerData.CurrentExp.Value + resource.ExpFromDefeat);
|
||||
GameRepo.PlayerData.SetCurrentExp(GameRepo.PlayerData.CurrentExp.Value + (resource.ExpFromDefeat * GameRepo.EXPRate));
|
||||
DropRestorative(vector);
|
||||
}
|
||||
|
||||
@@ -234,15 +242,15 @@ public partial class Game : Node3D, IGame
|
||||
GameLogic.Input(new GameLogic.Input.GoToNextFloor());
|
||||
}
|
||||
|
||||
private void ReturnToHubWorld()
|
||||
private void FloorClearMenu_SaveAndExit()
|
||||
{
|
||||
// Implement a return to overworld state
|
||||
// Don't carry over stats/equipment but we'll need to persist the overworld state
|
||||
// Which may include rescued items and npc/questline state
|
||||
// Save
|
||||
GameLogic.Input(new GameLogic.Input.HideFloorClearMenu());
|
||||
GameLogic.Input(new GameLogic.Input.SaveGame());
|
||||
}
|
||||
|
||||
private void GameEventDepot_RestorativePickedUp(Restorative obj) => GameRepo.PlayerData.SetCurrentVT(GameRepo.PlayerData.CurrentVT.Value + obj.VTRestoreAmount);
|
||||
private void GameEventDepot_RestorativePickedUp(Restorative obj)
|
||||
=> GameRepo.PlayerData.SetCurrentVT(GameRepo.PlayerData.CurrentVT.Value + obj.VTRestoreAmount);
|
||||
|
||||
private void Inventory_RaiseStatRequest(InventoryItemStats itemStats)
|
||||
{
|
||||
@@ -290,12 +298,25 @@ public partial class Game : Node3D, IGame
|
||||
EmitSignal(SignalName.StatRaisedAlert, $"{raiseString}VT Restored.");
|
||||
}
|
||||
|
||||
private void PlayerInventory_InventoryAtCapacity(string rejectedItem)
|
||||
public async void DoubleEXP(TimeSpan lengthOfEffect)
|
||||
{
|
||||
InGameUI.PlayerInfoUI.DisplayInventoryFullMessage(rejectedItem);
|
||||
InventoryMenu_CloseInventory();
|
||||
InGameUI.PlayerInfoUI.DisplayMessage("Experience points temporarily doubled.");
|
||||
DoubleEXPTimer.Start(lengthOfEffect.Seconds);
|
||||
GameRepo.EXPRate = 2;
|
||||
}
|
||||
|
||||
private void OnInventoryAtCapacity(string rejectedItemName) => InGameUI.PlayerInfoUI.DisplayInventoryFullMessage(rejectedItemName);
|
||||
private void DoubleEXPTimer_Timeout()
|
||||
{
|
||||
DoubleEXPTimer.Stop();
|
||||
GameRepo.EXPRate = 1;
|
||||
InGameUI.PlayerInfoUI.DisplayMessage("Experience points effect wore off.");
|
||||
}
|
||||
|
||||
private void PlayerInventory_InventoryAtCapacity(string rejectedItem)
|
||||
{
|
||||
InGameUI.PlayerInfoUI.DisplayMessage($"Could not pick up {rejectedItem}.");
|
||||
}
|
||||
|
||||
private void InventoryMenu_CloseInventory() => GameLogic.Input(new GameLogic.Input.CloseInventory());
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
[gd_scene load_steps=13 format=3 uid="uid://33ek675mfb5n"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/game/Game.cs" id="1_ytcii"]
|
||||
[ext_resource type="Shader" path="res://src/app/App.gdshader" id="2_6ifxs"]
|
||||
[ext_resource type="Script" uid="uid://chftlu4proh3d" path="res://src/game/Game.cs" id="1_ytcii"]
|
||||
[ext_resource type="Shader" uid="uid://dmjxo4k2rx1an" path="res://src/app/App.gdshader" id="2_6ifxs"]
|
||||
[ext_resource type="PackedScene" uid="uid://by67pn7fdsg1m" path="res://src/map/Map.tscn" id="3_d8awv"]
|
||||
[ext_resource type="PackedScene" uid="uid://cfecvvav8kkp6" path="res://src/player/Player.tscn" id="3_kk6ly"]
|
||||
[ext_resource type="PackedScene" uid="uid://b1muxus5qdbeu" path="res://src/ui/in_game_ui/InGameUI.tscn" id="5_lxtnp"]
|
||||
[ext_resource type="PackedScene" uid="uid://b16ejcwanod72" path="res://src/audio/InGameAudio.tscn" id="6_qc71l"]
|
||||
[ext_resource type="Script" path="res://src/game/DialogueController.cs" id="10_58pbt"]
|
||||
[ext_resource type="Script" path="res://src/ui/pause_menu/PauseMenu.cs" id="11_5ng8c"]
|
||||
[ext_resource type="Script" uid="uid://daphxl6vvsbjm" path="res://src/game/DialogueController.cs" id="10_58pbt"]
|
||||
[ext_resource type="Script" uid="uid://cbal5oeaha4nx" path="res://src/ui/pause_menu/PauseMenu.cs" id="11_5ng8c"]
|
||||
[ext_resource type="PackedScene" uid="uid://pu6gp8de3ck4" path="res://src/ui/floor_clear/FloorClearMenu.tscn" id="11_rya1n"]
|
||||
[ext_resource type="PackedScene" uid="uid://dbtfgrtgpr4qg" path="res://src/ui/death_menu/DeathMenu.tscn" id="11_wypid"]
|
||||
[ext_resource type="PackedScene" uid="uid://blbqgw3wosc1w" path="res://src/ui/pause_menu/PauseMenu.tscn" id="12_yev8k"]
|
||||
@@ -54,6 +54,12 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -2.74459, 1.22144)
|
||||
unique_name_in_owner = true
|
||||
process_mode = 1
|
||||
|
||||
[node name="StatusEffectTimers" type="Node" parent="SubViewportContainer/SubViewport/PauseContainer"]
|
||||
|
||||
[node name="DoubleEXPTimer" type="Timer" parent="SubViewportContainer/SubViewport/PauseContainer/StatusEffectTimers"]
|
||||
unique_name_in_owner = true
|
||||
wait_time = 30.0
|
||||
|
||||
[node name="InGameUI" parent="." instance=ExtResource("5_lxtnp")]
|
||||
unique_name_in_owner = true
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
public readonly record struct GoToOverworld;
|
||||
|
||||
public readonly record struct SaveGame;
|
||||
|
||||
public readonly record struct OpenInventory;
|
||||
|
||||
public readonly record struct CloseInventory;
|
||||
@@ -32,6 +34,7 @@
|
||||
public readonly record struct PauseMenuTransitioned;
|
||||
|
||||
public readonly record struct AskForTeleport;
|
||||
|
||||
public readonly record struct HideAskForTeleport;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ public interface IGameRepo : IDisposable
|
||||
|
||||
public int MaxItemSize { get; }
|
||||
|
||||
public int EXPRate { get; set; }
|
||||
|
||||
public int CurrentFloor { get; set; }
|
||||
}
|
||||
|
||||
@@ -47,6 +49,8 @@ public class GameRepo : IGameRepo
|
||||
|
||||
public int MaxItemSize => 20;
|
||||
|
||||
public int EXPRate { get; set; } = 1;
|
||||
|
||||
private bool _disposedValue;
|
||||
|
||||
public int CurrentFloor { get; set; } = 0;
|
||||
|
||||
Reference in New Issue
Block a user