法杖,武器切换
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
using System.Collections.Generic;
|
||||
using Cielonos.MainGame.Characters;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cielonos.MainGame
|
||||
{
|
||||
public partial class BattleManager
|
||||
{
|
||||
public class AttackAreaSubmodule : SubmoduleBase<BattleManager>
|
||||
{
|
||||
public AttackAreaCollection playerAttackAreas;
|
||||
public AttackAreaCollection enemyAttackAreas;
|
||||
|
||||
public AttackAreaSubmodule(BattleManager owner) : base(owner)
|
||||
{
|
||||
playerAttackAreas = new AttackAreaCollection();
|
||||
enemyAttackAreas = new AttackAreaCollection();
|
||||
}
|
||||
|
||||
public void Register(AttackAreaBase attackArea)
|
||||
{
|
||||
if (attackArea.creator.fraction == Fraction.Player)
|
||||
{
|
||||
Debug.Log($"Registered AttackArea: {attackArea.areaName}");
|
||||
playerAttackAreas.Add(attackArea);
|
||||
}
|
||||
else if (attackArea.creator.fraction == Fraction.Enemy)
|
||||
{
|
||||
enemyAttackAreas.Add(attackArea);
|
||||
}
|
||||
}
|
||||
|
||||
public void Unregister(AttackAreaBase attackArea)
|
||||
{
|
||||
if (attackArea.creator.fraction == Fraction.Player)
|
||||
{
|
||||
Debug.Log($"Unregistered AttackArea: {attackArea.areaName}");
|
||||
playerAttackAreas.Remove(attackArea);
|
||||
}
|
||||
else if (attackArea.creator.fraction == Fraction.Enemy)
|
||||
{
|
||||
enemyAttackAreas.Remove(attackArea);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class AttackAreaCollection
|
||||
{
|
||||
public List<AttackAreaBase> activeAttackAreas;
|
||||
public List<NormalArea> activeNormalAreas;
|
||||
public List<Projectile> activeProjectiles;
|
||||
|
||||
public AttackAreaCollection()
|
||||
{
|
||||
activeAttackAreas = new List<AttackAreaBase>();
|
||||
activeNormalAreas = new List<NormalArea>();
|
||||
activeProjectiles = new List<Projectile>();
|
||||
}
|
||||
|
||||
public void Add(AttackAreaBase attackArea)
|
||||
{
|
||||
activeAttackAreas.Add(attackArea);
|
||||
|
||||
if (attackArea is NormalArea normalArea)
|
||||
{
|
||||
activeNormalAreas.Add(normalArea);
|
||||
}
|
||||
else if (attackArea is Projectile projectile)
|
||||
{
|
||||
activeProjectiles.Add(projectile);
|
||||
}
|
||||
}
|
||||
|
||||
public void Remove(AttackAreaBase attackArea)
|
||||
{
|
||||
activeAttackAreas.Remove(attackArea);
|
||||
|
||||
if (attackArea is NormalArea normalArea)
|
||||
{
|
||||
activeNormalAreas.Remove(normalArea);
|
||||
}
|
||||
else if (attackArea is Projectile projectile)
|
||||
{
|
||||
activeProjectiles.Remove(projectile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user