Exemplo n.º 1
0
    //中断可能正在执行的技能
    public void Interrupt(TypeOfInterruption type)
    {
        if (!GlobalConfigComponent.Instance.networkPlayMode)
        {
            //TODO: 根据当前使用技能允许的可打断类型判定打断是否可以成功

            CharacterStateComponent characterStateComponent = GetParent <Unit>().GetComponent <CharacterStateComponent>();
            if (characterStateComponent.Get(SpecialStateType.UnStoppable))
            {
                return;                                                           // 霸体状态,打断失败
            }
        }
        cancelToken?.Cancel();
        cancelToken = null;
    }
    //中断可能正在执行的技能
    public static void Interrupt(this ActiveSkillComponent self, TypeOfInterruption type)
    {
        //TODO: 根据当前使用技能允许的可打断类型判定打断是否可以成功

        CharacterStateComponent characterStateComponent = self.GetParent <Unit>().GetComponent <CharacterStateComponent>();

        if (characterStateComponent.Get(SpecialStateType.UnStoppable))
        {
            return;                                                           // 霸体状态,打断失败
        }
        self.cancelToken?.Cancel();
        self.cancelToken = null;
        M2C_InterruptSkill m2c = new M2C_InterruptSkill();

        m2c.Frame = Game.Scene.GetComponent <UnitStateMgrComponent>().currFrame;
        m2c.Id    = self.GetParent <Unit>().Id;
        ETHotfix.MessageHelper.Broadcast(m2c);
    }