public override void RefreshTile(Vec3I gridPos, TM.ITilemap tilemap) { Vec2I pos = GridToTile(gridPos); Vec2I subTile = GridToSubTile(gridPos); Map.BBTile tile = GetTile(pos); if (!disableRefresh || HasSprite(tile, pos, subTile)) { tilemap.RefreshTile(gridPos); } if (disableRefresh) { return; } for (int tx = 0; tx < 2; ++tx) { for (int ty = 0; ty < 2; ++ty) { Vec2I t = pos + new Vec2I(tx + subTile.x - 1, ty + subTile.y - 1); if (t != pos) { t *= 2; for (int i = 0; i < 4; ++i) { tilemap.RefreshTile(new Vec3I(t.x + (i >> 1), t.y + (i % 2), 0)); } } } } }
public override bool GetTileAnimationData(Vec3I gridPos, TM.ITilemap tilemap, ref TM.TileAnimationData tileAnimationData) { Vec2I pos = GridToTile(gridPos); Terrain terrain = GetTile(pos).terrain; if (!terrain.animated) { return(false); } tileAnimationData.animatedSprites = terrain.GetAnimationSprites(map, pos, GridToSubTile(gridPos)); tileAnimationData.animationSpeed = 2; tileAnimationData.animationStartTime = 0; return(true); }
public override void GetTileData(Vec3I gridPos, TM.ITilemap itilemap, ref TM.TileData tileData) { Vec2I pos = GridToTile(gridPos); Vec2I subTile = GridToSubTile(gridPos); Map.BBTile tile = GetTile(pos); TileSprite sprite = HasSprite(tile, pos, subTile) ? GetSprite(tile, pos, subTile) : null; tileData = new TM.TileData { sprite = sprite.sprite, color = sprite.color, transform = sprite.xform, gameObject = null, flags = TM.TileFlags.None, colliderType = ColliderType.None }; // Unity so broken (requires tileData.color to be set also *shrug*) tilemap.SetColor(gridPos, sprite.color); }
/// <summary> /// Runs each time the tile is created. /// </summary> public override bool StartUp(Vector3Int location, ITilemap tilemap, GameObject go) { Rerandomize(); return(base.StartUp(location, tilemap, go)); }
private bool TileValue(ITilemap tileMap, Vector3Int position) { TileBase tile = tileMap.GetTile(position); return(tile != null && tile == this); }
public override void GetTileData(Vector3Int location, ITilemap tileMap, ref TileData tileData) { UpdateTile(location, tileMap, ref tileData); return; }
public override bool GetTileData(Vector3Int location, ITilemap tileMap, ref TileData tileData) { UpdateTile(location, tileMap, ref tileData); return(true); }
private void StartUpRef(Vector3Int position, ITilemap tilemap, GameObject go, ref bool startUpInvokedByUser) { startUpInvokedByUser = StartUp(position, tilemap, go); }
public override bool StartUp(Vector3Int position, ITilemap tilemap, GameObject gameObject) { return(base.StartUp(position, tilemap, gameObject)); }
private void GetTileAnimationDataRef(Vector3Int position, ITilemap tilemap, ref TileAnimationData tileAnimationData, ref bool hasAnimation) { hasAnimation = GetTileAnimationData(position, tilemap, ref tileAnimationData); }
public virtual bool GetTileAnimationData(Vector3Int position, ITilemap tilemap, ref TileAnimationData tileAnimationData) { return(false); }
public virtual void GetTileData(Vector3Int position, ITilemap tilemap, ref TileData tileData) { }
public virtual void RefreshTile(Vector3Int position, ITilemap tilemap) { tilemap.RefreshTile(position); }
public void ConfigureTile(Vector3Int location, ITilemap tileMap, ref TileData tileData) { var left = tileMap.GetTile(location + Vector3Int.left) == this; var right = tileMap.GetTile(location + Vector3Int.right) == this; var top = tileMap.GetTile(location + Vector3Int.up) == this; var bottom = tileMap.GetTile(location + Vector3Int.down) == this; if (left && top && right && bottom) { tileData.sprite = LTRB; } else if (left && top && right) { tileData.sprite = LTR; } else if (left && top && bottom) { tileData.sprite = LTB; } else if (top && right && bottom) { tileData.sprite = TRB; } else if (left && right && bottom) { tileData.sprite = LRB; } else if (left && right) { tileData.sprite = LR; } else if (top && bottom) { tileData.sprite = TB; } else if (left && top) { tileData.sprite = LT; } else if (left && bottom) { tileData.sprite = LB; } else if (top && right) { tileData.sprite = TR; } else if (right && bottom) { tileData.sprite = RB; } else if (left) { tileData.sprite = L; } else if (right) { tileData.sprite = R; } else if (top) { tileData.sprite = T; } else if (bottom) { tileData.sprite = B; } else { tileData.sprite = alone; } }
public override void GetTileData(Vector3Int position, ITilemap tilemap, ref TileData tileData) { base.GetTileData(position, tilemap, ref tileData); tileData.sprite = normalSprite; }
private static ITilemap CreateInstance() { ITilemap.s_Instance = new ITilemap(); return(ITilemap.s_Instance); }
public virtual bool StartUp(Vector3Int position, ITilemap tilemap, GameObject go) { return(false); }
public override void RefreshTile(Vector3Int position, ITilemap tilemap) { tilemap.RefreshTile(position); }