Exemple #1
0
 public Wall(EmptyTile tile)
 {
     this.Tile = tile;
     this.Passable = false;
     StaticObjectType = "Wall";
     ((IStaticObject)this).Width = 1;
     ((IStaticObject)this).Hight = 1;
 }
Exemple #2
0
 public EmptyTile[] GetNighboursArray()
 {
     EmptyTile[] tiles = new EmptyTile[8];
     tiles[0] = World[X - 1, Y + 1];
     tiles[1] = World[X, Y + 1];
     tiles[2] = World[X + 1, Y + 1];
     tiles[3] = World[X - 1, Y];
     tiles[4] = World[X + 1, Y];
     tiles[5] = World[X - 1, Y - 1];
     tiles[6] = World[X, Y - 1];
     tiles[7] = World[X + 1, Y - 1];
     return tiles;
 }
Exemple #3
0
    static public bool GenerateWorld(World world,TextAsset csv)
    {
        string[,] map = CSVReader.SplitCsvGrid(csv.text);
        for (int x = 0; x < world.Hight; x++)
        {
            for (int y = 0; y < world.Hight; y++)
            {
 
                string t = map[x, world.Hight - 1 - y ];
                switch (t)
                {
                    case "F":
                        world[x, y] = new Floor(world, x, y);
                        break;
                    case "W":
                        world[x, y] = new Floor(world, x, y, TileType.Wall);
                        Floor f = (Floor)world[x, y];
                        f.SObject = new Wall(world[x, y]);
                        break;
                    case "S":
                        world[x, y] = new Floor(world, x, y);
                        //TODO: Set random static object in floor tile;
                        break;
                    case "C":
                        Floor cf = new Floor(world, x, y);
                        Hero h = new Hero(cf);
                        cf.Actor = h;
                        world.Hero = h;
                        world[x, y] = cf;
                        break;
                    default:
                        world[x, y] = new EmptyTile(world, x, y);
                        break;
                }
                
            }
        }


        return true;
    }