Пример #1
0
        public static ISkImp getSkImp(EffectOp op)
        {
            ISkImp be = null;

            switch (op)
            {
            case EffectOp.Injury:
                be = new SkDamage_1();
                break;

            case EffectOp.MoveTarget:
                be = new SkMoveTarget_5();
                break;

            case EffectOp.MoveToChild:
                be = new SkMoveToChild_6();
                break;

            case EffectOp.CtorNPC:
                be = new SkCrtNpc_8();
                break;

            case EffectOp.Bullet_NPC:
                be = new SkBulletNpc_16();
                break;

            default:
                be = new EmptySkImp();
                break;
            }
            return(be);
        }
Пример #2
0
        public virtual void Skill_Handle()
        {
            if (STATE == NpcAnimState.CastSkill)
            {
                animationTimer      -= Time.deltaTime;
                animationEventTimer -= Time.deltaTime;
                if (animationEventTimer <= 0f && canTriggerEvent)
                {
                    canTriggerEvent = false;

                    WarSrcAnimParam srcParam = skParam as WarSrcAnimParam;
                    int             index    = srcParam.arg1;
                    List <ISkImp>   ops      = null;
                    ISkImp          sk       = null;
                    if (!sk_Imps.TryGetValue(index, out ops))
                    {
                        ops = new List <ISkImp>();
                        sk_Imps.Add(index, ops);
                    }
                    sk = ops.Find(imp => imp.SkOp() == srcParam.OP);
                    if (sk == null)
                    {
                        sk = SkImpFactory.getSkImp(srcParam.OP);
                        ops.Add(sk);
                    }
                    sk.Reset();
                    sk.InitSk(cachedNpc, srcParam);
                    sk.CastSk();
                }
                if (animationTimer < 0f)
                {
                    isCastSkill = false;
                    canNextAnim = true;
                    cachedNpc.HitAnimReset();
                    cachedNpc.curStatus = cachedNpc.curStatus.clear(NpcStatus.InSkill);
                    On_Stand(null);
                }
            }
        }
Пример #3
0
        public virtual void On_CastTrigger(WarMsgParam param)
        {
            if (STATE != NpcAnimState.Killed)
            {
                WarSrcAnimParam srcParam = param as WarSrcAnimParam;
                int             index    = param.arg1;
                List <ISkImp>   ops      = null;
                ISkImp          sk       = null;
                if (!sk_Imps.TryGetValue(index, out ops))
                {
                    ops = new List <ISkImp>();
                    sk_Imps.Add(index, ops);
                }
                sk = ops.Find(imp => imp.SkOp() == srcParam.OP);
                if (sk == null)
                {
                    sk = SkImpFactory.getSkImp(srcParam.OP);
                    ops.Add(sk);
                }
                sk.Reset();
                sk.InitSk(cachedNpc, param);
                sk.CastSk();
            }
            if (STATE != NpcAnimState.Killed && !isAttack && !isCastSkill)
            {
                WarSrcAnimParam srcParam = param as WarSrcAnimParam;
                skParam = srcParam;
                if (srcParam != null)
                {
                    STATE = NpcAnimState.CastTrigger;
                    Effect3DModelConfigData ecd = Core.Data.getIModelConfig <Effect3DModel>().get(srcParam.ShootAction);
                    if (ecd != null)
                    {
                        isCastSkill         = true;
                        canNextAnim         = false;
                        canTriggerEvent     = true;
                        animationTimer      = srcParam.ShootTime;
                        animationEventTimer = 0.2f;
                        SetHandler          = Trigger_Handle;

                        AnimationMsg msg = new AnimationMsg();
                        msg.animationTimer      = animationTimer;
                        msg.animationEventTimer = animationEventTimer;
                        msg.ecd           = ecd;
                        msg.animationName = ecd.Anim;
                        msg.targetId      = 0;

                        string a_data = JSON.Instance.ToJSON(msg);

                        NpcAnimInfo info = new NpcAnimInfo()
                        {
                            ClientID  = DeviceInfo.GUID,
                            nextState = NpcAnimState.CastBuff,
                            data      = a_data,
                        };

                        animMsg.nextAnim = WarMsg_Type.UseTrigger.ToString();
                        animMsg.uniqueId = cachedNpc.UniqueID;
                        animMsg.data     = JSON.Instance.ToJSON(info);

                        if (serMgr != null)
                        {
                            serMgr.realServer.proxyCli.NPCAnim(animMsg);
                        }
                    }
                    else
                    {
                        On_Stand(null);
                    }
                }
            }
        }