Ejemplo n.º 1
0
 private void DrawFloors()
 {
     foreach (Point p in _sync_floors)
     {
         MapGenerator.AddToTexture(ref texture, p, building_floor);
     }
 }
Ejemplo n.º 2
0
 public override void Draw()
 {
     for (int x = 0; x < map.dimension.x; x++)
     {
         for (int y = 0; y < map.dimension.y; y++)
         {
             MapGenerator.AddToTexture(ref texture, new Vector2(x, y), grass);
         }
     }
 }
Ejemplo n.º 3
0
    private void DrawFloors(ref Texture2D2 texture)
    {
        BuildingModule module = GameObject.FindObjectOfType <BuildingModule>();

        for (int x = 0; x < this.dimension.x; x++)
        {
            for (int y = 0; y < this.dimension.y; y++)
            {
                MapGenerator.AddToTexture(ref texture, this.Position(Depth.World) + new Point(x, y), module.building_floor);
            }
        }
    }
Ejemplo n.º 4
0
    private void DrawEntrance(Directional entrance, ref Texture2D2 texture)
    {
        BuildingModule module = GameObject.FindObjectOfType <BuildingModule>();

        if (entrance.direction == Direction.North)
        {
            MapGenerator.AddToTexture(ref texture, entrance.Position(Depth.World), module.entrance_north);
        }
        else if (entrance.direction == Direction.East)
        {
            MapGenerator.AddToTexture(ref texture, entrance.Position(Depth.World), module.entrance_east);
        }
        else if (entrance.direction == Direction.South)
        {
            MapGenerator.AddToTexture(ref texture, entrance.Position(Depth.World), module.entrance_south);
        }
        else
        {
            MapGenerator.AddToTexture(ref texture, entrance.Position(Depth.World), module.entrance_west);
        }
    }
Ejemplo n.º 5
0
    private void DrawWindow(Directional window, ref Texture2D2 texture)
    {
        BuildingModule module = GameObject.FindObjectOfType <BuildingModule>();

        if (window.direction == Direction.North)
        {
            MapGenerator.AddToTexture(ref texture, window.Position(Depth.World), module.window_north);
        }
        else if (window.direction == Direction.East)
        {
            MapGenerator.AddToTexture(ref texture, window.Position(Depth.World), module.window_east);
        }
        else if (window.direction == Direction.South)
        {
            MapGenerator.AddToTexture(ref texture, window.Position(Depth.World), module.window_south);
        }
        else
        {
            MapGenerator.AddToTexture(ref texture, window.Position(Depth.World), module.window_west);
        }
    }
Ejemplo n.º 6
0
    private void DrawWalls()
    {
        List <PointDirection> all_walls = new List <PointDirection>();

        foreach (PointDirection pd in _sync_walls)
        {
            all_walls.Add(pd);
        }
        foreach (PointDirection pd in _sync_walls)
        {
            if (!all_walls.Any(w => w == pd.OtherSide()))
            {
                all_walls.Add(pd.OtherSide());
            }
        }

        foreach (PointDirection pd in all_walls)
        {
            if (pd.direction == Direction.North)
            {
                MapGenerator.AddToTexture(ref texture, pd.point, wall_north);
            }
            else if (pd.direction == Direction.East)
            {
                MapGenerator.AddToTexture(ref texture, pd.point, wall_east);
            }
            else if (pd.direction == Direction.South)
            {
                MapGenerator.AddToTexture(ref texture, pd.point, wall_south);
            }
            else
            {
                MapGenerator.AddToTexture(ref texture, pd.point, wall_west);
            }
        }
    }
Ejemplo n.º 7
0
    private void DrawCorners()
    {
        List <PointDirection> all_walls = new List <PointDirection>();

        foreach (PointDirection pd in _sync_walls)
        {
            all_walls.Add(pd);
        }
        foreach (PointDirection pd in _sync_walls)
        {
            if (!all_walls.Any(w => w == pd.OtherSide()))
            {
                all_walls.Add(pd.OtherSide());
            }
        }

        List <PointDirection> all_windows = new List <PointDirection>();

        foreach (PointDirection pd in _sync_windows)
        {
            all_windows.Add(pd);
        }
        foreach (PointDirection pd in _sync_windows)
        {
            if (!all_windows.Any(w => w == pd.OtherSide()))
            {
                all_windows.Add(pd.OtherSide());
            }
        }

        List <PointDirection> all_entrances = new List <PointDirection>();

        foreach (PointDirection pd in _sync_entrances)
        {
            all_entrances.Add(pd);
        }
        foreach (PointDirection pd in _sync_entrances)
        {
            if (!all_entrances.Any(w => w == pd.OtherSide()))
            {
                all_entrances.Add(pd.OtherSide());
            }
        }

        List <PointDirection> all_everythings = all_walls.Union(all_windows).Union(all_entrances).ToList();

        foreach (PointDirection pd in all_everythings)
        {
            if (pd.direction == Direction.South)
            {
                if (all_everythings.Any(w => w == new PointDirection(pd.point + Point.right + Point.down, Direction.West)) &&
                    !all_everythings.Any(w => w == new PointDirection(pd.point + Point.right, Direction.West)) &&
                    !all_everythings.Any(w => w == new PointDirection(pd.point + Point.right, Direction.South)))
                {
                    MapGenerator.AddToTexture(ref texture, pd.point + Point.right, wall_northeast);
                }
            }
            if (pd.direction == Direction.East)
            {
                if (all_everythings.Any(w => w == new PointDirection(pd.point + Point.up + Point.right, Direction.South)) &&
                    !all_everythings.Any(w => w == new PointDirection(pd.point + Point.up, Direction.South)) &&
                    !all_everythings.Any(w => w == new PointDirection(pd.point + Point.up, Direction.East)))
                {
                    MapGenerator.AddToTexture(ref texture, pd.point + Point.up, wall_northwest);
                }
            }
            if (pd.direction == Direction.North)
            {
                if (all_everythings.Any(w => w == new PointDirection(pd.point + Point.left + Point.up, Direction.East)) &&
                    !all_everythings.Any(w => w == new PointDirection(pd.point + Point.left, Direction.East)) &&
                    !all_everythings.Any(w => w == new PointDirection(pd.point + Point.left, Direction.North)))
                {
                    MapGenerator.AddToTexture(ref texture, pd.point + Point.left, wall_southwest);
                }
            }
            if (pd.direction == Direction.West)
            {
                if (all_everythings.Any(w => w == new PointDirection(pd.point + Point.down + Point.left, Direction.North)) &&
                    !all_everythings.Any(w => w == new PointDirection(pd.point + Point.down, Direction.North)) &&
                    !all_everythings.Any(w => w == new PointDirection(pd.point + Point.down, Direction.West)))
                {
                    MapGenerator.AddToTexture(ref texture, pd.point + Point.down, wall_southeast);
                }
            }
        }
    }