当前位置: 首页>>代码示例>>C#>>正文


C# realm.RealmTime类代码示例

本文整理汇总了C#中wServer.realm.RealmTime的典型用法代码示例。如果您正苦于以下问题:C# RealmTime类的具体用法?C# RealmTime怎么用?C# RealmTime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RealmTime类属于wServer.realm命名空间,在下文中一共展示了RealmTime类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TickCore

 protected override void TickCore(Entity host, RealmTime time, ref object state)
 {
     condition.Tick(host, time);
     if (condition.Result)
         foreach (var i in behaviors)
             i.Tick(host, time);
 }
开发者ID:Club559,项目名称:Travs-Domain-Server,代码行数:7,代码来源:If.cs

示例2: TickCore

        protected override bool TickCore(RealmTime time)
        {
            if (Host.Self.HasConditionEffect(ConditionEffects.Paralyzed)) return true;
            var speed = this.speed * GetSpeedMultiplier(Host.Self);

            WanderingState state;
            object o;
            if (!Host.StateStorage.TryGetValue(Key, out o))
                Host.StateStorage[Key] = state = new WanderingState();
            else
            {
                state = (WanderingState)o;

                var dist = speed / 1.5f * (time.thisTickTimes / 1000f);
                state.remainingDist -= dist;
                ValidateAndMove(Host.Self.X + state.x * dist, Host.Self.Y + state.y * dist);
                Host.Self.UpdateCount++;
            }

            bool ret;
            if (state.remainingDist <= 0)
            {
                state.x = rand.Next(-1, 2);
                state.y = rand.Next(-1, 2);
                state.remainingDist = dist + dist * (float)(rand.NextDouble() * 0.1 - 0.05);
                ret = true;
            }
            else
                ret = false;
            return ret;
        }
开发者ID:BlackRayquaza,项目名称:PhoenixRealms,代码行数:31,代码来源:SimpleWandering.cs

示例3: TickCore

        protected override void TickCore(Entity host, RealmTime time, ref object state)
        {
            WanderStorage storage;
            if (state == null) storage = new WanderStorage();
            else storage = (WanderStorage)state;

            Status = CycleStatus.NotStarted;

            if (host.HasConditionEffect(ConditionEffects.Paralyzed)) return;

            Status = CycleStatus.InProgress;
            if (storage.RemainingDistance <= 0)
            {
                storage.Direction = new Vector2(Random.Next(-1, 2), Random.Next(-1, 2));
                storage.Direction.Normalize();
                storage.RemainingDistance = period.Next(Random) / 1000f;
                Status = CycleStatus.Completed;
            }
            float dist = host.GetSpeed(speed) * (time.thisTickTimes / 1000f);
            host.ValidateAndMove(host.X + storage.Direction.X * dist, host.Y + storage.Direction.Y * dist);
            host.UpdateCount++;

            storage.RemainingDistance -= dist;

            state = storage;
        }
开发者ID:RoxyLalonde,项目名称:Phoenix-Realms,代码行数:26,代码来源:Wander.cs

示例4: TickCore

        protected override void TickCore(Entity host, RealmTime time, ref object state)
        {
            int cooldown;
            if (state == null) cooldown = 1000;
            else cooldown = (int)state;

            Status = CycleStatus.NotStarted;

            if (host.HasConditionEffect(ConditionEffects.Paralyzed)) return;

            var player = (Player)host.GetNearestEntity(distance, null);
            if (player != null)
            {
                Vector2 vect;
                vect = new Vector2(player.X - host.X, player.Y - host.Y);
                vect.Normalize();
                float dist = host.GetSpeed(speed) * (time.thisTickTimes / 1000f);
                host.ValidateAndMove(host.X + (-vect.X) * dist, host.Y + (-vect.Y) * dist);
                host.UpdateCount++;

                if (cooldown <= 0)
                {
                    Status = CycleStatus.Completed;
                    cooldown = 1000;
                }
                else
                {
                    Status = CycleStatus.InProgress;
                    cooldown -= time.thisTickTimes;
                }
            }

            state = cooldown;
        }
开发者ID:RoxyLalonde,项目名称:Phoenix-Realms,代码行数:34,代码来源:StayBack.cs

示例5: TickCore

        protected override bool TickCore(RealmTime time)
        {
            var radius = dist;
            var entity = GetNearestEntityPet(ref radius) as Enemy;

            if (entity != null)
            {
                entity.Owner.BroadcastPacket(new ShowEffectPacket
                {
                    EffectType = EffectType.AreaBlast,
                    Color = new ARGB(0x3E3A78),
                    TargetId = entity.Id,
                    PosA = new Position { X = 1 }
                }, null);
                entity.Owner.BroadcastPacket(new ShowEffectPacket
                {
                    EffectType = EffectType.Trail,
                    TargetId = Host.Self.Id,
                    PosA = new Position { X = entity.X, Y = entity.Y },
                    Color = new ARGB(0x3E3A78)
                }, null);
                entity.Damage(Host.Self.PlayerOwner, time, 35, false);
            }
            return false;
        }
开发者ID:BlackRayquaza,项目名称:PhoenixRealms,代码行数:25,代码来源:PurpleDrakeAttack.cs

示例6: TickCore

        protected override bool TickCore(RealmTime time)
        {
            if (Host.Self.HasConditionEffect(ConditionEffects.Paralyzed)) return true;
            var speed = this.speed*GetSpeedMultiplier(Host.Self);

            var dist = radius;
            var entity = GetNearestEntity(ref dist, objType);
            if (entity != null && dist > targetRadius)
            {
                var tx = entity.X + rand.Next(-2, 2)/2f;
                var ty = entity.Y + rand.Next(-2, 2)/2f;
                if (tx != Host.Self.X || ty != Host.Self.Y)
                {
                    var x = Host.Self.X;
                    var y = Host.Self.Y;
                    var vect = new Vector2(tx, ty) - new Vector2(Host.Self.X, Host.Self.Y);
                    vect.Normalize();
                    vect *= (speed/1.5f)*(time.thisTickTimes/1000f);
                    ValidateAndMove(Host.Self.X + vect.X, Host.Self.Y + vect.Y);
                    Host.Self.UpdateCount++;
                }
                return true;
            }
            return false;
        }
开发者ID:RoxyLalonde,项目名称:Phoenix-Realms,代码行数:25,代码来源:Chasing.cs

示例7: TickCore

        protected override bool TickCore(RealmTime time)
        {
            float dist = 8;
            var entity = GetNearestEntityByGroup(ref dist, "Golem");
            if (entity != null && dist > 4)
            {
                ValidateAndMove(entity.X, entity.Y);
                Host.StateStorage[Key] = 30*1000;
                return true;
            }
            if (entity == null)
            {
                int remainingTick;
                object obj;
                if (!Host.StateStorage.TryGetValue(Key, out obj))
                    remainingTick = 30*1000;
                else
                    remainingTick = (int) obj;

                remainingTick -= time.thisTickTimes;
                if (remainingTick <= 0)
                    Host.Self.Owner.LeaveWorld(Host.Self);
                Host.StateStorage[Key] = remainingTick;
                return false;
            }
            Host.StateStorage[Key] = 30*1000;
            return true;
        }
开发者ID:RoxyLalonde,项目名称:Phoenix-Realms,代码行数:28,代码来源:GolemSatellites.cs

示例8: TickCore

        protected override void TickCore(Entity host, RealmTime time, ref object state)
        {
            BuzzStorage storage = (BuzzStorage)state;

            Status = CycleStatus.NotStarted;

            if (host.HasConditionEffect(ConditionEffects.Paralyzed)) return;

            if (storage.RemainingTime > 0)
            {
                storage.RemainingTime -= time.thisTickTimes;
                Status = CycleStatus.NotStarted;
            }
            else
            {
                Status = CycleStatus.InProgress;
                if (storage.RemainingDistance <= 0)
                {
                    do
                    {
                        storage.Direction = new Vector2(Random.Next(-1, 2), Random.Next(-1, 2));
                    } while (storage.Direction.X == 0 && storage.Direction.Y == 0);
                    storage.Direction.Normalize();
                    storage.RemainingDistance = this.dist;
                    Status = CycleStatus.Completed;
                }
                float dist = host.GetSpeed(speed) * (time.thisTickTimes / 1000f);
                host.ValidateAndMove(host.X + storage.Direction.X * dist, host.Y + storage.Direction.Y * dist);
                host.UpdateCount++;

                storage.RemainingDistance -= dist;
            }

            state = storage;
        }
开发者ID:RoxyLalonde,项目名称:Phoenix-Realms,代码行数:35,代码来源:Buzz.cs

示例9: TickCore

        protected override bool TickCore(RealmTime time)
        {
            if (Host.Self.HasConditionEffect(ConditionEffects.Stunned)) return false;

            var chr = Host as Character;
            var startAngle = angle - projAngle * (numShot - 1) / 2;
            var desc = chr.ObjectDesc.Projectiles[projectileIndex];

            byte prjId = 0;
            Position prjPos = new Position() { X = chr.X, Y = chr.Y };
            var dmg = chr.Random.Next(desc.MinDamage, desc.MaxDamage);
            for (int i = 0; i < numShot; i++)
            {
                var prj = chr.CreateProjectile(
                    desc, chr.ObjectType, dmg, time.tickTimes,
                    prjPos, (float)(startAngle + projAngle * i));
                chr.Owner.EnterWorld(prj);
                if (i == 0)
                    prjId = prj.ProjectileId;
            }
            chr.Owner.BroadcastPacket(new MultiShootPacket()
            {
                BulletId = prjId,
                OwnerId = Host.Self.Id,
                BulletType = (byte)desc.BulletType,
                Position = prjPos,
                Angle = (float)startAngle,
                Damage = (short)dmg,
                NumShots = (byte)numShot,
                AngleIncrement = (float)projAngle,
            }, null);
            return true;
        }
开发者ID:rotmgkillroyx,项目名称:rotmg_svr_OLD,代码行数:33,代码来源:AngleMultiAttack.cs

示例10: BehaveCore

        protected override void BehaveCore(BehaviorCondition cond, RealmTime? time, object state)
        {
            if (Host.Self.Owner.Name != "Battle Arena" && Host.Self.Owner.Name != "Free Battle Arena")
            {
                if (new Random().Next(1, 100) <= percent)
                {
                    var entity = Entity.Resolve(objType) as Portal;
                    var parent = Host as Entity;
                    entity.Move(parent.X, parent.Y);
                    parent.Owner.EnterWorld(entity);
                    var w = RealmManager.GetWorld(Host.Self.Owner.Id);
                    w.Timers.Add(new WorldTimer(timeExist*1000, (world, t) =>
                    {
                        if (timeExist > 0)
                            try
                            {
                                w.LeaveWorld(entity);
                            }

                            catch
                            {
                            }
                    }));
                }
            }
        }
开发者ID:RiiggedMPGH,项目名称:Owl-Realms-Source,代码行数:26,代码来源:DeathTransmute.cs

示例11: TickCore

        protected override bool TickCore(RealmTime time)
        {
            var chr = Host as Character;
            var target = new Position
            {
                X = Host.Self.X,
                Y = Host.Self.Y
            };
            target.X += (float) Math.Cos(angle)*range;
            target.Y += (float) Math.Sin(angle)*range;
            chr.Owner.BroadcastPacket(new ShowEffectPacket
            {
                TargetId = Host.Self.Id,
                PosA = target
            }, null);
            chr.Owner.Timers.Add(new WorldTimer(1500, (world, t) =>
            {
                var entity = Entity.Resolve(objType);
                entity.Move(target.X, target.Y);
                (entity as Enemy).Terrain = (chr as Enemy).Terrain;
                world.EnterWorld(entity);
            }));

            return true;
        }
开发者ID:RiiggedMPGH,项目名称:Owl-Realms-Source,代码行数:25,代码来源:TossEnemyNull.cs

示例12: TickCore

        protected override bool TickCore(RealmTime time)
        {
            if (Host.Self.HasConditionEffect(ConditionEffects.Paralyzed)) return true;
            var speed = this.speed * GetSpeedMultiplier(Host.Self);

            float dist = radius;
            Entity entity = GetNearestEntity(ref dist, objType);
            Character chr = Host as Character;
            if (entity != null && chr.HP < threshold)
            {
                var x = Host.Self.X;
                var y = Host.Self.Y;
                Vector2 vect = new Vector2(entity.X, entity.Y) - new Vector2(Host.Self.X, Host.Self.Y);
                vect.Normalize();
                vect *= -1 * (speed / 1.5f) * (time.thisTickTimes / 1000f);
                ValidateAndMove(Host.Self.X + vect.X, Host.Self.Y + vect.Y);
                Host.Self.UpdateCount++;

                if (!Host.StateStorage.ContainsKey(Key))
                {
                    chr.Owner.BroadcastPacket(new ShowEffectPacket()
                    {
                        EffectType = EffectType.Flashing,
                        PosA = new Position() { X = 1, Y = 1000000 },
                        TargetId = chr.Id,
                        Color = new ARGB(0xff303030)
                    }, null);
                    Host.StateStorage[Key] = true;
                }

                return true;
            }
            else return false;
        }
开发者ID:rotmgkillroyx,项目名称:rotmg_svr_OLD,代码行数:34,代码来源:Escaping.cs

示例13: TickCore

        protected override bool TickCore(RealmTime time)
        {
            int remainingTick;
            object o;
            if (!Host.StateStorage.TryGetValue(Key, out o))
                remainingTick = 0;
            else
                remainingTick = (int)o;

            remainingTick -= time.thisTickTimes;
            bool ret;
            if (remainingTick <= 0)
            {
                if (CountEntity(radius, objType) < maxCount)
                {
                    Entity entity = Entity.Resolve(objType);
                    entity.Move(Host.Self.X, Host.Self.Y);
                    (entity as Enemy).Terrain = (Host as Enemy).Terrain;
                    Host.Self.Owner.EnterWorld(entity);
                }

                remainingTick = rand.Next(minTick, maxTick);
                ret = true;
            }
            else
                ret = false;
            Host.StateStorage[Key] = remainingTick;
            return ret;
        }
开发者ID:rotmgkillroyx,项目名称:rotmg_svr_OLD,代码行数:29,代码来源:SpawnMinion.cs

示例14: OnStateEntry

 protected override void OnStateEntry(Entity host, RealmTime time, ref object state)
 {
     Entity[] ens = host.GetNearestEntities(dist).ToArray();
     foreach (Entity e in ens)
         if (e.ObjectType == host.Manager.GameData.IdToObjectType[children])
             host.Owner.LeaveWorld(e);
 }
开发者ID:OryxAwakening,项目名称:Fabiano_Swagger_of_Doom,代码行数:7,代码来源:RemoveEntity.cs

示例15: TickCore

        protected override bool TickCore(RealmTime time)
        {
            if (Host.Self.HasConditionEffect(ConditionEffects.Paralyzed)) return true;
            var speed = this.speed * GetSpeedMultiplier(Host.Self);

            float d;
            object o;
            if (!Host.StateStorage.TryGetValue(Key, out o))
                Host.StateStorage[Key] = d = dist;
            else
            {
                d = (float)o;

                float dd = (speed / 1.5f) * (time.thisTickTimes / 1000f);
                d -= dd;
                ValidateAndMove(Host.Self.X + (float)Math.Cos(angle) * dd, Host.Self.Y + (float)Math.Sin(angle) * dd);
                Host.Self.UpdateCount++;
            }

            bool ret;
            if (d <= 0)
            {
                d = dist;
                ret = true;
            }
            else
                ret = false;
            Host.StateStorage[Key] = d;
            return ret;
        }
开发者ID:rotmgkillroyx,项目名称:rotmg_svr_OLD,代码行数:30,代码来源:AngleMove.cs


注:本文中的wServer.realm.RealmTime类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。