void Start() { world = WorldControler.Instance.World; go_actor = new Dictionary<Actors.Actor, GameObject>(); if (world == null) { Debug.LogError("No world?!"); return; } go_tiles = new GameObject[world.Width, world.Hight]; System.Random rnd = new System.Random(); //Create game objets for each tile for (int x = 0; x < world.Width; x++) { for (int y = 0; y < world.Hight; y++) { GameObject tile_go = new GameObject(); tile_go.name = "Tile_" + x + "_" + y; tile_go.transform.position = new Vector3(world[x, y].X, world[x, y].Y); tile_go.transform.SetParent(this.transform, true); SpriteRenderer tile_sr = tile_go.AddComponent<SpriteRenderer>(); tile_sr.sortingLayerName = "Tiles"; go_tiles[x, y] = tile_go; SetTileSprite(x, y, tile_go, rnd); } } SetHeroSprite(); world.TileTypeChanged += w_TileTypeChange; world.ActorMoved += MoveActorSprite; }
void Start() { world = WorldControler.Instance.World; go_StaticObjects = new Dictionary<IStaticObject, GameObject>(); if (world == null) { Debug.LogError("No world?!"); return; } //Mannaully set starting state for (int x = 0; x < world.Width; x++) { for (int y = 0; y < world.Hight; y++) { if (world[x, y] is Floor) { Floor fl = (Floor)world[x, y]; if (fl.SObject != null) { StaticObjectSetSprite(x, y, fl.SObject); } } } } }
public EmptyTile (World world, int x, int y, bool passable = false, TileType tiletype = TileType.Empty) { this.World = world; this.X = x; this.Y = y; this.Passable = passable; this.Biome = "Dirt"; this.TileType = tiletype; }
public Floor(World world, int x, int y, TileType tiletype = TileType.Floor) : base (world, x, y, true, tiletype) { }