Exemple #1
0
        public void Start(IEventArgs args)
        {
            FreeRuleEventArgs fr = (FreeRuleEventArgs)args;

            args.TempUse("entity", this);
            args.TempUse(name, this);

            if (createAction != null)
            {
                createAction.Act(args);
            }

            FreeData creator = (FreeData)args.GetUnit("creator");

            if (creator != null)
            {
                CreatorId = creator.Player.playerInfo.EntityId;
            }

            if (skills != null && skills.Count > 0)
            {
                skill = new UnitSkill(this);
                foreach (ISkill sk in skills)
                {
                    skill.AddSkill(sk);
                }
            }

            move.Start(fr, _entity);

            xPara.SetValue(_entity.position.Value.x);
            yPara.SetValue(_entity.position.Value.y);
            zPara.SetValue(_entity.position.Value.z);

            if (effect != null)
            {
                AutoPositionValue auto = new AutoPositionValue();
                auto.SetId(_entity.entityKey.Value.EntityId.ToString());
                auto.SetField("pos");
                effect.AddAuto(auto);

                AutoScaleValue scale = new AutoScaleValue();
                scale.SetId(_entity.entityKey.Value.EntityId.ToString());
                scale.SetField("scale");
                effect.AddAuto(scale);

                effect.SetSelector(new PosAssignSelector(_entity.position.Value.x.ToString(),
                                                         _entity.position.Value.y.ToString(), _entity.position.Value.z.ToString()));

                //Debug.LogFormat("start pos {0}", _entity.position.Value.ToString());

                effect.Act(args);
            }

            args.Resume(name);
            args.Resume("entity");
        }
Exemple #2
0
        public virtual void OnCreate(IEventArgs skill)
        {
            startTime      = skill.Rule.ServerTime;
            this.ins       = new HashSet <long>();
            this.showedIds = new HashSet <long>();
            this.realKey   = FreeUtil.ReplaceVar(key, skill);
            this.realTime  = FreeUtil.ReplaceInt(time, skill);
            this.paras     = new SimpleParaList();

            skill.TempUse("buf", this);
            bool hasCreator = false;

            if (creator != null && creator.hasFreeData)
            {
                skill.TempUse("creator", (FreeData)this.creator.freeData.FreeData);
                hasCreator = true;
            }
            AddParas(skill);
            if (createAction != null)
            {
                createAction.Act(skill);
            }
            if (effectAction != null)
            {
                effectAction.SetSelector(GetPos(region.GetCenter(skill)));
                effectAction.SetKey("bufeffect_" + realKey);
            }
            else
            {
                if (show == null)
                {
                    show = new FreeEffectShowAction();
                    show.SetKey(effect);
                    show.SetPos(GetPos(region.GetCenter(skill)));
                }
            }
            skill.Resume("buf");
            if (creator != null && hasCreator)
            {
                skill.Resume("creator");
            }
            if (!StringUtil.IsNullOrEmpty(condition))
            {
                bufCondition = new ExpParaCondition(FreeUtil.ReplaceVar(condition, skill));
            }
        }
Exemple #3
0
        public void Start(IEventArgs args)
        {
            this.paras.AddFields(new ObjectFields(_entity.freeData));

            FreeRuleEventArgs fr = (FreeRuleEventArgs)args;

            args.TempUse("entity", this);
            args.TempUse(name, this);

            if (createAction != null)
            {
                createAction.Act(args);
            }

            FreeData creator = (FreeData)args.GetUnit("creator");

            if (creator != null)
            {
                CreatorId = creator.Player.playerInfo.EntityId;
            }

            if (skills != null && skills.Count > 0)
            {
                skill = new UnitSkill(this);
                foreach (ISkill sk in skills)
                {
                    skill.AddSkill(sk);
                }
            }

            move.Start(fr, _entity);

            xPara.SetValue(_entity.position.Value.x);
            yPara.SetValue(_entity.position.Value.y);
            zPara.SetValue(_entity.position.Value.z);

            if (effect != null)
            {
                AutoPositionValue auto = new AutoPositionValue();
                auto.SetId(_entity.entityKey.Value.EntityId.ToString());
                auto.SetField("pos");
                effect.AddAuto(auto);

                effect.SetSelector(new PosAssignSelector(_entity.position.Value.x.ToString(),
                                                         _entity.position.Value.y.ToString(), _entity.position.Value.z.ToString()));

                HashSet <int> playerIds = new HashSet <int>();
                foreach (PlayerEntity player in args.GameContext.player.GetInitializedPlayerEntities())
                {
                    playerIds.Add(player.entityKey.Value.EntityId);
                }
                effect.SetPlayerIds(playerIds);
                //Debug.LogFormat("start pos {0}", _entity.position.Value.ToString());

                effect.Act(args);

                lastEffectTime = args.Rule.ServerTime;
            }

            args.Resume(name);
            args.Resume("entity");
        }
Exemple #4
0
        public virtual bool OnCreate(IEventArgs skill)
        {
            startTime = skill.Rule.ServerTime;

            this.ins       = new HashSet <long>();
            this.showedIds = new HashSet <long>();
            this.realKey   = FreeUtil.ReplaceVar(key, skill);
            this.realTime  = FreeUtil.ReplaceInt(time, skill);
            this.paras     = new SimpleParaList();

            this.posindex = -1;
            ParaList list = skill.GetDefault().GetParameters();

            if (list.HasPara("posindex"))
            {
                posindex = (int)list.Get("posindex").GetValue();
            }
            skill.TempUse("buf", this);

            IPosSelector pos = GetPos(region.GetCenter(skill));

            if (pos.Select(skill).GetInvalid())
            {
                return(false);
            }

            bool hasCreator = false;

            if (creator != null && creator.hasFreeData)
            {
                skill.TempUse("creator", (FreeData)this.creator.freeData.FreeData);
                hasCreator = true;
            }
            AddParas(skill);
            if (createAction != null)
            {
                createAction.Act(skill);
            }
            if (effectAction != null)
            {
                effectAction.SetSelector(pos);
                effectAction.SetKey("bufeffect_" + realKey);
            }
            else
            {
                if (show == null)
                {
                    show = new FreeEffectShowAction();
                    show.SetKey(effect);
                    show.SetPos(pos);
                }
            }
            skill.Resume("buf");
            if (creator != null && hasCreator)
            {
                skill.Resume("creator");
            }
            if (!StringUtil.IsNullOrEmpty(condition))
            {
                bufCondition = new ExpParaCondition(FreeUtil.ReplaceVar(condition, skill));
            }
            return(true);
        }