Example #1
0
        public void StartUseItem(IEventArgs args, FreeData fd, ItemPosition ip, int sing, int sound)
        {
            PlayerStateUtil.RemoveGameState(EPlayerGameState.InterruptItem, fd.Player.gamePlay);
            fd.Player.playerMove.InterruptAutoRun();

            SkillTimeTrigger trigger = (SkillTimeTrigger)itemSkill.trigger;

            trigger.SetTime(sing * 1000);
            trigger.Reset();

            UsingItemAction interAction = (UsingItemAction)trigger.interAction;

            interAction.fd = fd;
            interAction.ip = ip;

            UsingItemAction action = (UsingItemAction)itemSkill.GetEffect();

            action.fd = fd;
            action.ip = ip;

            StartCounter(args, sing, fd, true);

            startUse = true;

            FreeSoundUtil.Stop("use", args, fd);

            if (sound > 0)
            {
                FreeSoundUtil.PlayOnce("use", sound, args, fd);
            }
        }
Example #2
0
        public override void DoAction(IEventArgs args)
        {
            if (inter)
            {
                if (fd != null)
                {
                    fd.freeInventory.StopUseItem(args, fd);
                    UseCommonAction use = new UseCommonAction();
                    use.key    = "showBottomTip";
                    use.values = new List <ArgValue>();
                    use.values.Add(new ArgValue("msg", "{desc:10072,{item.name}}"));

                    args.TempUse("current", fd);
                    args.TempUse("item", ip);
                    use.Act(args);
                    args.Resume("current");
                    args.Resume("item");
                    PlayerAnimationAction.DoAnimation(PlayerAnimationAction.Stop, fd.Player);
                    FreeSoundUtil.Stop("use", args, fd);

                    PlayerStateUtil.RemoveGameState(EPlayerGameState.InterruptItem, fd.Player.gamePlay);
                }
            }
            else
            {
                if (ip != null && fd != null)
                {
                    UseItem(ip, fd, (ISkillArgs)args);
                    fd.freeInventory.StopUseItem(args, fd);
                }
            }
        }