public void SetMaterial(int x, int y, Material material, Test.Game_01.Sprites.Sprite sprite) { var cell = new Cell(material, Renderer.AddSprite(sprite)); cell.Sprite.Position = new Vector2(x * CELL_SIZE, y * CELL_SIZE); cell.Sprite.Size = new Vector2(CELL_SIZE, CELL_SIZE); m_cells[x, y] = cell; }
public ISpriteInstance AddSprite(Sprite sprite) { Contract.Requires(sprite != null && sprite.SpriteSheet == SpriteSheet); var instance = new SpriteInstance(this, sprite); m_instances.Add(instance); instance.Size = new Vector2(sprite.Size.X, sprite.Size.Y); return instance; }
public Terrain( Sprite topLeft, Sprite top, Sprite topRight, Sprite topSingle, Sprite left, Sprite center, Sprite right) { m_topLeft = topLeft; m_top = top; m_topRight = topRight; m_topSingle = topSingle; m_left = left; m_center = center; m_right = right; }
public Background(Camera camera) { m_camera = camera; m_backgroundTexture_01 = Texture2D.Load(typeof(Background).Assembly.GetManifestResourceStream("Test.Game_01.Textures.Background_01.png")); m_backgroundSheet_01 = new SpriteSheet(m_backgroundTexture_01); m_backgroundSprite_01 = m_backgroundSheet_01.AddSprite("", new Box2i(Vector2i.Zero, m_backgroundTexture_01.Size)); m_backgroundRenderer_01 = new SpriteRenderer(m_backgroundSheet_01); m_backgroundInstance_01 = m_backgroundRenderer_01.AddSprite(m_backgroundSprite_01); m_backgroundTexture_02 = Texture2D.Load(typeof(Background).Assembly.GetManifestResourceStream("Test.Game_01.Textures.Background_02.png")); m_backgroundSheet_02 = new SpriteSheet(m_backgroundTexture_02); m_backgroundSprite_02 = m_backgroundSheet_02.AddSprite("", new Box2i(Vector2i.Zero, m_backgroundTexture_02.Size)); m_backgroundRenderer_02 = new SpriteRenderer(m_backgroundSheet_02); m_backgroundInstance_02_First = m_backgroundRenderer_02.AddSprite(m_backgroundSprite_02); m_backgroundInstance_02_Second = m_backgroundRenderer_02.AddSprite(m_backgroundSprite_02); }
public Sprite AddSprite(string name, Box2i coordinates) { var tw = (float)Texture.Size.X; var th = (float)Texture.Size.Y; var sprite = new Sprite( this, name, coordinates.Size, new Box2( coordinates.Position.X / tw, coordinates.Position.Y / th, coordinates.Size.X / tw, coordinates.Size.Y / th )); m_sprites.Add(sprite.Name, sprite); return sprite; }
public SpriteInstance(SpriteRenderer renderer, Sprite sprite) { m_renderer = renderer; m_sprite = sprite; }
public Liquid(Sprite top, Sprite mid) { m_top = top; m_mid = mid; }