public virtual void ApplyDamage(LevelTilemap level, TileDamageType type, int damage) { if (currentHealth == -1) { return; } currentHealth -= damage; if (currentHealth > 0) { return; } level.DestroyTile(this); }
public void ApplyDamage(Vector3Int pos, Vector3 dir, TileDamageType type, int damage) { if (IsPosOutOfBound(pos.x, pos.y)) { return; } var tile = GetTile <LevelTile_Dig>(pos.x, pos.y, false); tile.ApplyDamage(this, type, damage); if (tile.currentHealth > 0) { var digData = tile.data as LevelTileData_Dig; tilemap.SetColor(IndexToTilemap(pos), new Color(tile.HealthPercent, 1, 1, 1)); } }
public virtual void OnDamage(LevelTilemap level, TileDamageType type, int damage) { }