public HoleTile(TileID id) : base(id) { connectsToSand = true; connectsToWater = true; connectsToLava = true; }
public SaplingTile(TileID id, Tile onType, Tile growsTo) : base(id) { this.onType = onType; this.growsTo = growsTo; connectsToSand = onType.connectsToSand; connectsToGrass = onType.connectsToGrass; connectsToWater = onType.connectsToWater; connectsToLava = onType.connectsToLava; }
private void Start() { tileID = selectedTileSO.tileID; tileType = selectedTileSO.tileType; gameObject.name = selectedTileSO.name; tileName = selectedTileSO.tileName; tileSprite = selectedTileSO.tileSprite; tileBaseIncome = selectedTileSO.tileBaseIncome; tileBaseCost = selectedTileSO.tileBaseCost; TileAdjacencyBonus = selectedTileSO.tileAdjacencyBonus; tileLevel = UpgradeLevelDictionary.GetUpgradeLevel(tileID.ToString()); GetComponent <SpriteRenderer>().sprite = tileSprite; var tileCost = MathFunctions.CalculateTileCost(tileBaseCost); Board.instance.placedTiles += 1; }
public void InitializeTileTypes() { if (_tileTypeToName.Count != 0) { return; } var tileId = new TileID(); var tileIdType = typeof(TileID); foreach (var member in GetConstants(tileIdType)) { var name = member.Name; var value = (ushort)member.GetValue(new TileID()); _tileTypeToName[value] = name; } }
public static bool IsTileNormallyGrappleable(Tile tile) { if (!tile.active()) { return(false); } if (!Main.tileSolid[tile.type] && tile.type != TileID.MinecartTrack) { return(false); } if (tile.inActive()) // actuated { return(false); } var config = GrappletechConfig.Instance; if (config.Get <bool>(nameof(config.GrappleableWoodAndPlatforms))) { switch (tile.type) { case TileID.Platforms: case TileID.MinecartTrack: case TileID.WoodBlock: case TileID.BorealWood: case TileID.DynastyWood: case TileID.LivingWood: case TileID.LeafBlock: case TileID.PalmWood: case TileID.SpookyWood: case TileID.LivingMahogany: case TileID.RichMahogany: case TileID.LivingMahoganyLeaves: case TileID.PlanterBox: return(true); } } var whitelist = config.Get <HashSet <string> >(nameof(config.GrappleableTileWhitelist)); string tileUid = TileID.GetUniqueKey(tile.type); return(whitelist.Contains(tileUid)); }
public void spawnShip(RaycastHit2D hit) { TileID tid = hit.collider.gameObject.GetComponent <TileID>(); if (!tid.isShipPresent) { tid.isShipPresent = true; tid.ship = Instantiate(_ship, hit.transform); tid.ship.SetActive(true); tid.ship.transform.position = hit.transform.position; shipCount++; } /*uint index = hit.collider.gameObject.GetComponent<TileID>().ID; * Vector3 pos = hit.collider.transform.position; * ship_instances.Add(Instantiate(_ship, transform)); * ship_instances[ship_instances.Count - 1].GetComponent<TileID>().ID = index; * ship_instances[ship_instances.Count - 1].SetActive(true); * ship_instances[ship_instances.Count - 1].transform.position = pos;*/ }
private static int Neighbours(int x, int y, int radius) { int count = 0; for (int i = -radius; i <= radius; i++) { for (int j = -radius; j <= radius; j++) { if (i == 0 && j == 0) { continue; } TileID enumid = Terrain.TileAt(x + i, y + j).enumId; if (enumid != TileID.Air && enumid != TileID.Invalid) { count++; } } } return(count); }
public static bool CanPlace(int type) { var config = ErgophobiaConfig.Instance; var wl = config.Get <List <string> >(nameof(config.TilePlaceWhitelist)); if (wl.Contains(TileID.GetUniqueKey(type))) { return(true); } if (type == ModContent.TileType <FramingPlankTile>()) { return(config.Get <bool>(nameof(config.IsFramingPlankWhitelisted))); } if (type == ModContent.TileType <TrackDeploymentTile>()) { return(config.Get <bool>(nameof(config.IsTrackDeploymentWhitelisted))); } return(false); }
public LavaTile(TileID id) : base(id) { connectsToSand = true; connectsToLava = true; }
public HardRockTile(TileID id) : base(id) { }
public CloudCactusTile(TileID id) : base(id) { }
public TileData GetTileData(TileID id) { return(tileData[id]); }
public SandTile(TileID id) : base(id) { connectsToSand = true; }
public WaterTile(TileID id) : base(id) { connectsToSand = true; connectsToWater = true; }
public RockTile(TileID id) : base(id) { }
public FarmTile(TileID id) : base(id) { }
public WheatTile(TileID id) : base(id) { }
public OreTile(TileID id, Resource toDrop) : base(id) { this.toDrop = toDrop; this.color = toDrop.color & 0xffff00; }
public StairsTile(TileID id, bool leadsUp) : base(id) { this.leadsUp = leadsUp; }
public WheatTile(TileID id) : base(id) { }
public bool Match(TileID terrain) { return m_terrainMask.Get(terrain); }
public void SetTileID(int row, int col) { tileID = new TileID(row, col); }
public PlantableResource(string name, int sprite, int color, TileID targetTile, List<TileID> sourceTiles) : base(name, sprite, color) { this.sourceTiles = sourceTiles; this.targetTile = targetTile; }
public InfiniteFallTile(TileID id) : base(id) { }
public InfiniteFallTile(TileID id) : base(id) { }
public CloudTile(TileID id) : base(id) { }
private Tile(TileID enumId, TileAttribs tileattribs) { this.enumId = enumId; this.tileattribs = tileattribs; }
public FlowerTile(TileID id) : base(id) { tiles[(byte)id] = this; connectsToGrass = true; }
public CactusTile(TileID id) : base(id) { connectsToSand = true; }
public WaterTile(TileID id) : base(id) { connectsToSand = true; connectsToWater = true; }
public GrassTile(TileID id) : base(id) { connectsToGrass = true; }
public PlantableResource(string name, int sprite, int color, TileID targetTile, params TileID[] sourceTiles1) : this(name, sprite, color, targetTile, new List<TileID>(sourceTiles1)) { }
public void Get_dora_pei() { TileID tile = new TileID(TileID.Suits.Kaze, TileID.PEI); Assert.AreEqual(new TileID(TileID.Suits.Kaze, TileID.TON), tile.GetDoraFromIndicator()); }
public OreTile(TileID id, Resource toDrop) : base(id) { this.toDrop = toDrop; this.color = toDrop.color & 0xffff00; }
public void Haku_is_Sangen() { TileID tile = new TileID(TileID.Suits.Sangen, TileID.HAKU); Assert.AreEqual(TileID.Suits.Sangen, tile.Suit); }
private Tile(TileID enumId, Func <RawItem> dropItem) : this(enumId, new TileAttribs(dropItem)) { }
public void Get_dora_hatsu() { TileID tile = new TileID(TileID.Suits.Sangen, TileID.HATSU); Assert.AreEqual(new TileID(TileID.Suits.Sangen, TileID.CHUN), tile.GetDoraFromIndicator()); }
static void FillEmptySpace() { int index = 0; int lw = Canvas.File.header.width; int lh = Canvas.File.header.height; TileID activeFillTile = TileID.Empty; TileID back1FillTile = TileID.Empty; TileID back2FillTile = TileID.Empty; TileID tagFillTile = TileID.OOBMarker; // j is on the outside loop here because I need to increment along columns instead of rows for (int j = 0; j < lw; j++) { tagFillTile = TileID.OOBMarker; for (int i = 0; i < lh; i++) // move down the column replacing OOB tiles with whatever the last valid tile was { index = i * lw + j; if (Canvas.File.data.tag[index] == TileID.OOBMarker) { if (tagFillTile != TileID.OOBMarker) { //Canvas.File.data.tag[index] = TileID.Empty; Canvas.File.data.active[index] = activeFillTile; Canvas.File.data.back1[index] = back1FillTile; Canvas.File.data.back2[index] = back2FillTile; Canvas.File.data.tag[index] = tagFillTile; //if (RNG.CoinFlip()) //{ // Canvas.File.data.active[index] = TileID.Kuko; // Canvas.File.data.overlay[index] = TileID.FakeSolidOver; //} } } else { activeFillTile = Canvas.File.data.active[index]; back1FillTile = Canvas.File.data.back1[index]; back2FillTile = Canvas.File.data.back2[index]; //if (Canvas.data.tag[index] != TileID.Empty) tagFillTile = Canvas.File.data.tag[index]; } } tagFillTile = TileID.OOBMarker; for (int i = lh - 1; i >= 0; i--) // just do the same thing as above but going up the column. this is a lazy solution { index = i * lw + j; if (Canvas.File.data.tag[index] == TileID.OOBMarker) { if (tagFillTile != TileID.OOBMarker) { Canvas.File.data.tag[index] = TileID.Empty; Canvas.File.data.active[index] = activeFillTile; Canvas.File.data.back1[index] = back1FillTile; Canvas.File.data.back2[index] = back2FillTile; Canvas.File.data.tag[index] = tagFillTile; //if (RNG.CoinFlip()) // Canvas.File.data.active[index] = TileID.Mother; } } else { activeFillTile = Canvas.File.data.active[index]; back1FillTile = Canvas.File.data.back1[index]; back2FillTile = Canvas.File.data.back2[index]; //if (Canvas.data.tag[index] != TileID.Empty) tagFillTile = Canvas.File.data.tag[index]; } } } }
public void Haku_is_HakuNumber() { TileID tile = new TileID(TileID.Suits.Sangen, TileID.HAKU); Assert.AreEqual(TileID.HAKU, tile.Number); }
public FlowerTile(TileID id) : base(id) { tiles[(byte)id] = this; connectsToGrass = true; }
public void Above_9_is_invalid_man() { TileID tile = new TileID(TileID.Suits.Man, 10); Assert.IsTrue(tile == TileID.Invalid); }
public HardRockTile(TileID id) : base(id) { }
public void Sanman_is_manzu() { TileID tile = new TileID(TileID.Suits.Man, 3); Assert.AreEqual(TileID.Suits.Man, tile.Suit); }
public CactusTile(TileID id) : base(id) { connectsToSand = true; }
public void Paapin_is_not_routou() { TileID tile = new TileID(TileID.Suits.Pin, 8); Assert.IsFalse(tile.Routou); }
public void SetTileID(TileID id) { tileID = id; }
public void Paapin_is_not_jihai() { TileID tile = new TileID(TileID.Suits.Pin, 8); Assert.IsFalse(tile.Jihai); }
public DirtTile(TileID id) : base(id) { }
public void Iipin_is_routou() { TileID tile = new TileID(TileID.Suits.Pin, 1); Assert.IsTrue(tile.Routou); }
public LavaTile(TileID id) : base(id) { connectsToSand = true; connectsToLava = true; }
public Tile(TileID tileId) { this.id = (byte)tileId; if (tiles[id] != null) throw new InvalidOperationException("Duplicate tile ids!"); tiles[id] = this; }