2024-05-31 19:44:10 +08:00
|
|
|
using Gameplay.Character;
|
2024-07-10 19:51:24 +08:00
|
|
|
using Gameplay.PostProcess.BlackArea;
|
2023-12-13 16:20:41 +08:00
|
|
|
namespace Gameplay.Unit.Data
|
2023-08-22 19:08:45 +08:00
|
|
|
{
|
|
|
|
|
public class UnitStatusData
|
|
|
|
|
{
|
2023-10-19 15:00:19 +08:00
|
|
|
public readonly GameUnit owner;
|
2024-06-11 19:36:19 +08:00
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 是否正在移动
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool isMoveing = false;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否已死亡
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool isDead = false;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否可以被攻击
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool canBeAttack = true;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否在载具上
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool isOnVehicle = false;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
|
|
|
/// <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;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
2023-12-25 19:00:08 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 是否是AI控制
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool isAIControll = false;
|
|
|
|
|
|
2024-01-17 14:09:16 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 是否是伪装状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool isPretend = false;
|
|
|
|
|
|
2024-03-22 14:25:27 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 是否是死撑状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool isDeadRetreat = false;
|
|
|
|
|
|
2024-06-05 14:38:13 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 是否是扛旗状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool isHoldFlag = false;
|
2024-06-12 19:09:10 +08:00
|
|
|
|
|
|
|
|
public GameUnit lastAttackUnit = null;
|
2024-06-05 14:38:13 +08:00
|
|
|
|
2024-07-03 19:21:10 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 是否激活攻击
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool isAttackActive = false;
|
|
|
|
|
|
2024-07-09 19:26:04 +08:00
|
|
|
/// <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;
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
/// <summary>
|
|
|
|
|
/// 检查是否可以被当做被攻击目标
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public bool CheckCanBeTarget()
|
|
|
|
|
{
|
|
|
|
|
if (!canBeAttack) return false;
|
2023-10-19 15:00:19 +08:00
|
|
|
if (!owner.isReady) return false;
|
2023-08-22 19:08:45 +08:00
|
|
|
if (isDead) return false;
|
|
|
|
|
if (isOnVehicle) return false;
|
2024-01-17 14:09:16 +08:00
|
|
|
if (isPretend) return false;
|
2024-07-10 19:51:24 +08:00
|
|
|
if (owner.commonData.troopId != ETroopsId.Self)
|
|
|
|
|
{
|
|
|
|
|
if (!BlackAreaManager.instance.CheckIsInLightArea(owner.transData.cellIndex))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
return true;
|
|
|
|
|
}
|
2024-05-31 19:44:10 +08:00
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
|
|
|
public UnitStatusData(GameUnit owner)
|
|
|
|
|
{
|
|
|
|
|
this.owner = owner;
|
|
|
|
|
}
|
2023-12-19 14:26:50 +08:00
|
|
|
|
|
|
|
|
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;
|
2024-03-22 14:25:27 +08:00
|
|
|
isDeadRetreat = false;
|
2023-12-19 14:26:50 +08:00
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
}
|
|
|
|
|
}
|