重构清理敌人类
This commit is contained in:
@@ -6,6 +6,7 @@ using SepCore.EnemyManager;
|
||||
using SepCore.Simulation;
|
||||
using SepCore.Timer;
|
||||
using UnityEngine;
|
||||
using UnityGameFramework.Runtime;
|
||||
|
||||
namespace SepCore.Procedure
|
||||
{
|
||||
@@ -86,16 +87,9 @@ namespace SepCore.Procedure
|
||||
// 停止玩家逻辑
|
||||
Player.Enable = false;
|
||||
|
||||
// 隐藏所有掉落物实体
|
||||
var entities = GameEntry.Entity.GetEntityGroup("Drop").GetAllEntities();
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
GameEntry.Entity.HideEntity(entity.Id);
|
||||
}
|
||||
|
||||
HideEntityGroup("Bullet");
|
||||
HideEntityGroup("Projectile");
|
||||
HideEntityGroup("EnemyProjectile");
|
||||
// 隐藏所有掉落物与投射物实体
|
||||
HideEntityGroup(GameEntry.Luban.Global.DropGroupName);
|
||||
HideEntityGroup(GameEntry.Luban.Global.ProjectileGroupName);
|
||||
}
|
||||
|
||||
public override void OnDestroy()
|
||||
@@ -106,13 +100,14 @@ namespace SepCore.Procedure
|
||||
|
||||
private static void HideEntityGroup(string groupName)
|
||||
{
|
||||
var entityGroup = GameEntry.Entity.GetEntityGroup(groupName);
|
||||
var entities = entityGroup?.GetAllEntities();
|
||||
if (entities == null)
|
||||
if (!GameEntry.Entity.HasEntityGroup(groupName))
|
||||
{
|
||||
Log.Error("Entity group '{0}' does not exist.", groupName);
|
||||
return;
|
||||
}
|
||||
|
||||
var entityGroup = GameEntry.Entity.GetEntityGroup(groupName);
|
||||
var entities = entityGroup.GetAllEntities();
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
GameEntry.Entity.HideEntity(entity.Id);
|
||||
|
||||
Reference in New Issue
Block a user