Ejemplo n.º 1
0
        protected color Sprite(float player, building b, unit u, vec2 pos, float frame, PointSampler Texture)
        {
            if (pos.x > 1 || pos.y > 1 || pos.x < 0 || pos.y < 0)
            {
                return(color.TransparentBlack);
            }

            bool  draw_selected   = u.player == player && fake_selected(b);
            float selected_offset = draw_selected ? 3 : 0;

            pos   += Float(vec(b.part_x, b.part_y));
            pos.x += Float(u.player) * BuildingSpriteSheet.BuildingDimX;
            pos.y += selected_offset + BuildingSpriteSheet.SubsheetDimY * Float(UnitType.BuildingIndex(u.type));
            pos   *= BuildingSpriteSheet.SpriteSize;

            return(Texture[pos]);
        }
Ejemplo n.º 2
0
        RectangleQuad SetBuildingQuad(vec2 pos, vec2 size, float type, int player, RectangleQuad quad = null)
        {
            vec2 uv_size = BuildingSpriteSheet.BuildingSize;

            vec2 uv_offset;

            uv_offset.x = player * BuildingSpriteSheet.BuildingDimX;
            uv_offset.y = BuildingSpriteSheet.SubsheetDimY * Float(UnitType.BuildingIndex(type));
            uv_offset  *= BuildingSpriteSheet.SpriteSize;

            if (quad == null)
            {
                quad = new RectangleQuad();
            }

            quad.SetupVertices(pos, pos + 2 * new vec2(size.x, -size.y), new vec2(0, uv_size.y) + uv_offset, new vec2(uv_size.x, 0) + uv_offset);
            quad.Texture = Assets.BuildingTexture_1;

            return(quad);
        }
Ejemplo n.º 3
0
 public static color Get(float player, float type)
 {
     return(FarColor[3 + Int(UnitType.BuildingIndex(type)), Int(player)]);
 }