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


C# World类代码示例

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


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

示例1: SupportPowerTimerWidget

 public SupportPowerTimerWidget(World world)
 {
     powers = world.ActorsWithTrait<SupportPowerManager>()
         .Where(p => !p.Actor.IsDead() && !p.Actor.Owner.NonCombatant)
         .SelectMany(s => s.Trait.Powers.Values)
         .Where(p => p.Instances.Any() && p.Info.DisplayTimer && !p.Disabled);
 }
开发者ID:RobotCaleb,项目名称:OpenRA,代码行数:7,代码来源:SupportPowerTimerWidget.cs

示例2: ApplySetPieces

        public static void ApplySetPieces(World world)
        {
            var map = world.Map;
            int w = map.Width, h = map.Height;

            Random rand = new Random();
            HashSet<Rect> rects = new HashSet<Rect>();
            foreach (var dat in setPieces)
            {
                int size = dat.Item1.Size;
                int count = rand.Next(dat.Item2, dat.Item3);
                for (int i = 0; i < count; i++)
                {
                    IntPoint pt = new IntPoint();
                    Rect rect;

                    int max = 50;
                    do
                    {
                        pt.X = rand.Next(0, w);
                        pt.Y = rand.Next(0, h);
                        rect = new Rect() { x = pt.X, y = pt.Y, w = size, h = size };
                        max--;
                    } while ((Array.IndexOf(dat.Item4, map[pt.X, pt.Y].Terrain) == -1 ||
                             rects.Any(_ => Rect.Intersects(rect, _))) &&
                             max > 0);
                    if (max <= 0) continue;
                    dat.Item1.RenderSetPiece(world, pt);
                    rects.Add(rect);
                }
            }
        }
开发者ID:BlackRayquaza,项目名称:MMOE,代码行数:32,代码来源:SetPieces.cs

示例3: OnBlockPlaced

 public override bool OnBlockPlaced(World world, Vector3 position, Vector3 clickedBlock, Vector3 clickedSide, Vector3 cursorPosition, Entities.Entity usedBy)
 {
     Metadata = (byte)MathHelper.DirectionByRotationFlat(usedBy);
     switch ((Direction)Metadata)
     {
         case Direction.North:
             Metadata = (byte)StairDirections.North;
             break;
         case Direction.South:
             Metadata = (byte)StairDirections.South;
             break;
         case Direction.West:
             Metadata = (byte)StairDirections.West;
             break;
         case Direction.East:
             Metadata = (byte)StairDirections.East;
             break;
     }
     if (clickedSide == Vector3.Down)
         Metadata |= 4;
     else if (clickedSide != Vector3.Up)
     {
         if (cursorPosition.Y >= 8)
             Metadata |= 4;
     }
     return true;
 }
开发者ID:seaboy1234,项目名称:Craft.Net,代码行数:27,代码来源:StairBlock.cs

示例4: ObserverSupportPowerIconsWidget

		public ObserverSupportPowerIconsWidget(World world, WorldRenderer worldRenderer)
		{
			this.world = world;
			this.worldRenderer = worldRenderer;
			clocks = new Dictionary<string, Animation>();
			icon = new Animation(world, "icon");
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:7,代码来源:ObserverSupportPowerIconsWidget.cs

示例5: Order

        public IEnumerable<Order> Order(World world, int2 xy, MouseInput mi)
        {
            if (mi.Button == MouseButton.Right)
                world.CancelInputMode();

            return OrderInner(world, xy, mi);
        }
开发者ID:pdovy,项目名称:OpenRA,代码行数:7,代码来源:RepairOrderGenerator.cs

示例6: Tick

        public void Tick(World world)
        {
            if (!a.IsInWorld || a.IsDead() || !a.Trait<CanPowerDown>().Disabled)
                world.AddFrameEndTask(w => w.Remove(this));

            anim.Tick();
        }
开发者ID:sonygod,项目名称:OpenRA-Dedicated-20120504,代码行数:7,代码来源:PowerdownIndicator.cs

示例7: ProductionQueueFromSelection

        public ProductionQueueFromSelection(World world, ProductionQueueFromSelectionInfo info)
        {
            this.world = world;

            tabsWidget = Exts.Lazy(() => Ui.Root.GetOrNull(info.ProductionTabsWidget) as ProductionTabsWidget);
            paletteWidget = Exts.Lazy(() => Ui.Root.GetOrNull(info.ProductionPaletteWidget) as ProductionPaletteWidget);
        }
开发者ID:RobotCaleb,项目名称:OpenRA,代码行数:7,代码来源:ProductionQueueFromSelection.cs

示例8: RenderSetPiece

        public void RenderSetPiece(World world, IntPoint pos)
        {
            for (int x = 0; x < Size; x++)
                for (int y = 0; y < Size; y++)
                {
                    double dx = x - (Size / 2.0);
                    double dy = y - (Size / 2.0);
                    double r = Math.Sqrt(dx * dx + dy * dy) + rand.NextDouble() * 4 - 2;
                    if (r <= 10)
                    {
                        var tile = world.Map[x + pos.X, y + pos.Y].Clone();
                        tile.TileId = Floor; tile.ObjType = 0;
                        world.Obstacles[x + pos.X, y + pos.Y] = 0;
                        world.Map[x + pos.X, y + pos.Y] = tile;
                    }
                }

            Entity lord = Entity.Resolve(0x675);
            lord.Move(pos.X + 15.5f, pos.Y + 15.5f);
            world.EnterWorld(lord);

            Container container = new Container(0x0501, null, false);
            int count = rand.Next(5, 8);
            List<Item> items = new List<Item>();
            while (items.Count < count)
            {
                Item item = chest.GetRandomLoot(rand);
                if (item != null) items.Add(item);
            }
            for (int i = 0; i < items.Count; i++)
                container.Inventory[i] = items[i];
            container.Move(pos.X + 15.5f, pos.Y + 15.5f);
            world.EnterWorld(container);
        }
开发者ID:rotmgkillroyx,项目名称:rotmg_svr_OLD,代码行数:34,代码来源:Pyre.cs

示例9: Thrower

 public Thrower(Vector2f pos, World parent, bool add = true)
     : base(Rsc.Tex("rsc/Throw.png"), pos, parent, add)
 {
     Origin = new Vector2f(32, 1);
     _visible = false;
     Col.A = 100;
 }
开发者ID:gigimoi,项目名称:ld25-Inversetroids,代码行数:7,代码来源:Thrower.cs

示例10: Update

        public override void Update(World world)
        {
            if (rect.Intersects(world.player.hitbox))
            {
                if (!triggered)
                {
                    triggered = true;
                    Trigger(world);
                }
            }
            else
            {
                triggered = false;
            }

            /*if (id == 0)
            {
                rect.X += 1;
                if (rect.Intersects(world.player.hitbox))
                {
                    world.LoadWorld(1);
                }
            }

            if (id == 1)
            {
            }*/
        }
开发者ID:BlueTRaven,项目名称:Lemonade,代码行数:28,代码来源:TileDynamic1.cs

示例11: TestBuckets

        public void TestBuckets()
        {
            World world = new World(new Level(), new FlatlandGenerator());
            world.WorldGenerator.Initialize(new Level());
            PlayerEntity player = new PlayerEntity(Difficulty.Normal)
            {
                GameMode = GameMode.Creative
            };
            Vector3 targetBlock = new Vector3(0, 2, 0);
            Vector3 alteredBlock = targetBlock + Vector3.Up;
            world.SetBlock(alteredBlock, new AirBlock());

            BucketItem bucket = new BucketItem();
            LavaBucketItem lavaBucket = new LavaBucketItem();
            WaterBucketItem waterBucket = new WaterBucketItem();

            // TODO: Survival tests
            waterBucket.OnItemUsedOnBlock(world, targetBlock, Vector3.Up, Vector3.Zero, player);
            Assert.AreEqual(new WaterFlowingBlock(), world.GetBlock(alteredBlock));

            bucket.OnItemUsedOnBlock(world, targetBlock, Vector3.Up, Vector3.Zero, player);
            Assert.AreEqual(new AirBlock(), world.GetBlock(alteredBlock));

            lavaBucket.OnItemUsedOnBlock(world, targetBlock, Vector3.Up, Vector3.Zero, player);
            Assert.AreEqual(new LavaFlowingBlock(), world.GetBlock(alteredBlock));

            bucket.OnItemUsedOnBlock(world, targetBlock, Vector3.Up, Vector3.Zero, player);
            Assert.AreEqual(new AirBlock(), world.GetBlock(alteredBlock));

            world.SetBlock(alteredBlock, new BedrockBlock());

            bucket.OnItemUsedOnBlock(world, targetBlock, Vector3.Up, Vector3.Zero, player);
            Assert.AreEqual(new BedrockBlock(), world.GetBlock(alteredBlock));
        }
开发者ID:Imperceptus,项目名称:Craft.Net,代码行数:34,代码来源:ItemTest.cs

示例12: PrefabMist

 public static void PrefabMist( World world, Entity entity )
 {
     if (world.IsClientSide) {
         //entity.Attach( new ModelView( entity, world, @"scenes\weapon\projRocket", "rocket", Matrix.Scaling(0.1f), Matrix.Identity ) );
         entity.Attach( new SfxView( entity, world, "Mist" ) );
     }
 }
开发者ID:demiurghg,项目名称:ShooterDemo,代码行数:7,代码来源:MPWorld.Prefabs.cs

示例13: Shoot

 public override void Shoot(World world)
 {
     Rocket rocket1 = Game.Objects.CreateRocket(Owner.Position + new Vector2(-40f * Maf.Cos(Owner.Rotation), -40f * Maf.Sin(Owner.Rotation)), Owner.Speed, Owner.Rotation);
     Rocket rocket2 = Game.Objects.CreateRocket(Owner.Position + new Vector2(40f * Maf.Cos(Owner.Rotation), 40f * Maf.Sin(Owner.Rotation)), Owner.Speed, Owner.Rotation);
     world.Add(rocket1);
     world.Add(rocket2);
 }
开发者ID:vkd,项目名称:Ctrl-Space,代码行数:7,代码来源:RocketLauncher.cs

示例14: Tick

 public void Tick(World world)
 {
     if (self.IsDead)
         world.AddFrameEndTask(w => w.Remove(this));
     else
         anim.Tick();
 }
开发者ID:ushardul,项目名称:OpenRA,代码行数:7,代码来源:Rank.cs

示例15: RenderSetPiece

        public void RenderSetPiece(World world, IntPoint pos)
        {
            var deepWaterRadius = 1f;

            var border = new List<IntPoint>();

            var t = new int[Size, Size];

            for (var y = 0; y < Size; y++) //Replace Deep Water With NWater
                for (var x = 0; x < Size; x++)
                {
                    var dx = x - (Size/2.0);
                    var dy = y - (Size/2.0);
                    var r = Math.Sqrt(dx*dx + dy*dy);
                    if (r <= deepWaterRadius)
                    {
                        t[x, y] = 1;
                    }
                }
            for (var x = 0; x < Size; x++)
                for (var y = 0; y < Size; y++)
                {
                    if (t[x, y] == 1)
                    {
                        var tile = world.Map[x + pos.X, y + pos.Y].Clone();
                        tile.TileId = Water;
                        tile.ObjType = 0;
                        world.Obstacles[x + pos.X, y + pos.Y] = 0;
                        world.Map[x + pos.X, y + pos.Y] = tile;
                    }
                }
        }
开发者ID:RiiggedMPGH,项目名称:Owl-Realms-Source,代码行数:32,代码来源:HermitOnDeath.cs


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