44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Cielonos.MainGame.Characters;
|
|
using SLSUtilities.UI;
|
|
using UnityEngine;
|
|
|
|
namespace Cielonos.MainGame.UI
|
|
{
|
|
public partial class BossInfoUIArea : UIElementBase
|
|
{
|
|
public GameObject infoUnitPrefab;
|
|
public List<BossInfoUnit> bossInfoUnits;
|
|
|
|
public void CreateInfoUnit(CharacterBase boss)
|
|
{
|
|
BossInfoUnit unit = Instantiate(infoUnitPrefab, transform).GetComponent<BossInfoUnit>();
|
|
unit.Initialize(boss);
|
|
bossInfoUnits.Add(unit);
|
|
}
|
|
|
|
public void RemoveInfoUnit(CharacterBase boss)
|
|
{
|
|
BossInfoUnit unitToRemove = null;
|
|
foreach (var unit in bossInfoUnits.Where(unit => unit.bossCharacter == boss))
|
|
{
|
|
unitToRemove = unit;
|
|
break;
|
|
}
|
|
|
|
if (unitToRemove != null)
|
|
{
|
|
bossInfoUnits.Remove(unitToRemove);
|
|
Destroy(unitToRemove.gameObject);
|
|
}
|
|
}
|
|
}
|
|
|
|
public partial class BossInfoUIArea
|
|
{
|
|
|
|
public BossInfoUnit this[CharacterBase boss] => bossInfoUnits.FirstOrDefault(unit => unit.bossCharacter == boss);
|
|
}
|
|
} |