public uint this[ActiveFlagsDef index]
 {
     get
     {
         return(mFlagsContainer[(uint)index]);
     }
 }
Beispiel #2
0
    /// <summary>
    /// Owner的动态标记发生变化, 通知每个Action, 从而得知这些Action哪些需要被终止.
    /// </summary>
    /// <param name="flagName">动态标记标识</param>
    /// <param name="increased">该标识当前的计数是增加还是减少</param>
    /// <param name="impactAlreadyHappened">影响已经发生的技能效果, 动作等</param>
    protected virtual void onActiveFlagStateChanged(ActiveFlagsDef flagName, bool increased, bool impactAlreadyHappened)
    {
        if (impactAlreadyHappened && mActionCenter != null)
        {
            mActionCenter.OnActiveFlagsStateChanged(flagName, increased);
        }

        uint count = mActiveFlagsContainer[flagName];

        switch (flagName)
        {
        // 如果`神圣`的标志值增加, 那么移除当前所有的有害技能效果.
        case ActiveFlagsDef.Inviolability:
            if (impactAlreadyHappened && mSkillEffectManager != null && increased)
            {
                mSkillEffectManager.ForEverySkillEffect(
                    new SkillUtilities.KillHarmfulSkillBuff(true)
                    );
            }
            break;

        // 描边效果.
        case ActiveFlagsDef.StrokeEffect:
        {
            if (count != 0)
            {
                FlyIntoaRage();
            }
            else
            {
                LeaveFromaRange();
            }
        }
        break;

        // 变身恢复.
        case ActiveFlagsDef.Transformed:
            if (count == 0)
            {
                if (mModelResID != InitModelID)
                {
                    ChangeModel(InitModelID);
                }

                ChangeSkill(null);
            }
            break;

        // 免疫控制, 移除当前单位上带有控制的技能效果.
        case ActiveFlagsDef.StunImmunity:
            if (impactAlreadyHappened && mSkillEffectManager != null && increased)
            {
                mSkillEffectManager.ForEverySkillEffect(
                    new SkillUtilities.KillSkillBuffWithStunEffect()
                    );
            }

            break;
        }
    }
 public void AddCount(ActiveFlagsDef index, bool increase)
 {
     if (increase)
     {
         ++mFlagsContainer[(uint)index];
     }
     else
     {
         if (mFlagsContainer[(uint)index] == 0)
         {
             ErrorHandler.Parse(ErrorCode.LogicError, "failed to DECREASE active flags " + index + ", which is already zero");
             return;
         }
         --mFlagsContainer[(uint)index];
     }
 }
Beispiel #4
0
    public override bool OnActiveFlagsStateChanged(ActiveFlagsDef flagName, bool increased)
    {
        if (!increased)
        {
            return(true);
        }
        switch (flagName)
        {
        // displace的中途, 被控制移动, 那么停止displace.
        case ActiveFlagsDef.DisableMovement:
            return(false);

        default:
            break;
        }
        return(true);
    }
Beispiel #5
0
    public override bool OnActiveFlagsStateChanged(ActiveFlagsDef flagName, bool increased)
    {
        if (!increased)
        {
            return(true);
        }

        switch (flagName)
        {
        case ActiveFlagsDef.DisableAttack:
            return(!mSkillUsing.IsRegularAttack);

        case ActiveFlagsDef.DisableSkillUse:
            return(mSkillUsing.IsRegularAttack);

        default:
            break;
        }

        return(true);
    }
    /// <summary>
    /// Owner的动态标记发生变化, 通知每个Action, 从而得知这些Action哪些需要被终止.
    /// </summary>
    /// <param name="flagName">动态标记标识</param>
    public void OnActiveFlagsStateChanged(ActiveFlagsDef flagName, bool increased)
    {
        for (ActionTypeDef type = ActionTypeDef.ActionTypeIdle; type < ActionTypeDef.ActionTypeCount; ++type)
        {
            Action action = GetActionByType(type);
            if (action == null)
            {
                continue;
            }

            if (!action.OnActiveFlagsStateChanged(flagName, increased))
            {
                action.Stop(false);
            }
        }

        if (flagName == ActiveFlagsDef.IsDead)
        {
            IdleAction.SetActive(Owner.isAlive());
        }
    }
Beispiel #7
0
 /// <summary>
 /// 活动状态发生变化时, 通知每个action. 返回该action是否可以继续.
 /// 如果返回false, 该Action会被管理器停止.
 /// 尽量不要在每个Action的Update里轮询.
 /// </summary>
 /// <param name="flagName"></param>
 /// <returns></returns>
 public virtual bool OnActiveFlagsStateChanged(ActiveFlagsDef flagName, bool increased)
 {
     return(true);
 }
Beispiel #8
0
 /// <summary>
 /// 增加活动标记的计数(+-1).
 /// </summary>
 /// <param name="increase">增加或者减少计数</param>
 /// <param name="impactAlreadyHappened">是否影响当前已经发生的Action, SkillEffect等</param>
 public void AddActiveFlag(ActiveFlagsDef flagName, bool increase, bool impactAlreadyHappened)
 {
     mActiveFlagsContainer.AddCount(flagName, increase);
     onActiveFlagStateChanged(flagName, increase, impactAlreadyHappened);
 }
 /// <summary>
 /// 是否为控制标记.
 /// </summary>
 public static bool IsStunFlag(ActiveFlagsDef flag)
 {
     return(flag >= ActiveFlagsDef.DisableMovement && flag < ActiveFlagsDef.StunImmunity);
 }