本文整理汇总了C#中Game.World.AddTile方法的典型用法代码示例。如果您正苦于以下问题:C# World.AddTile方法的具体用法?C# World.AddTile怎么用?C# World.AddTile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game.World
的用法示例。
在下文中一共展示了World.AddTile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Begin
public void Begin()
{
Content = new EpisodeContentManager(Main.EpisodeContent.ServiceProvider, "Content");
RenderContext = new RenderContext(Content.Load<Effect>("draw"), Main.GraphicsDevice);
Camera = new Gem.Render.FreeCamera(new Vector3(0, 0, 0), Vector3.UnitY, Vector3.UnitZ, Main.GraphicsDevice.Viewport);
RenderContext.Camera = Camera;
World = new World(16, 10, 3);
var blockTile = World.AddTile("block", typeof(Game.Tiles.BlockTile), new TilePropertyBag
{
Texture = RenderContext.White
});
var floorTile = World.AddTile("floor", typeof(Game.Tiles.FloorTile), new TilePropertyBag
{
Texture = Content.Load<Texture2D>("floor01")
});
var rampTile = World.AddTile("ramp", typeof(Game.Tiles.RampTile), new TilePropertyBag
{
Texture = Content.Load<Texture2D>("floor01")
});
World.Grid.ForEachTile((t, x, y, z) =>
{
if (x == 0 || x == 15 || y == 9)
t.Tile = blockTile;
else if (z == 0)
t.Tile = floorTile;
});
World.Grid.CellAt(7, 3, 1).Tile = floorTile;
World.Grid.CellAt(7, 4, 0).Tile = rampTile;
World.Grid.CellAt(8, 4, 1).Tile = floorTile;
World.Grid.CellAt(8, 3, 1).Tile = floorTile;
SceneGraph = new Gem.Render.BranchNode();
var testActorProperties = new Actors.AnimatedSpritePropertyBag
{
Sprite = Content.Load<Texture2D>("char"),
NormalMap = RenderContext.NeutralNormals,
DropShadow = Content.Load<Texture2D>("shadow"),
Height = 1.5f,
Width = 1.0f,
Animations = new Gem.AnimationSet(
new Gem.Animation("idle", 0.15f, 0),
new Gem.Animation("run", 0.15f, 1, 2, 3, 4, 5, 6)),
SpriteSheet = new Gem.SpriteSheet(4, 4),
HiliteOnHover = true,
HoverOverlay = Content.Load<Texture2D>("outline")
};
var commandSet = new List<Input.PlayerCommand>();
testActorProperties.Upsert("commands", commandSet);
var walkCommand = new Input.PlayerCommand(World);
walkCommand.Check("can-walk", "actor", "cell", "path");
walkCommand.Perform("do-walk", "actor", "path");
testActorProperties.Upsert("walk-command", walkCommand);
World.GlobalRules.Check<Actor, CombatCell, Pathfinding<CombatCell>.PathNode>("can-walk")
.When((a, c, n) => n.PathCost > a.Properties.GetPropertyAsOrDefault<int>("turn-energy") || n.PathCost < 1)
.Do((a, c, n) => SharpRuleEngine.CheckResult.Disallow);
World.GlobalRules.Check<Actor, CombatCell, Pathfinding<CombatCell>.PathNode>("can-walk")
.Do((a, c, n) => SharpRuleEngine.CheckResult.Allow);
World.GlobalRules.Perform<Actor, Pathfinding<CombatCell>.PathNode>("do-walk")
.Do((a, p) =>
{
var energy = a.Properties.GetPropertyAs<int>("turn-energy");
energy -= (int)p.PathCost;
a.Properties.Upsert("turn-energy", energy);
a.NextAction = new Actors.Actions.WalkPath(p.ExtractPath());
PushInputState(new Input.WaitForIdle(a));
return SharpRuleEngine.PerformResult.Continue;
});
PlayerActor = World.SpawnActor(typeof(Actors.AnimatedSpriteActor),
testActorProperties,
new Vector3(4.5f, 4.5f, 0.25f));
World.SpawnActor(typeof(Actors.AnimatedSpriteActor), testActorProperties, new Vector3(4.5f, 6.5f, 0.25f));
Camera.Position = CameraFocus + new Vector3(0, -4, 3);
Camera.LookAt(CameraFocus);
Camera.Position = CameraFocus + (Camera.GetEyeVector() * CameraDistance);
Main.Input.AddBinding("RIGHT", new KeyboardBinding(Keys.Right, KeyBindingType.Held));
Main.Input.AddBinding("LEFT", new KeyboardBinding(Keys.Left, KeyBindingType.Held));
Main.Input.AddBinding("UP", new KeyboardBinding(Keys.Up, KeyBindingType.Held));
Main.Input.AddBinding("DOWN", new KeyboardBinding(Keys.Down, KeyBindingType.Held));
Main.Input.AddBinding("CLICK", new MouseButtonBinding("LeftButton", KeyBindingType.Pressed));
Main.Input.AddBinding("GRID-UP", new KeyboardBinding(Keys.Q, KeyBindingType.Pressed));
Main.Input.AddBinding("GRID-DOWN", new KeyboardBinding(Keys.E, KeyBindingType.Pressed));
Main.Input.AddBinding("CAMERA-DISTANCE-TOGGLE", new KeyboardBinding(Keys.R, KeyBindingType.Held));
//.........这里部分代码省略.........