本文整理汇总了C#中TileMap.Create方法的典型用法代码示例。如果您正苦于以下问题:C# TileMap.Create方法的具体用法?C# TileMap.Create怎么用?C# TileMap.Create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TileMap
的用法示例。
在下文中一共展示了TileMap.Create方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Setup
public override void Setup(Game _game, UserInput _keyboard, ScreenMessage _message)
{
base.Setup (_game, _keyboard, _message);
TileMap tilemap = new TileMap("pictures/empty_level.png");
m_house = new ObjectHouse(tilemap);
StarryBackground bg = new StarryBackground(tilemap.Size);
m_house.AddDrawable(bg);
Gangster gangsterNo1 = new Hero(m_keyboard, m_house);
gangsterNo1.Position = new Vector2f(1f, 10f);
gangsterNo1.PlaceInWorld(tilemap);
m_house.AddDrawable(gangsterNo1);
m_house.AddUpdateable(gangsterNo1);
m_house.Add<IShootable>(gangsterNo1);
m_game.SetCameraSubject(gangsterNo1);
tilemap.Create(m_house, _game);
Bitmap world_bmp = new Bitmap(tilemap.Width * Tile.Size, tilemap.Height * Tile.Size);
for (int i = 0 ; i < world_bmp.Width ; i++) {
for (int j = 0 ; j < world_bmp.Height; j++) {
world_bmp.SetPixel(i, j, Color.Green);
}
}
GangsterTrail trail = new GangsterTrail(gangsterNo1, new Sprite(world_bmp));
m_house.AddUpdateable(trail);
m_house.AddDrawable(trail);
}
示例2: Setup
public override void Setup(Game _game, UserInput _keyboard, ScreenMessage _message)
{
base.Setup (_game, _keyboard, _message);
var map = new TileMap("pictures/testlevel.png");
m_house = new ObjectHouse(map);
StarryBackground bg = new StarryBackground(map.Size);
m_house.AddDrawable(bg);
map.Create(m_house, _game);
Magnum magnum = new Magnum(m_house);
var hero = new Hero(_keyboard, m_house);
hero.Position = new Vector2f(1f, 10f);
hero.PlaceInWorld(map);
m_house.AddDrawable(hero);
m_house.AddUpdateable(hero);
m_house.AddDrawable(magnum);
m_house.AddUpdateable(magnum);
var nHero = new NetworkHero(hero, "127.0.0.1", m_house);
m_house.AddUpdateable(nHero);
nHero.Connect();
}
示例3: Setup
public override void Setup(Game _game, UserInput _keyboard, ScreenMessage _message)
{
base.Setup(_game, _keyboard, _message);
TileMap tilemap = new TileMap("pictures/targetlevel.png");
m_house = new ObjectHouse(tilemap);
StarryBackground bg = new StarryBackground(tilemap.Size);
m_house.AddDrawable(bg);
gangsterNo1 = new Hero(m_keyboard, m_house);
gangsterNo1.Position = new Vector2f(1f, 10f);
gangsterNo1.PlaceInWorld(tilemap);
m_house.AddDrawable(gangsterNo1);
m_house.AddUpdateable(gangsterNo1);
m_game.SetCameraSubject(gangsterNo1);
tilemap.Create(m_house, _game);
Text score = new Text("Left: 00");
score.updateAction = (_d) => {
score.Contents = "Left: " + m_house.GetAllDrawable<Target>().Count().ToString("00");
};
score.SetHUD(_game.Camera);
score.TopRight();
m_house.AddUpdateable(score);
m_house.AddDrawable(score);
Text time = new Text("Time: 00:00");
time.SetHUD(_game.Camera);
time.TopLeft();
timePassed = 0;
time.updateAction = (_d) => {
timePassed += _d;
time.Contents = "Time: " + timePassed.ToString("00.00").Replace(".",":");
};
m_house.AddUpdateable(time);
m_house.AddDrawable(time);
}
示例4: Setup
public override void Setup(Game _game, UserInput _keyboard, ScreenMessage _message)
{
base.Setup(_game, _keyboard, _message);
deathTimer = 0;
startTimer = 0;
winTimer = 0;
m_tilemap = new TileMap(levelFile);
m_size = new Vector2i(m_tilemap.Width, m_tilemap.Height);
Bounds.Right = m_size.X;
Bounds.Top = m_size.Y;
m_house = new ObjectHouse(m_tilemap);
StarryBackground bg = new StarryBackground(m_tilemap.Size);
bg.Layer = Layer.Pixelly;
m_house.AddDrawable(bg);
gangsterNo1 = new Hero(m_keyboard, m_house);
gangsterNo1.Position = m_tilemap.locationData.start.point;
gangsterNo1.PlaceInWorld(m_tilemap);
m_house.AddDrawable(gangsterNo1);
m_house.AddUpdateable(gangsterNo1);
m_house.Add<IShootable>(gangsterNo1);
m_game.SetCameraSubject(gangsterNo1);
m_tilemap.Create(m_house, _game);
m_house.AddDrawable(m_tilemap);
m_tilemap.Priority = Priority.Middle;
endzone = m_tilemap.locationData.end.box;
// fx
// pixelly
pixellyEffect
= new Effect(
new Vector2i(Game.SmallScreenWidth/2, Game.SmallScreenHeight/2),
new Vector2i(Game.ScreenWidth, Game.ScreenHeight),
new Vector2i(Game.Width, Game.Height)){
CaptureLayer = Layer.Pixelly,
Layer = Layer.FX,
Priority = Priority.Back,
Scaling = Sprite.ScaleType.Pixelly
};
pixellyEffect.SetHUD(_game.Camera);
m_house.AddDrawable(pixellyEffect);
m_house.AddUpdateable(pixellyEffect);
m_house.Add<IGrabing>(pixellyEffect);
// fading
fadingEffect
= new Effect(
new Vector2i(Game.ScreenWidth, Game.ScreenHeight),
new Vector2i(Game.ScreenWidth, Game.ScreenHeight),
new Vector2i(Game.Width, Game.Height)){
CaptureLayer = Layer.Blurry | Layer.Pixelly | Layer.Normal | Layer.FX,
Layer = Layer.Fade,
Priority = Priority.Front
};
fadingEffect.SetHUD(_game.Camera);
fadingEffect.SetFading(1f, new Colour(0,0,0,1), new Colour(0,0,0,0));
fadingEffect.SetBackground(new Colour(0,0,0,1f));
m_house.AddDrawable(fadingEffect);
m_house.AddUpdateable(fadingEffect);
m_house.Add<IGrabing>(fadingEffect);
// messages
welcome_message = new Text("Welcome to the Magnum House...");
welcome_message.SetHUD(m_game.Camera);
welcome_message.CentreOn(Game.Size.ToF()/2);
welcome_message.Priority = Priority.Front;
welcome_message.Layer = Layer.Normal;
welcome_message.Transparency = 0f;
m_house.AddDrawable(welcome_message);
}