You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.4 KiB
61 lines
1.4 KiB
1 month ago
|
using System;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public partial class CombatEntity
|
||
|
{
|
||
|
public bool IsValid
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
if (isEnabled == false)
|
||
|
return false;
|
||
|
|
||
|
if (isDestroyEnt)
|
||
|
return false;
|
||
|
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
public static implicit operator bool(CombatEntity entity)
|
||
|
{
|
||
|
return entity is { isEnabled: true, isDestroyEnt: false };
|
||
|
}
|
||
|
public ReuseGoData GetNewGo(string path, Action<ReuseGoData> callback, int interlockInd = 0)
|
||
|
{
|
||
|
// todo 关联所属
|
||
|
return GoPoolDic.GetPool(path).GetNewGo(callback, interlockInd);
|
||
|
}
|
||
|
|
||
|
public ReuseGoData GetNewGo(string path, Action<ReuseGoData> callback, object param)
|
||
|
{
|
||
|
return GoPoolDic.GetPool(path).GetNewGo(callback, -1, param);
|
||
|
}
|
||
|
|
||
|
public void ReleaseGo(string path, ReuseGoData go)
|
||
|
{
|
||
|
GoPoolDic.GetPool(path).ReleaseGo(go);
|
||
|
}
|
||
|
|
||
|
public void ReleaseGo(ReuseGoData go)
|
||
|
{
|
||
|
GoPoolDic.GetPool(go.path).ReleaseGo(go);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
public static class CombatEntityExt
|
||
|
{
|
||
|
public static bool IsValid(this CombatEntity entity)
|
||
|
{
|
||
|
if (entity == null)
|
||
|
return false;
|
||
|
|
||
|
if (entity.isEnabled == false)
|
||
|
return false;
|
||
|
|
||
|
if (entity.isDestroyEnt)
|
||
|
return false;
|
||
|
|
||
|
return true;
|
||
|
}
|
||
|
}
|