161 lines
4.2 KiB
C#
161 lines
4.2 KiB
C#
using Gameplay.Character;
|
|
namespace Gameplay.Unit.Data
|
|
{
|
|
public class UnitStatusData
|
|
{
|
|
public readonly GameUnit owner;
|
|
|
|
/// <summary>
|
|
/// 是否正在移动
|
|
/// </summary>
|
|
public bool isMoveing = false;
|
|
|
|
/// <summary>
|
|
/// 是否已死亡
|
|
/// </summary>
|
|
public bool isDead = false;
|
|
|
|
/// <summary>
|
|
/// 是否可以被攻击
|
|
/// </summary>
|
|
public bool canBeAttack = true;
|
|
|
|
/// <summary>
|
|
/// 是否在载具上
|
|
/// </summary>
|
|
public bool isOnVehicle = false;
|
|
|
|
/// <summary>
|
|
/// 是否混乱
|
|
/// </summary>
|
|
public bool isChaos = false;
|
|
|
|
/// <summary>
|
|
/// 是否眩晕
|
|
/// </summary>
|
|
public bool isStun = false;
|
|
|
|
/// <summary>
|
|
/// 是否锁定位置
|
|
/// </summary>
|
|
public bool isLockPos = false;
|
|
|
|
/// <summary>
|
|
/// 是否逃跑
|
|
/// </summary>
|
|
public bool isRetreat = false;
|
|
|
|
/// <summary>
|
|
/// 是否需要技能暂停
|
|
/// </summary>
|
|
public bool needSkillPaused = false;
|
|
|
|
/// <summary>
|
|
/// 是否在释放技能
|
|
/// </summary>
|
|
public bool isInSkilling = false;
|
|
|
|
/// <summary>
|
|
/// 是否不可逃跑
|
|
/// </summary>
|
|
public bool isNoRetreat = false;
|
|
|
|
/// <summary>
|
|
/// 是否是AI控制
|
|
/// </summary>
|
|
public bool isAIControll = false;
|
|
|
|
/// <summary>
|
|
/// 是否是伪装状态
|
|
/// </summary>
|
|
public bool isPretend = false;
|
|
|
|
/// <summary>
|
|
/// 是否是死撑状态
|
|
/// </summary>
|
|
public bool isDeadRetreat = false;
|
|
|
|
/// <summary>
|
|
/// 是否是扛旗状态
|
|
/// </summary>
|
|
public bool isHoldFlag = false;
|
|
|
|
public GameUnit lastAttackUnit = null;
|
|
|
|
/// <summary>
|
|
/// 是否激活攻击
|
|
/// </summary>
|
|
public bool isAttackActive = false;
|
|
|
|
/// <summary>
|
|
/// 是否允许攻击
|
|
/// </summary>
|
|
public bool isAllowAttack = true;
|
|
|
|
/// <summary>
|
|
/// 自身是否可以发起攻击
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public bool CheckCanAttack()
|
|
{
|
|
if (isDead) return false;
|
|
if (isOnVehicle) return false;
|
|
if (isRetreat) return false;
|
|
if (isInSkilling) return false;
|
|
if (!isAttackActive) return false;
|
|
if (!isAllowAttack) return false;
|
|
return true;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 检查是否可以被当做被攻击目标
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public bool CheckCanBeTarget()
|
|
{
|
|
if (!canBeAttack) return false;
|
|
if (!owner.isReady) return false;
|
|
if (isDead) return false;
|
|
if (isOnVehicle) return false;
|
|
if (isPretend) return false;
|
|
return true;
|
|
}
|
|
|
|
public bool CheckCanPickFlag()
|
|
{
|
|
if (owner.commonData.troopId != ETroopsId.Self) return false;
|
|
if (owner.gameunitType != EGameUnitType.Character) return false;
|
|
var character = owner as Character.Character;
|
|
if (character == null) return false;
|
|
if (character.runtimeData.isInSuppressed) return false;
|
|
if (isPretend) return false;
|
|
if (isDead) return false;
|
|
if (isOnVehicle) return false;
|
|
if (isRetreat) return false;
|
|
if (isInSkilling) return false;
|
|
return true;
|
|
}
|
|
|
|
public UnitStatusData(GameUnit owner)
|
|
{
|
|
this.owner = owner;
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
isMoveing = false;
|
|
isDead = false;
|
|
canBeAttack = true;
|
|
isOnVehicle = false;
|
|
isChaos = false;
|
|
isStun = false;
|
|
isLockPos = false;
|
|
isRetreat = false;
|
|
needSkillPaused = false;
|
|
isInSkilling = false;
|
|
isNoRetreat = false;
|
|
isDeadRetreat = false;
|
|
}
|
|
}
|
|
}
|