public override void PostDraw(int i, int k, SpriteBatch spriteBatch) { base.PostDraw(i, k, spriteBatch); Tile tile = Main.tile[i, k]; if (tile.active() && tile.type == mod.TileType("DelayCircuitTile") && tile.frameX == 18 * 2) { TileEntity tileEntity = default(TileEntity); if (TileEntity.ByPosition.TryGetValue(new Point16(i - 2, k), out tileEntity)) { TEDelayCircuit es = tileEntity as TEDelayCircuit; Color lightCol = Lighting.GetColor(i, k); //TODO: why does the spritebatch seem to draw offset 12 tiles to the -x and -y? i += 10; k += 12; Color drawCol = Microsoft.Xna.Framework.Color.DarkRed; Color mergeColor = lightCol.MultiplyRGBA(drawCol); for (int d = 0; d < es.delay; d++) { if (es.buffer[d]) { float thru = 1f - (float)d / es.delay; Vector2 start = new Vector2((float)(i * 16 + 16 + (int)(thru * 19)), (float)(k * 16 + 4)); Vector2 end = new Vector2((float)(i * 16 + 16 + (int)(thru * 19)), (float)(k * 16 + 12)); Utils.DrawLine(spriteBatch, start, end, mergeColor, mergeColor, 2f); } } } } }
public override void HitWire(int i, int j) { Tile tile = Main.tile[i, j]; if (tile.frameX != 0) { return; } int left = i - tile.frameX; int top = j - tile.frameY / 18; int index = GetInstance <TEDelayCircuit>().Find(left, top); if (index != -1) { TEDelayCircuit DelayCircuitEnt = (TEDelayCircuit)TileEntity.ByID[index]; DelayCircuitEnt.justHit = true; } }