Esempio n. 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");
        }
Esempio n. 2
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");
        }