mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-05 19:35:55 +00:00
Revamped equipment init
This commit is contained in:
parent
5719738be9
commit
2a016fd30c
16 changed files with 76 additions and 81 deletions
|
|
@ -31,14 +31,8 @@ public partial class GameManager : Node2D
|
|||
[Export] public Dictionary<int, NodePath> SpawnMarkers { get; private set; } = new();
|
||||
|
||||
//[Export] public Marker2D PlayerSpawnMarker { get; set; }
|
||||
|
||||
[Export] public Array<LootItem> StartingEquipment { get; private set; } = new();
|
||||
|
||||
private InventoryManager _inventoryManager { get; set; }
|
||||
|
||||
[Export]
|
||||
public MapStartDataResource MapStartData { get; private set; }
|
||||
|
||||
//private AlarmManager _alarmManager { get; set; }
|
||||
|
||||
//public InventoryManager Inventory => _inventoryManager;
|
||||
|
|
@ -67,6 +61,9 @@ public partial class GameManager : Node2D
|
|||
[Export]
|
||||
public Node2D PlayerParentNode { get; set; }
|
||||
|
||||
[Export]
|
||||
public int EggStartIndex = 0;
|
||||
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
|
|
@ -124,9 +121,10 @@ public partial class GameManager : Node2D
|
|||
|
||||
public void ApplyMapStartData(MapStartDataResource mapStartData)
|
||||
{
|
||||
MapStartData = mapStartData;
|
||||
EggStartIndex = mapStartData.EggIndex;
|
||||
//MapStartData = mapStartData;
|
||||
|
||||
StartingEquipment.AddRange(mapStartData.StartingEquipment);
|
||||
// StartingEquipment.AddRange(mapStartData.StartingEquipment);
|
||||
}
|
||||
|
||||
public void AddMotivation(float motivation)
|
||||
|
|
@ -222,9 +220,9 @@ public partial class GameManager : Node2D
|
|||
|
||||
private Vector2 GetStartPosition()
|
||||
{
|
||||
if (MapStartData != null)
|
||||
if (MapResource != null)
|
||||
{
|
||||
if (SpawnMarkers.TryGetValue(MapStartData.EggIndex, out var spawnMarker))
|
||||
if (SpawnMarkers.TryGetValue(EggStartIndex, out var spawnMarker))
|
||||
{
|
||||
var marker = GetNode<Node2D>(spawnMarker);
|
||||
|
||||
|
|
@ -257,25 +255,14 @@ public partial class GameManager : Node2D
|
|||
|
||||
private void SpawnWeapons()
|
||||
{
|
||||
if (!StartingEquipment.Any())
|
||||
foreach (var startingItem in MapResource.StartData.StartingEquipment)
|
||||
{
|
||||
GD.Print("No items to spawn on Player");
|
||||
return;
|
||||
_inventoryManager.AddItem(startingItem);
|
||||
}
|
||||
|
||||
foreach (var startingItem in StartingEquipment)
|
||||
foreach (var item in MapResource.StartData.RemoveEquipment)
|
||||
{
|
||||
// Now automatically taken care of by the event
|
||||
// switch (startingItem.Item)
|
||||
// {
|
||||
// case ItemTypes.Weapon:
|
||||
// SpawnPlayerWeapon(startingItem);
|
||||
//
|
||||
// //_player.EquippedWeapon ??= weapon;
|
||||
// break;
|
||||
// }
|
||||
|
||||
_inventoryManager.AddItem(startingItem);
|
||||
_inventoryManager.RemoveItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue