68 lines
2.0 KiB
C#
68 lines
2.0 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace Continentis.MainGame.Character
|
|
{
|
|
public enum StatusType
|
|
{
|
|
//负面状态
|
|
Incapacitation = 0, //失能,丧失一切行动能力
|
|
Silence = 1, //沉默,无法使用魔法牌 (Magic)
|
|
Disarm = 2, //缴械,无法使用攻击牌 (Attack)
|
|
Inhibition = 3, //抑制,无法使用能力牌 (Ability)
|
|
Heavy = 4, //沉重,无法再抽牌
|
|
|
|
//正面状态
|
|
Invincible = 1000, //无敌
|
|
Invisible = 1001, //隐身
|
|
|
|
//中性状态
|
|
Taunt = 2000, //嘲讽
|
|
Protected = 2001, //被保护
|
|
}
|
|
|
|
public partial class StatusSubmodule : SubmoduleBase<CharacterBase>
|
|
{
|
|
public Dictionary<StatusType, int> currentStatus;
|
|
public bool isDead;
|
|
|
|
public StatusSubmodule(CharacterBase character) : base(character)
|
|
{
|
|
currentStatus = new Dictionary<StatusType, int>();
|
|
foreach (StatusType statusType in System.Enum.GetValues(typeof(StatusType)))
|
|
{
|
|
currentStatus.Add(statusType, 0);
|
|
}
|
|
|
|
isDead = false;
|
|
}
|
|
}
|
|
|
|
public partial class StatusSubmodule
|
|
{
|
|
/// <summary>
|
|
/// 添加一层某种状态
|
|
/// </summary>
|
|
public void AddStatus(StatusType statusType)
|
|
{
|
|
currentStatus[statusType]++;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 移除某个来源对应的一层状态,注意:如果有其他来源的状态,不会彻底结束状态效果。
|
|
/// </summary>
|
|
public void RemoveStatus(StatusType statusType)
|
|
{
|
|
currentStatus[statusType]--;
|
|
currentStatus[statusType] = Mathf.Max(currentStatus[statusType], 0);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 检查是否有某种状态
|
|
/// </summary>
|
|
public bool HasStatus(StatusType statusType)
|
|
{
|
|
return currentStatus[statusType] > 0;
|
|
}
|
|
}
|
|
} |