Exemplo n.º 1
0
        //bool sin_active;
        public World(   MVC.View view_,
		                int width__,
		                int height__,
		                float hex_length__
		        )
        {
            view = view_;
            map = new List< List<iTile> >();
            map_width = width__;
            map_height = height__;
            cur_team_count = 0;

            tile_size = hex_length__;

            float tR = (float)Math.Sqrt(3.0f) * tile_size / 2;
            float tS = tile_size;
            float tH = tile_size / 2;

            tR *= 2.5f;
            tS *= 2.5f;
            tH *= 2.5f;

            Random rand = new Random();

            for (int h = 0; h < map_height; h++)
            {
                map.Add(new List<iTile>());
                for (int w = 0; w < map_width; w++)
                {

                    Vector3 center;
                    center.X = w * tR * 2 + tR;
                    if (h % 2 == 1) center.X += tR;

                    center.Z = h * (tH + tS) + tS;
                    center.Y = 0.0f;

                    /*
                    if((Math.Abs(6 - h) + Math.Abs(7 - w)) < 4){
                        center.Z += 0.6 * tile_size;
                    }
                    else if((Math.Abs(6 - h) + Math.Abs(7 - w)) < 7){
                        center.Z += 0.2 * tile_size;
                    }
                    */

                    float scale_size = (float)2.0 * tile_size;

                    iTile tmp;
                    if (h == 0 || h == map_height - 1 || w == 0 || w == map_width - 1)
                        tmp = new BoundaryTile(tile_size, center, new Vector3(scale_size, scale_size, scale_size), w, h);
                    else
                    {
                        int randint = rand.Next(3);
                        if(randint == 0)
                            tmp = new IceTile(tile_size, center, new Vector3(scale_size, scale_size, scale_size), w, h);
                        else if(randint == 1)
                            tmp = new SoftsnowTile(tile_size, center, new Vector3(scale_size, scale_size, scale_size), w, h);
                        else
                            tmp = new HardsnowTile(tile_size, center, new Vector3(scale_size, scale_size, scale_size), w, h);
                    }

                    map[h].Add(tmp);

                    view.add_renderable(map[h][w].get_renderable());

                }
            }
        }
Exemplo n.º 2
0
 public HardsnowTile(HardsnowTile rhs)
     : base(rhs)
 {
 }