Files
Cielonos/Assets/Scripts/MainGame/Managers/SceneSubmodule/CityArenaBeginningProcessor.cs
SoulliesOfficial 9a9e48f8a5
2026-06-27 12:52:03 -04:00

48 lines
1.8 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Collections.Generic;
using Cielonos.MainGame.Buffs.Character;
using Cielonos.MainGame.Inventory;
using UnityEngine;
namespace Cielonos.MainGame
{
public partial class SceneSubmodule
{
public partial class CityArenaBeginningProcessor
{
public void Process()
{
if (InfoTransistor.Instance != null)
{
ApplyInvincible();
ApplyStartItems();
}
}
}
public partial class CityArenaBeginningProcessor
{
private void ApplyInvincible()
{
if (InfoTransistor.GetInfo<bool>("ApplyInvincible"))
{
new Invincible(99999f).Apply(MainGameManager.Player);
}
}
private void ApplyStartItems()
{
// 1. 获取在上一场景(如 Fortress触发事件而暂存在 InfoTransistor 中的额外初始装备
PlayerInventorySaveData saveData = InfoTransistor.GetInfo<PlayerInventorySaveData>("StartInventory");
if (saveData != null && MainGameManager.Player != null)
{
// 2. 应用这些存档数据注意ApplySaveData 内部会先调用 ClearInventory 清空所有的默认硬编码装备)
MainGameManager.Player.inventorySc.ApplySaveData(saveData);
InfoTransistor.SetInfo<PlayerInventorySaveData>("StartInventory", null);
// 3. 存档恢复完毕后,再次追加所有的默认硬编码装备,确保基础物品与事件物品并存
MainGameManager.Player.inventorySc.GrantInitialEquipments();
}
}
}
}
}