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


C# Map.LineOfSight方法代码示例

本文整理汇总了C#中Server.Map.LineOfSight方法的典型用法代码示例。如果您正苦于以下问题:C# Map.LineOfSight方法的具体用法?C# Map.LineOfSight怎么用?C# Map.LineOfSight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Server.Map的用法示例。


在下文中一共展示了Map.LineOfSight方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnExplode

        public override void OnExplode( Mobile source, Item itemSource, int intensity, Point3D loc, Map map )
        {
            Server.Effects.PlaySound( loc, map, 0x22F );
            if ( itemSource is BombPotion )
            {
                BombPotion bomb = itemSource as BombPotion;
                int delay = (int)(intensity * Divisor);
                if ( delay <= 0 )
                    delay = 1;
                TimeSpan time = TimeSpan.FromSeconds( delay );

                List<Point3D> circlePoints = CircleHelper.CircleMidpoint( loc.X, loc.Y, loc.Z, bomb.ExplosionRange, true );
                Point3D eye = new Point3D( loc );
                eye.Z += 14;
                foreach( Point3D point in circlePoints )
                {
                    Point3D target = new Point3D(point);
                    target.Z += 14;
                    if ( map.LineOfSight( eye, target ) )
                    {
                        SmokeTile tile = new SmokeTile( time+TimeSpan.FromSeconds( Utility.RandomDouble()*5 ) );
                        tile.MoveToWorld( point, map );
                        tile.AddCurrentOccupants();
                    }
                }
            }
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:27,代码来源:SmokeEffect.cs

示例2: OnExplode

 public override void OnExplode( Mobile source, Item itemSource, int intensity, Point3D loc, Map map )
 {
     //Server.Effects.PlaySound( loc, map, 0x3B9 );
     foreach ( Mobile m in map.GetMobilesInRange( loc, ((BombPotion)itemSource).ExplosionRange ) )
         if ( m != null )
             if ( map.LineOfSight( loc, m ) )
                 m.MovingEffect( new Entity( Serial.Zero, loc, map ), 10244, 18, 1, false, false );
 }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:8,代码来源:ShrapnelEffect.cs

示例3: OnExplode

 public override void OnExplode( Mobile source, Item itemSource, int intensity, Point3D loc, Map map )
 {
     Server.Effects.PlaySound( loc, map, 283 + Utility.Random( 4 ) );
     if ( itemSource is BombPotion )
     {
         BombPotion bomb = itemSource as BombPotion;
         List<Point3D> circlePoints = CircleHelper.CircleMidpoint( loc.X, loc.Y, loc.Z, bomb.ExplosionRange, true );
         Point3D eye = new Point3D( loc );
         eye.Z += 14;
         foreach( Point3D point in circlePoints )
         {
             Point3D target = new Point3D(point);
             target.Z += 14;
             if ( map.LineOfSight( eye, target ) )
                 Server.Effects.SendLocationEffect( point, map, 0x36BD, 20 );
         }
     }
 }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:18,代码来源:ExplosionEffect.cs

示例4: OnExplode

        public override void OnExplode( Mobile source, Item itemSource, int intensity, Point3D loc, Map map )
        {
            Server.Effects.PlaySound( loc, map, 456 + Utility.Random( 3 ) );
            int range = 5;

            if ( itemSource is BombPotion )
                range = ((BombPotion)itemSource).ExplosionRange;

            int delay = (int)(intensity * Divisor);

            if ( delay <= 0 )
                delay = 1;

            TimeSpan time = TimeSpan.FromSeconds( delay );

            Point3D start = new Point3D( loc.X-range, loc.Y-range, loc.Z );
            Point3D end = new Point3D( loc.X+range, loc.Y+range, loc.Z );
            StickyGooRegion region = new StickyGooRegion( source, new Rectangle3D(
                start.X, start.Y, start.Z, end.X - start.X + 1, end.Y - start.Y + 1, 1
            ) );

            region.Register();
            Timer.DelayCall( time, new TimerStateCallback( ReleaseRegion ), region );

            List<Point3D> circlePoints = CircleHelper.CircleMidpoint( loc.X, loc.Y, loc.Z, range, true );
            Point3D eye = new Point3D( loc );
            eye.Z += 14;

            foreach( Point3D point in circlePoints )
            {
                Point3D target = new Point3D(point);
                target.Z += 14;
                if ( map.LineOfSight( eye, target ) )
                    new StickyGooTile( time+TimeSpan.FromSeconds( Utility.RandomDouble()*5 ) ).MoveToWorld( point, map );
            }
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:36,代码来源:StickyGooEffect.cs

示例5: Explode

        public void Explode( Mobile from, bool direct, Point3D loc, Map map )
        {
            if ( Deleted )
                return;

            Delete();

            for ( int i = 0; m_Users != null && i < m_Users.Count; ++i )
            {
                Mobile m = (Mobile)m_Users[i];
                ThrowTarget targ = m.Target as ThrowTarget;

                if ( targ != null && targ.Potion == this )
                    Target.Cancel( m );
            }

            if ( map == null )
            {
                return;
            }

            IPooledEnumerable eable = LeveledExplosion ? map.GetObjectsInRange( loc, m_ExplosionRange ) : map.GetMobilesInRange( loc, m_ExplosionRange );
            ArrayList toExplode = new ArrayList();

            int toDamage = 0;

            foreach ( object o in eable )
            {
                if ( o is Mobile )
                {
                    toExplode.Add( o );
                    ++toDamage;
                }
                else if ( o is BombPotion && o != this )
                {
                    toExplode.Add( o );
                }
            }

            eable.Free();

            foreach ( KeyValuePair<CustomEffect, int> kvp in Effects )
            {
                CustomPotionEffect effect = CustomPotionEffect.GetEffect( kvp.Key );
                if ( effect != null )
                    effect.OnExplode( from, this, kvp.Value, loc, map );
            }

            Point3D eye = new Point3D( loc );
            eye.Z += 14;

            for ( int i = 0; i < toExplode.Count; ++i )
            {
                object o = toExplode[i];

                if ( o is Mobile )
                {
                    Mobile m = (Mobile)o;
                    Point3D target = new Point3D( m.Location );
                    target.Z += 14;

                    if ( from == null || (SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false )) )
                    {
                        if ( o != null && map.LineOfSight( eye, target ) )
                        {
                            foreach ( KeyValuePair<CustomEffect, int> kvp in Effects )
                            {
                                CustomPotionEffect effect = CustomPotionEffect.GetEffect( kvp.Key );
                                if ( effect != null )
                                    effect.ApplyEffect( m, from, kvp.Value, this );
                            }
                        }
                    }
                }
                else if ( o is BombPotion )
                {
                    BombPotion pot = (BombPotion)o;
                    Point3D target = new Point3D( pot.Location );
                    target.Z += 14;
                    if ( o != null && map.LineOfSight( eye, target ) )
                        pot.Explode( from, false, pot.GetWorldLocation(), pot.Map );
                }
            }
        }
开发者ID:justdanofficial,项目名称:khaeros,代码行数:84,代码来源:BombPotion.cs

示例6: GetSpawnPosition

        public static Point3D GetSpawnPosition(Point3D from, Map map, int range)
        {
            if (map == null)
                return from;

            for (int i = 0; i < 10; i++)
            {
                int x = from.X + Utility.Random(range);
                int y = from.Y + Utility.Random(range);
                int z = map.GetAverageZ(x, y);

                if (Utility.RandomBool())
                    x *= -1;

                if (Utility.RandomBool())
                    y *= -1;

                Point3D p = new Point3D(x, y, from.Z);

                if (map.CanSpawnMobile(p) && map.LineOfSight(from, p))
                    return p;

                p = new Point3D(x, y, z);

                if (map.CanSpawnMobile(p) && map.LineOfSight(from, p))
                    return p;
            }

            return from;
        }
开发者ID:romeov007,项目名称:imagine-uo,代码行数:30,代码来源:Ilhenir.cs


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