Exemplo n.º 1
0
        // draw the tiles that we are about to "put", with transparency
        void DrawBrush()
        {
            // for objects larger than one tile, you have to select the middle cell of the first, bottom row of the object

            Vector3i coord = m_world_edit_cell;

            if (!IsValidIndex(coord))
            {
                return;
            }

            TRS quad = TRS.Quad0_1;
            //each z level happens to corresponds to the iso tile neighbour at +(1,1), hence the +coord.Z below
            Vector2 p = X * (coord.X + coord.Z) + Y * (coord.Y + coord.Z);

            quad.T = (p + Y).ProjectOnLine(p, Math._10);
//			#if 0
            float d = (p - quad.T).Length() * 2.0f;               // d should be =1

            quad.S = new Vector2(d, d);
//			#endif
            var data = new RawSpriteTile(quad, m_selected_tile, false, false);

            m_blocks_list.Add(data);

            BlendMode = BlendMode.Normal;
            Color     = Math.SetAlpha(Colors.White, Input2.GamePad0.Circle.Down ? 1.0f : 0.6f);

            flush_draw_blocks_list();
        }
Exemplo n.º 2
0
        public void SetBlock(Vector3i coord, Vector2i tile_index, bool second)
        {
            Vector3i clamped_coord = coord.Clamp(Math._000i, m_num_cells - Math._111i);

            Common.Assert(clamped_coord == coord);

            int cell_index = coord.X + m_num_cells.X * (coord.Y + coord.Z * m_num_cells.Y);

            if (m_cells[cell_index] == null)
            {
                m_cells[cell_index] = new Cell();
            }

            TRS quad = TRS.Quad0_1;
            //each z level happens to corresponds to the iso tile neighbour at +(1,1), hence the +coord.Z below
            Vector2 p = X * (coord.X + coord.Z) + Y * (coord.Y + coord.Z);

            quad.T = (p + Y).ProjectOnLine(p, Math._10);
//			#if 0
            float d = (p - quad.T).Length() * 2.0f;               // d should be =1

            quad.S = new Vector2(d, d);
//			#endif

            var data = new RawSpriteTile(quad, tile_index, false, false);

            if (second)
            {
                m_cells[cell_index].Data2    = data;
                m_cells[cell_index].Data1Set = true;
            }
            else
            {
                m_cells[cell_index].Data1    = data;
                m_cells[cell_index].Data2Set = true;
            }
        }