Pull request #15: center GOs without offsetting them
Merge in CGD/gather-and-defend from bugfix/center_GOs_on_tiles to main * commit '102f646340ba8c56ec5c1c64a3c99642e3cc2f65': center GOs without offsetting them
This commit is contained in:
commit
c680713526
@ -120,6 +120,7 @@ Important considerations :
|
|||||||
foreach (TilemapData tilemapData in targ.Level)
|
foreach (TilemapData tilemapData in targ.Level)
|
||||||
{
|
{
|
||||||
var tilemap = new GameObject(tilemapData.Key).AddComponent<Tilemap>();
|
var tilemap = new GameObject(tilemapData.Key).AddComponent<Tilemap>();
|
||||||
|
tilemap.tileAnchor = Vector3.zero;
|
||||||
tilemap.gameObject.AddComponent<TilemapRenderer>();
|
tilemap.gameObject.AddComponent<TilemapRenderer>();
|
||||||
tilemapData.LoadToTilemap(tilemap);
|
tilemapData.LoadToTilemap(tilemap);
|
||||||
tilemap.transform.SetParent(targ.transform);
|
tilemap.transform.SetParent(targ.transform);
|
||||||
|
|||||||
@ -316,7 +316,7 @@ TilemapRenderer:
|
|||||||
m_SortingLayer: 0
|
m_SortingLayer: 0
|
||||||
m_SortingOrder: 1
|
m_SortingOrder: 1
|
||||||
m_ChunkSize: {x: 32, y: 32, z: 32}
|
m_ChunkSize: {x: 32, y: 32, z: 32}
|
||||||
m_ChunkCullingBounds: {x: 0, y: 0, z: 0}
|
m_ChunkCullingBounds: {x: 0.5, y: 0.5, z: 0}
|
||||||
m_MaxChunkCount: 16
|
m_MaxChunkCount: 16
|
||||||
m_MaxFrameAge: 16
|
m_MaxFrameAge: 16
|
||||||
m_SortOrder: 0
|
m_SortOrder: 0
|
||||||
@ -806,7 +806,7 @@ Tilemap:
|
|||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_Origin: {x: -10, y: -4, z: 0}
|
m_Origin: {x: -10, y: -4, z: 0}
|
||||||
m_Size: {x: 21, y: 7, z: 1}
|
m_Size: {x: 21, y: 7, z: 1}
|
||||||
m_TileAnchor: {x: 0.5, y: 0.5, z: 0}
|
m_TileAnchor: {x: 0, y: 0, z: 0}
|
||||||
m_TileOrientation: 0
|
m_TileOrientation: 0
|
||||||
m_TileOrientationMatrix:
|
m_TileOrientationMatrix:
|
||||||
e00: 1
|
e00: 1
|
||||||
@ -900,7 +900,7 @@ TilemapRenderer:
|
|||||||
m_SortingLayer: 0
|
m_SortingLayer: 0
|
||||||
m_SortingOrder: 0
|
m_SortingOrder: 0
|
||||||
m_ChunkSize: {x: 32, y: 32, z: 32}
|
m_ChunkSize: {x: 32, y: 32, z: 32}
|
||||||
m_ChunkCullingBounds: {x: 0, y: 0, z: 0}
|
m_ChunkCullingBounds: {x: 0.5, y: 0.5, z: 0}
|
||||||
m_MaxChunkCount: 16
|
m_MaxChunkCount: 16
|
||||||
m_MaxFrameAge: 16
|
m_MaxFrameAge: 16
|
||||||
m_SortOrder: 0
|
m_SortOrder: 0
|
||||||
@ -2420,7 +2420,7 @@ Tilemap:
|
|||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_Origin: {x: -10, y: -4, z: 0}
|
m_Origin: {x: -10, y: -4, z: 0}
|
||||||
m_Size: {x: 21, y: 7, z: 1}
|
m_Size: {x: 21, y: 7, z: 1}
|
||||||
m_TileAnchor: {x: 0.5, y: 0.5, z: 0}
|
m_TileAnchor: {x: 0, y: 0, z: 0}
|
||||||
m_TileOrientation: 0
|
m_TileOrientation: 0
|
||||||
m_TileOrientationMatrix:
|
m_TileOrientationMatrix:
|
||||||
e00: 1
|
e00: 1
|
||||||
@ -2705,7 +2705,7 @@ Tilemap:
|
|||||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||||
m_Origin: {x: -10, y: -4, z: 0}
|
m_Origin: {x: -10, y: -4, z: 0}
|
||||||
m_Size: {x: 21, y: 7, z: 1}
|
m_Size: {x: 21, y: 7, z: 1}
|
||||||
m_TileAnchor: {x: 0.5, y: 0.5, z: 0}
|
m_TileAnchor: {x: 0, y: 0, z: 0}
|
||||||
m_TileOrientation: 0
|
m_TileOrientation: 0
|
||||||
m_TileOrientationMatrix:
|
m_TileOrientationMatrix:
|
||||||
e00: 1
|
e00: 1
|
||||||
|
|||||||
@ -72,38 +72,6 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_entityLinked: {fileID: 5998513223176943995}
|
_entityLinked: {fileID: 5998513223176943995}
|
||||||
--- !u!1 &3383419206106522944
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 6362326292554678953}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Wrapper
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!4 &6362326292554678953
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 3383419206106522944}
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: 0.5, y: 0.5, z: 0}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_ConstrainProportionsScale: 0
|
|
||||||
m_Children:
|
|
||||||
- {fileID: 6962989255883535387}
|
|
||||||
m_Father: {fileID: 6962989255644195631}
|
|
||||||
m_RootOrder: 1
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!1 &6962989255035248094
|
--- !u!1 &6962989255035248094
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -453,7 +421,7 @@ Transform:
|
|||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 6962989256011107500}
|
- {fileID: 6962989256011107500}
|
||||||
- {fileID: 6362326292554678953}
|
- {fileID: 6962989255883535387}
|
||||||
- {fileID: 71124047072817123}
|
- {fileID: 71124047072817123}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
@ -743,8 +711,8 @@ Transform:
|
|||||||
- {fileID: 6962989255885988242}
|
- {fileID: 6962989255885988242}
|
||||||
- {fileID: 6962989256565824838}
|
- {fileID: 6962989256565824838}
|
||||||
- {fileID: 6962989256410121263}
|
- {fileID: 6962989256410121263}
|
||||||
m_Father: {fileID: 6362326292554678953}
|
m_Father: {fileID: 6962989255644195631}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 1
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!95 &6962989255883535384
|
--- !u!95 &6962989255883535384
|
||||||
Animator:
|
Animator:
|
||||||
|
|||||||
@ -1,37 +1,5 @@
|
|||||||
%YAML 1.1
|
%YAML 1.1
|
||||||
%TAG !u! tag:unity3d.com,2011:
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
--- !u!1 &4770868994596278828
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 6485819158859757590}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Wrapper
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!4 &6485819158859757590
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 4770868994596278828}
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: 0.5, y: 0.5, z: 0}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_ConstrainProportionsScale: 0
|
|
||||||
m_Children:
|
|
||||||
- {fileID: 6962989256011107500}
|
|
||||||
m_Father: {fileID: 6962989255644195631}
|
|
||||||
m_RootOrder: 0
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!1 &6962989255644195630
|
--- !u!1 &6962989255644195630
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -64,7 +32,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 6485819158859757590}
|
- {fileID: 6962989256011107500}
|
||||||
- {fileID: 6802302589573039538}
|
- {fileID: 6802302589573039538}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
@ -199,7 +167,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 0.5394133, y: 0.56488746, z: 0.9686}
|
m_LocalScale: {x: 0.5394133, y: 0.56488746, z: 0.9686}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 6485819158859757590}
|
m_Father: {fileID: 6962989255644195631}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!212 &6962989256011107501
|
--- !u!212 &6962989256011107501
|
||||||
|
|||||||
@ -72,38 +72,6 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_entityLinked: {fileID: 8585520847943034727}
|
_entityLinked: {fileID: 8585520847943034727}
|
||||||
--- !u!1 &3780396010419979768
|
|
||||||
GameObject:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
serializedVersion: 6
|
|
||||||
m_Component:
|
|
||||||
- component: {fileID: 8332730521900469995}
|
|
||||||
m_Layer: 0
|
|
||||||
m_Name: Wrapper
|
|
||||||
m_TagString: Untagged
|
|
||||||
m_Icon: {fileID: 0}
|
|
||||||
m_NavMeshLayer: 0
|
|
||||||
m_StaticEditorFlags: 0
|
|
||||||
m_IsActive: 1
|
|
||||||
--- !u!4 &8332730521900469995
|
|
||||||
Transform:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 3780396010419979768}
|
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
||||||
m_LocalPosition: {x: 0.5, y: 0.5, z: 0}
|
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
||||||
m_ConstrainProportionsScale: 0
|
|
||||||
m_Children:
|
|
||||||
- {fileID: 6962989255883535387}
|
|
||||||
m_Father: {fileID: 6962989255644195631}
|
|
||||||
m_RootOrder: 1
|
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
||||||
--- !u!1 &6962989255035248094
|
--- !u!1 &6962989255035248094
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -453,7 +421,7 @@ Transform:
|
|||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 6962989256011107500}
|
- {fileID: 6962989256011107500}
|
||||||
- {fileID: 8332730521900469995}
|
- {fileID: 6962989255883535387}
|
||||||
- {fileID: 71124047072817123}
|
- {fileID: 71124047072817123}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
@ -742,8 +710,8 @@ Transform:
|
|||||||
- {fileID: 6962989255885988242}
|
- {fileID: 6962989255885988242}
|
||||||
- {fileID: 6962989256565824838}
|
- {fileID: 6962989256565824838}
|
||||||
- {fileID: 6962989256410121263}
|
- {fileID: 6962989256410121263}
|
||||||
m_Father: {fileID: 8332730521900469995}
|
m_Father: {fileID: 6962989255644195631}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 1
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!95 &6962989255883535384
|
--- !u!95 &6962989255883535384
|
||||||
Animator:
|
Animator:
|
||||||
|
|||||||
@ -128,6 +128,7 @@ namespace GatherAndDefend.LevelEditor
|
|||||||
if (!tilemap)
|
if (!tilemap)
|
||||||
{
|
{
|
||||||
tilemap = new GameObject(key).AddComponent<Tilemap>();
|
tilemap = new GameObject(key).AddComponent<Tilemap>();
|
||||||
|
tilemap.tileAnchor = Vector3.zero;
|
||||||
tilemap.gameObject.AddComponent<TilemapRenderer>();
|
tilemap.gameObject.AddComponent<TilemapRenderer>();
|
||||||
tilemap.transform.SetParent(grid.transform);
|
tilemap.transform.SetParent(grid.transform);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -140,6 +140,7 @@ public class LevelManager : Singleton<LevelManager>
|
|||||||
foreach (TilemapData tilemapData in _currentLevel)
|
foreach (TilemapData tilemapData in _currentLevel)
|
||||||
{
|
{
|
||||||
var tilemap = new GameObject(tilemapData.Key).AddComponent<Tilemap>();
|
var tilemap = new GameObject(tilemapData.Key).AddComponent<Tilemap>();
|
||||||
|
tilemap.tileAnchor = Vector3.zero;
|
||||||
tilemap.gameObject.AddComponent<TilemapRenderer>();
|
tilemap.gameObject.AddComponent<TilemapRenderer>();
|
||||||
tilemapData.LoadToTilemap(tilemap);
|
tilemapData.LoadToTilemap(tilemap);
|
||||||
tilemap.transform.SetParent(grid.transform);
|
tilemap.transform.SetParent(grid.transform);
|
||||||
|
|||||||
@ -21,6 +21,7 @@ public class TestLevelManager
|
|||||||
_farm.name = nameof(_farm);
|
_farm.name = nameof(_farm);
|
||||||
|
|
||||||
_tilemap = new GameObject("Tilemap").AddComponent<Tilemap>();
|
_tilemap = new GameObject("Tilemap").AddComponent<Tilemap>();
|
||||||
|
_tilemap.tileAnchor = Vector3.zero;
|
||||||
for (int i = 0; i < size; i++)
|
for (int i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
var pos = new Vector3Int(i % sqrt_size, i / sqrt_size);
|
var pos = new Vector3Int(i % sqrt_size, i / sqrt_size);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user