Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
# Changelog
All notable changes to this package will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)

## [1.5.0-preview] - 2020-02-14
### Added
- Added CONTRIBUTING.md
- Updated LICENSE.md

### Fixed
- [WeightedRandomTile] Fixed WeightedRandomTile messing up Random.seed!

## [1.4.0] - 2020-01-07
### Added
- [RuleTile / HexagonalRuleTile / IsometricRuleTile / RuleOverrideTile] Added Asset Preview for TilingRules
- [RuleTile] Hidden Rule field
- [CustomRuleTile] Support custom field of Object type
- [CustomRuleTile] Support HideInInspector, DontOverride attributes
- [RuleOverrideTile] Move advanced mode to AdvancedRuleOverrideTile
- [RuleOverrideTile] Add GameObject overrides
- [RuleOverrideTile] List height lessen
- [RuleOverrideTile] Don't override null sprite
- [RuleOverrideTile] Add static preview
- [AdvancedRuleOverrideTile] List GUI simplify
- [RuleOverrideTile / AdvancedRuleOverrideTile] Show unused overrides
- [RuleOverrideTile / AdvancedRuleOverrideTile] Support multiple inheritance
- [RuleOverrideTile / AdvancedRuleOverrideTile] Prevent circular reference
- [AnimatedTile] Added Animation Start Frame which helps to calculate the Animation Start Time for a given Tilemap

### Fixed
- [RuleTile] Fixed RuleTile InstantiatedGameObject rotation/scale
- [RuleTile] Fixed override tiles have not update when default properties changed
- [AdvancedRuleOverrideTile] Fix override rule lost reference when source rule reorder
- [PrefabBrush] Use WorldToCell comparison when getting GameObjects using PrefabBrush

## [1.3.1] - 2019-11-06
### Changed
- [RuleTile] Simplified
- [RuleTile] Caching all RuleTile neighbor positions for Tilemap to speedup refresh affected tiles

### Fixed
- [RuleTile] Fix remote positions missing of MirrorXY (#148)
- [HexagonalRuleTile] Fix ApplyRandomTransform() of HexagonalRuleTile missing MirrorXY case
- [RuleOverrideTile] Fix RuleOverrideTile does not refresh when add/remove rule
- [RuleTile] Fix random rotation calculation mistake
- [RuleTile] Fix cache data will not update when rule change

## [1.3.0] - 2019-11-01
### Changed
- [RuleTile] changed from using index to using position.
- [RuleTile] Additional storage rule position.
- [RuleTile] Delete DontCare rule.
- [RuleTile] Rule list increased Extend Neighbor toggle. When selected, it will increase the rule range that can be set.
- [RuleTile] No longer fixed to checking around 8 rules.
- [RuleTile] RefreshTile() will refresh affected remote Tiles.
- [RuleTile] Delete GetMatchingNeighboringTiles(), no longer get nearby Tiles in advance, the performance is affected. (may be changed to cache later)
- [IsometricRuleTile] Rewrite.
- [HexagonalRuleTile] Rewrite.
- [LineBrush] Fix for Tiles disappear after selection and drag with LineBrush
- [RuleTile] Add MirrorXY Transform Rule

## [1.2.0] - 2019-10-17
### Changed
- [PrefabBrush] Erase GameObjects at target position before painting
- [RuleTileEditor] Made RuleTileEditor and children public
- [RuleTile] Roll back m_Self to this.
- [RuleOverrideTile] Remove m_OverrideSelf property.
- [RuleOverrideTile] Inherit custom properties from custom RuleTile.
- [RuleOverrideTile] Change m_RuntimeTile to m_InstanceTile.

## [1.1.0] - 2019-08-23
### Changed
- Validate Gap and Limit for GroupBrush
- Fix z iterator for RandomBrush
- Check randomTileSets on addToRandomTiles
- Add Anchor to GameObjectBrush and PrefabBrush

## [1.1.0] - 2019-03-22
### Changed
- Copy GameObject when copying TilingRule in RuleOverrideTile

## [1.1.0] - 2019-03-08
### Added
- Added com.unity.2d.tilemap as a dependency of com.unity.2d.tilemap.extras

### Changed
- Custom Grid Brushes have been updated to the UnityEditor.Tilemaps namespace

## [1.0.0] - 2019-01-02
### This is the first release of Tilemap Extras, as a Package
  • Loading branch information
Unity Technologies committed Feb 14, 2020
0 parents commit 82c1d36
Show file tree
Hide file tree
Showing 167 changed files with 7,954 additions and 0 deletions.
92 changes: 92 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Changelog
All notable changes to this package will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)

## [1.5.0-preview] - 2020-02-14
### Added
- Added CONTRIBUTING.md
- Updated LICENSE.md

### Fixed
- [WeightedRandomTile] Fixed WeightedRandomTile messing up Random.seed!


## [1.4.0] - 2020-01-07
### Added
- [RuleTile / HexagonalRuleTile / IsometricRuleTile / RuleOverrideTile] Added Asset Preview for TilingRules
- [RuleTile] Hidden Rule field
- [CustomRuleTile] Support custom field of Object type
- [CustomRuleTile] Support HideInInspector, DontOverride attributes
- [RuleOverrideTile] Move advanced mode to AdvancedRuleOverrideTile
- [RuleOverrideTile] Add GameObject overrides
- [RuleOverrideTile] List height lessen
- [RuleOverrideTile] Don't override null sprite
- [RuleOverrideTile] Add static preview
- [AdvancedRuleOverrideTile] List GUI simplify
- [RuleOverrideTile / AdvancedRuleOverrideTile] Show unused overrides
- [RuleOverrideTile / AdvancedRuleOverrideTile] Support multiple inheritance
- [RuleOverrideTile / AdvancedRuleOverrideTile] Prevent circular reference
- [AnimatedTile] Added Animation Start Frame which helps to calculate the Animation Start Time for a given Tilemap

### Fixed
- [RuleTile] Fixed RuleTile InstantiatedGameObject rotation/scale
- [RuleTile] Fixed override tiles have not update when default properties changed
- [AdvancedRuleOverrideTile] Fix override rule lost reference when source rule reorder
- [PrefabBrush] Use WorldToCell comparison when getting GameObjects using PrefabBrush

## [1.3.1] - 2019-11-06
### Changed
- [RuleTile] Simplified
- [RuleTile] Caching all RuleTile neighbor positions for Tilemap to speedup refresh affected tiles

### Fixed
- [RuleTile] Fix remote positions missing of MirrorXY (#148)
- [HexagonalRuleTile] Fix ApplyRandomTransform() of HexagonalRuleTile missing MirrorXY case
- [RuleOverrideTile] Fix RuleOverrideTile does not refresh when add/remove rule
- [RuleTile] Fix random rotation calculation mistake
- [RuleTile] Fix cache data will not update when rule change

## [1.3.0] - 2019-11-01
### Changed
- [RuleTile] changed from using index to using position.
- [RuleTile] Additional storage rule position.
- [RuleTile] Delete DontCare rule.
- [RuleTile] Rule list increased Extend Neighbor toggle. When selected, it will increase the rule range that can be set.
- [RuleTile] No longer fixed to checking around 8 rules.
- [RuleTile] RefreshTile() will refresh affected remote Tiles.
- [RuleTile] Delete GetMatchingNeighboringTiles(), no longer get nearby Tiles in advance, the performance is affected. (may be changed to cache later)
- [IsometricRuleTile] Rewrite.
- [HexagonalRuleTile] Rewrite.
- [LineBrush] Fix for Tiles disappear after selection and drag with LineBrush
- [RuleTile] Add MirrorXY Transform Rule

## [1.2.0] - 2019-10-17
### Changed
- [PrefabBrush] Erase GameObjects at target position before painting
- [RuleTileEditor] Made RuleTileEditor and children public
- [RuleTile] Roll back m_Self to this.
- [RuleOverrideTile] Remove m_OverrideSelf property.
- [RuleOverrideTile] Inherit custom properties from custom RuleTile.
- [RuleOverrideTile] Change m_RuntimeTile to m_InstanceTile.

## [1.1.0] - 2019-08-23
### Changed
- Validate Gap and Limit for GroupBrush
- Fix z iterator for RandomBrush
- Check randomTileSets on addToRandomTiles
- Add Anchor to GameObjectBrush and PrefabBrush

## [1.1.0] - 2019-03-22
### Changed
- Copy GameObject when copying TilingRule in RuleOverrideTile

## [1.1.0] - 2019-03-08
### Added
- Added com.unity.2d.tilemap as a dependency of com.unity.2d.tilemap.extras

### Changed
- Custom Grid Brushes have been updated to the UnityEditor.Tilemaps namespace

## [1.0.0] - 2019-01-02
### This is the first release of Tilemap Extras, as a Package
7 changes: 7 additions & 0 deletions CHANGELOG.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Contributing

## All contributions are subject to the [Unity Contribution Agreement(UCA)](https://unity3d.com/legal/licenses/Unity_Contribution_Agreement)
By making a pull request, you are confirming agreement to the terms and conditions of the UCA, including that your Contributions are your original creation and that you have complete right and authority to make your Contributions.

## Once you have a change ready following these ground rules. Simply make a pull request!
7 changes: 7 additions & 0 deletions CONTRIBUTING.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions Documentation~/AnimatedTile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Animated Tile

###### *Contribution by: MahdiMahzuni*

Animated Tiles are tiles which run through and display a list of sprites in sequence.

### Properties

| Property | Function |
| ------------------------------ | ------------------------------------------------------------ |
| __Number of Animated Sprites__ | Number of Animated Sprites in the Animated Tile. |
| __Sprite__ | The Sprite set for the Animated Tile. This will be played in sequence. |
| __Minimum Speed__ | The minimum possible speed at which the Animation of the Tile will be played. A speed value will be randomly chosen between the minimum and maximum speed. |
| __Maximum Speed__ | The maximum possible speed at which the Animation of the Tile will be played. A speed value will be randomly chosen between the minimum and maximum speed. |
| __Start Time__ | The starting time of this Animated Tile. This allows you to start the Animation from a particular Sprite in the list of Animated Sprites. |
| __Collider Type__ | The Collider Shape generated by the Tile. |

### Usage

Set up the Animated Tile with the Animated Sprites through the Animated Tile Editor.

![Animated Tile Editor](images/AnimatedTileEditor.png)

Paint the Animated Tile using the Tile Palette tools.

![Game View with Group Brush](images/AnimatedTile.png)
25 changes: 25 additions & 0 deletions Documentation~/Brushes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Scriptable Brushes



Scriptable Brushes are Grid Brushes which can paint items based on the position and conditions of the targeted position on the GridLayout. The paint behavior can be modified by the current editing Tool selected, such as Erase or Floodfill.



Here are some implementations of Scriptables Brushes which can help save time in designing your Tilemap:



- [Game Object Brush](GameObjectBrush.md)
- [Random Brush](RandomBrush.md)
- [Tint Brush](TintBrush.md)
- [Tint Brush (Smooth)](TintBrushSmooth.md)
- [Prefab Brush](PrefabBrush.md)
- [Coordinate Brush](CoordinateBrush.md)
- [Line Brush](LineBrush.md)
- [Group Brush](GroupBrush.md)



The manual page for Scriptable Brushes can be found [here](https://docs.unity3d.com/Manual/Tilemap-ScriptableBrushes.html).

23 changes: 23 additions & 0 deletions Documentation~/Contributors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Contributors

Thank you to all who have contributed to this repository!

- johnsoncodehk
- nicovain
- superkerokero
- pmurph0305
- janissimsons
- distantcam
- Pepperized
- MahdiMahzuni
- DreadBoy
- DoctorShinobi
- CraigGraff
- Autofire
- AVChemodanov
- ream88
- Quickz
- capnslipp
- TrentSterling

If anybody has been missed, please do let us know!
7 changes: 7 additions & 0 deletions Documentation~/CoordinateBrush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Coordinate Brush

###### *Contributions by: nicovain, pmurph0305*

This Brush displays the cell coordinates it is targeting in the SceneView. Use this as an example to create brushes which have extra visualization features when painting onto a Tilemap.

![Scene View with Coordinate Brush](images/CoordinateBrush.png)
102 changes: 102 additions & 0 deletions Documentation~/CustomRulesForRuleTile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Custom Rules for Rule Tile

###### *Contribution by: johnsoncodehk*

This helps to create new custom Rule Tile with new matching options, instead of the default options: Don't Care, This and Not This for the default Rule Tile. Using this will create clickable options for each Rule in your custom Rule Tile.

### Features

- Inheritable RuleTile
- Customizable attributes
- Can expand or rewrite neighbor rules and GUI display
- Can be used by RuleOverrideTile
- Template script (Menu: Assets/Create/Custom Rule Tile Script)
- Neighbor rules tooltip
- Backward compatible

### Usage

From the Assets menu, select Create/Custom Rule Tile Script. This will prompt you to create a new file with a name. After creating the file, you can edit it to add new matching options and the algorithm for testing matches.

### Examples

- Custom Attributes:

```csharp
public class MyTile : RuleTile {
public string tileId;
public bool isWater;
}
```

- Custom Rules:

```csharp
public class MyTile : RuleTile<MyTile.Neighbor> {
public class Neighbor {
public const int MyRule1 = 0;
public const int MyRule2 = 1;
}
public override bool RuleMatch(int neighbor, TileBase tile) {
switch (neighbor) {
case Neighbor.MyRule1: return false;
case Neighbor.MyRule2: return true;
}
return true;
}
}
```

- Expansion Rules

```csharp
public class MyTile : RuleTile<MyTile.Neighbor> {
public class Neighbor : RuleTile.TilingRule.Neighbor {
// 0, 1, 2 is using in RuleTile.TilingRule.Neighbor
public const int MyRule1 = 3;
public const int MyRule2 = 4;
}
public override bool RuleMatch(int neighbor, TileBase tile) {
switch (neighbor) {
case Neighbor.MyRule1: return false;
case Neighbor.MyRule2: return true;
}
return base.RuleMatch(neighbor, tile);
}
}
```

- Siblings Tile 1

```csharp
public class MyTile : RuleTile<MyTile.Neighbor> {
public List<TileBase> sibings = new List<TileBase>();
public class Neighbor : RuleTile.TilingRule.Neighbor {
public const int Sibing = 3;
}
public override bool RuleMatch(int neighbor, TileBase tile) {
switch (neighbor) {
case Neighbor.Sibing: return sibings.Contains(tile);
}
return base.RuleMatch(neighbor, tile);
}
}
```

- Siblings Tile 2

```csharp
public class MyTile : RuleTile<MyTile.Neighbor> {
public int siblingGroup;
public class Neighbor : RuleTile.TilingRule.Neighbor {
public const int Sibing = 3;
}
public override bool RuleMatch(int neighbor, TileBase tile) {
MyTile myTile = tile as MyTile;
switch (neighbor) {
case Neighbor.Sibing: return myTile && myTile.siblingGroup == siblingGroup;
}
return base.RuleMatch(neighbor, tile);
}
}
```
15 changes: 15 additions & 0 deletions Documentation~/GameObjectBrush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# GameObject Brush

This Brush instances, places and manipulates GameObjects onto the scene. Use this as an example to create brushes which targets objects other than tiles for manipulation.

### Usage

To pick GameObjects, change to the Pick tool and pick GameObjects from the Scene. Note that the GameObjects must be a child of the active Grid.

When painting with the GameObject Brush, the GameObject Brush will instantiate GameObjects picked onto the Scene.

![Scene View with GameObject Brush](images/GameObjectBrush.png)

### Implementation

The GameObjectBrush inherits from the GridBrush. It overrides the Paint method to paint a GameObject. It overrides the Erase method to be able to erase the GameObjects from the Scene. It overrides the BoxFill method to paint a GameObject in each cell defined by the Box tool. It overrides the Move methods to be able to move GameObjects in the Scene. It overrides the Flip methods to be able to flip GameObjects in the picked selection.
49 changes: 49 additions & 0 deletions Documentation~/GridInformation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Grid Information

A simple Component that stores and provides information based on Grid positions and keywords.



### Usage

Add this Component to a GameObject with a GridLayout Component.



To store information on to the GridInformation Component, use the following APIs:

```C#
public bool SetPositionProperty(Vector3Int position, String name, int positionProperty)

public bool SetPositionProperty(Vector3Int position, String name, string positionProperty)

public bool SetPositionProperty(Vector3Int position, String name, float positionProperty)

public bool SetPositionProperty(Vector3Int position, String name, double positionProperty)

public bool SetPositionProperty(Vector3Int position, String name, UnityEngine.Object positionProperty)

public bool SetPositionProperty(Vector3Int position, String name, Color positionProperty)
```



To get information from the GridInformation Component, use the following APIs:

```C#
public T GetPositionProperty<T>(Vector3Int position, String name, T defaultValue) where T : UnityEngine.Object

public int GetPositionProperty(Vector3Int position, String name, int defaultValue)

public string GetPositionProperty(Vector3Int position, String name, string defaultValue)

public float GetPositionProperty(Vector3Int position, String name, float defaultValue)

public double GetPositionProperty(Vector3Int position, String name, double defaultValue)

public Color GetPositionProperty(Vector3Int position, String name, Color defaultValue)
```



You can use this in combination with Scriptable Tiles to get the right Tile Data when laying out your Tilemap.
20 changes: 20 additions & 0 deletions Documentation~/GroupBrush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Group Brush

This Brush helps to pick Tiles which are grouped together by position. Gaps can be set to identify if Tiles belong to a Group. Limits can be set to ensure that an over-sized Group will not be picked. Use this as an example to create brushes that have the ability to choose and pick whichever Tiles it is interested in.

### Properties

| Property | Function |
| --------- | ------------------------------------------------------------ |
| __Gap__ | The gap in cell count before stopping to consider a Tile in a Group |
| __Limit__ | The count in cells beyond the initial position before stopping to consider a Tile in a Group |

### Usage

To select a group of Tiles, select the Pick Tool and pick a position on the Tilemap. The GroupBrush will select a group of Tiles based on its properties and create a Group.

![Scene View with Group Brush](images/GroupBrush.png)

### Implementation

The GroupBrush inherits from the GridBrush. It overrides the Pick method to pick a group of Tiles based on their position.
Loading

0 comments on commit 82c1d36

Please sign in to comment.