Exemplo n.º 1
0
 public void changeTileType(TileBasis.TileType newtype, int spritenumber)
 {
     Type = newtype;
     TileBasis tile = road;
     string newtag = "";
     Sprite newsprite = null;
     string layername = "";
     switch (newtype) {
         case TileBasis.TileType.ROAD:
             tile = road;
             newtag = TagList.Road;
             //Debug.LogFormat("B:{0}:{1},{2}", newtype, spritenumber, GameSkins.RoadSprites.Length);
             spritenumber = spritenumber > GameSkins.RoadSprites.Length ? 0 : spritenumber;
             //Debug.LogFormat("A:{0}:{1},{2}", newtype, spritenumber, GameSkins.RoadSprites.Length);
             newsprite = GameSkins.RoadSprites[spritenumber];
             layername = newtag;
             break;
         case TileBasis.TileType.WALL:
             tile = wall;
             newtag = TagList.Wall;
             spritenumber = spritenumber > GameSkins.WallSprites.Length ? 0 : spritenumber;
             newsprite = GameSkins.WallSprites[spritenumber];
             layername = newtag;
             break;
         case TileBasis.TileType.WATERWAY:
             tile = waterway;
             newtag = TagList.WaterWay;
             spritenumber = spritenumber > GameSkins.WaterWaySprites.Length ? 0 : spritenumber;
             newsprite = GameSkins.WaterWaySprites[spritenumber];
             layername = newtag;
             break;
         case TileBasis.TileType.OVERLAPROAD:
             tile = road;
             newtag = TagList.Road;
             //Debug.LogFormat("B:{0}:{1},{2}", newtype, spritenumber, GameSkins.RoadSprites.Length);
             spritenumber = spritenumber > GameSkins.RoadSprites.Length ? 0 : spritenumber;
             //Debug.LogFormat("A:{0}:{1},{2}", newtype, spritenumber, GameSkins.RoadSprites.Length);
             newsprite = GameSkins.RoadSprites[spritenumber];
             layername = TagList.OverlapRoad;
             break;
         case TileBasis.TileType.UNBREAKABLEWALL:
             tile = wall;
             newtag = TagList.Wall;
             spritenumber = spritenumber > GameSkins.WallSprites.Length ? 0 : spritenumber;
             newsprite = GameSkins.WallSprites[spritenumber];
             layername = newtag;
             break;
     }
     Debug.Log(newsprite.name);
     Entity = tile;
     this.transform.tag = newtag;
     SpriteRenderer.sprite = newsprite;
     SpriteRenderer.sortingLayerName = layername;
     gameObject.layer = LayerMask.NameToLayer(newtag);
     this.name = Type.ToString();  //Entity.Name + (newtype == TileBasis.TileType.OVERLAPROAD?@"(Overlap)":"");
 }
Exemplo n.º 2
0
 public void init(TileBasis tile,DungeonParameter dgparam)
 {
     //Debug.Log(tile.Type);
     Type = tile.Type;
     string newtag = "";
     //Sprite newsprite = null;
     switch (Type)
     {
         case TileBasis.TileType.ROAD:
             newtag = TagList.Road;
             SpriteRenderer.sprite = dgparam!=null? dgparam.CurrentRoadSprite:GameSkins.getTileSprite(TileBasis.TileType.ROAD,0);
             break;
         case TileBasis.TileType.WALL:
             newtag = TagList.Wall;
             SpriteRenderer.sprite = dgparam != null ? dgparam.CurrentWallSprite : GameSkins.getTileSprite(TileBasis.TileType.WALL,0); ;
             break;
         case TileBasis.TileType.WATERWAY:
             newtag = TagList.Wall;
             SpriteRenderer.sprite = dgparam != null ? dgparam.CurrentWaterWaySprite : GameSkins.getTileSprite(TileBasis.TileType.WATERWAY,0); ;
             break;
         case TileBasis.TileType.UNBREAKABLEWALL:
             newtag = TagList.Wall;
             SpriteRenderer.sprite = dgparam != null ? dgparam.CurrentWallSprite : GameSkins.getTileSprite(TileBasis.TileType.WALL, 0); ;
             break;
     }
     Entity = tile;
     this.transform.tag = newtag;
     SpriteRenderer.sortingLayerName = newtag;
     gameObject.layer = LayerMask.NameToLayer(newtag);
     this.name = Type.ToString();
 }
Exemplo n.º 3
0
 public void changeTileType(TileBasis.TileType newtype, DungeonParameter dgparam)
 {
     switch (newtype)
     {
         case TileBasis.TileType.ROAD:
             init(road,dgparam);
             //newtag = TagList.Road;
             break;
         case TileBasis.TileType.WALL:
             init(wall,dgparam);
             //newtag = TagList.Wall;
             break;
         case TileBasis.TileType.WATERWAY:
             init(waterway,dgparam);
             //newtag = TagList.Wall;
             break;
         case TileBasis.TileType.OVERLAPROAD:
             init(road, dgparam);
             string newtag = TagList.Road;
             this.transform.tag = newtag;
             SpriteRenderer.sortingLayerName = TagList.OverlapRoad;
             gameObject.layer = LayerMask.NameToLayer(newtag);
             //this.name += @"(Overlap)";
             break;
         case TileBasis.TileType.UNBREAKABLEWALL:
             init(wall, dgparam);
             Type = TileBasis.TileType.UNBREAKABLEWALL;
             name = Type.ToString();
             break;
     }
 }