remove UpDown iso type.

gizmos arrow polishing.
This commit is contained in:
2015-05-13 00:23:19 +06:00
parent 65a02ceb1d
commit 31f834c48c
6 changed files with 354 additions and 263 deletions

View File

@@ -25,18 +25,6 @@ namespace IsoTools {
return AccIn + p.Value; return AccIn + p.Value;
}) / _positions.Count; }) / _positions.Count;
} }
Vector3 XYMoveIsoObjects(Vector3 delta) {
Undo.RecordObjects(_positions.Keys.ToArray(), "Move");
return _positions.Aggregate(Vector3.zero, (AccIn, pair) => {
var iso_object = pair.Key;
var iso_orig_pos = pair.Value;
iso_object.transform.position = iso_orig_pos + delta;
iso_object.FixIsoPosition();
var pos_delta = iso_object.transform.position - iso_orig_pos;
return pos_delta.magnitude > AccIn.magnitude ? pos_delta : AccIn;
});
}
float ZMoveIsoObjects(float delta) { float ZMoveIsoObjects(float delta) {
Undo.RecordObjects(_iso_zpositions.Keys.ToArray(), "Move"); Undo.RecordObjects(_iso_zpositions.Keys.ToArray(), "Move");
@@ -50,6 +38,41 @@ namespace IsoTools {
}); });
} }
Vector3 XYMoveIsoObjects(Vector3 delta) {
Undo.RecordObjects(_positions.Keys.ToArray(), "Move");
return _positions.Aggregate(Vector3.zero, (AccIn, pair) => {
var iso_object = pair.Key;
var iso_orig_p = pair.Value;
iso_object.transform.position = iso_orig_p + delta;
iso_object.FixIsoPosition();
var pos_delta = iso_object.transform.position - iso_orig_p;
return pos_delta.magnitude > AccIn.magnitude ? pos_delta : AccIn;
});
}
void ZMoveSlider() {
var iso_world = GameObject.FindObjectOfType<IsoWorld>();
if ( iso_world ) {
Handles.color = Handles.zAxisColor;
var delta = Handles.Slider(_viewCenter, IsoUtils.Vec3OneY) - _viewCenter;
if ( Mathf.Abs(delta.y) > Mathf.Epsilon ) {
float tmp_y = ZMoveIsoObjects((_viewCenter.y - _center.y + delta.y) / iso_world.TileSize);
_viewCenter = _center + IsoUtils.Vec3FromY(tmp_y * iso_world.TileSize);
}
}
}
void XYMoveSlider(Color color, Vector3 dir) {
var iso_world = GameObject.FindObjectOfType<IsoWorld>();
if ( iso_world ) {
Handles.color = color;
var delta = Handles.Slider(_viewCenter, iso_world.IsoToScreen(dir)) - _viewCenter;
if ( delta.magnitude > Mathf.Epsilon ) {
_viewCenter = _center + XYMoveIsoObjects(_viewCenter - _center + delta);
}
}
}
void XYMoveRectangle() { void XYMoveRectangle() {
Handles.color = IsoUtils.ColorChangeA(Handles.zAxisColor, 0.3f); Handles.color = IsoUtils.ColorChangeA(Handles.zAxisColor, 0.3f);
Handles.DotCap( Handles.DotCap(
@@ -75,20 +98,7 @@ namespace IsoTools {
} }
} }
void ZMoveSlider() {
var iso_world = GameObject.FindObjectOfType<IsoWorld>();
if ( iso_world ) {
Handles.color = Handles.yAxisColor;
var delta = Handles.Slider(_viewCenter, IsoUtils.Vec3OneY) - _viewCenter;
if ( Mathf.Abs(delta.y) > Mathf.Epsilon ) {
float tmp_y = ZMoveIsoObjects((_viewCenter.y - _center.y + delta.y) / iso_world.TileSize);
_viewCenter = _center + IsoUtils.Vec3FromY(tmp_y * iso_world.TileSize);
}
}
}
void OnEnable() { void OnEnable() {
Tools.hidden = true;
GrabPositions(); GrabPositions();
} }
@@ -97,8 +107,15 @@ namespace IsoTools {
} }
void OnSceneGUI() { void OnSceneGUI() {
ZMoveSlider(); if ( Tools.current == Tool.Move ) {
XYMoveRectangle(); Tools.hidden = true;
ZMoveSlider();
XYMoveSlider(Handles.xAxisColor, IsoUtils.Vec3OneX);
XYMoveSlider(Handles.yAxisColor, IsoUtils.Vec3OneY);
XYMoveRectangle();
} else {
Tools.hidden = false;
}
} }
public override void OnInspectorGUI() { public override void OnInspectorGUI() {

View File

@@ -87,6 +87,64 @@ NavMeshSettings:
cellSize: .166666672 cellSize: .166666672
manualCellSize: 0 manualCellSize: 0
m_NavMeshData: {fileID: 0} m_NavMeshData: {fileID: 0}
--- !u!1001 &274776129
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalPosition.y
value: 16
objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalPosition.z
value: 14.2857141
objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: _position.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 11453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: _position.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 153404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_Name
value: Floor_3x4
objectReference: {fileID: 0}
- target: {fileID: 11453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: _position.z
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
m_IsPrefabParent: 0
--- !u!1 &318480492 --- !u!1 &318480492
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -171,7 +229,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 5 m_RootOrder: 7
--- !u!114 &318480498 --- !u!114 &318480498
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -183,7 +241,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3f01619d3802e814f86f9e6bb965349a, type: 3} m_Script: {fileID: 11500000, guid: 3f01619d3802e814f86f9e6bb965349a, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_tileType: 0
_tileSize: 16 _tileSize: 16
_minDepth: 0 _minDepth: 0
_maxDepth: 100 _maxDepth: 100
@@ -196,15 +253,15 @@ Prefab:
m_Modifications: m_Modifications:
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: -16 value: -32
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
value: 24 value: 16
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: 20 value: 57.1428566
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
@@ -224,11 +281,11 @@ Prefab:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 1 value: 4
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _position.x propertyPath: _position.x
value: 1 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _position.y propertyPath: _position.y
@@ -250,118 +307,6 @@ Prefab:
m_ParentPrefab: {fileID: 100100000, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} m_ParentPrefab: {fileID: 100100000, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
m_IsPrefabParent: 0 m_IsPrefabParent: 0
--- !u!1001 &409886624 --- !u!1001 &409886624
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.y
value: 16
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _position.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _position.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _alignment
value: 1
objectReference: {fileID: 0}
- target: {fileID: 117528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_Name
value: Cube_1x1x4
objectReference: {fileID: 0}
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _position.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
m_IsPrefabParent: 0
--- !u!1001 &940832437
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalPosition.z
value: 80
objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 11453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: _position.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 11453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: _position.y
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
m_IsPrefabParent: 0
--- !u!1001 &1454547313
Prefab: Prefab:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 2 serializedVersion: 2
@@ -378,53 +323,7 @@ Prefab:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: 60 value: 71.4285736
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 117528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_Name
value: Cube_1x1x2
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
m_IsPrefabParent: 0
--- !u!1001 &1818595414
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.x
value: 16
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.y
value: 24
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.z
value: 40
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
@@ -452,8 +351,186 @@ Prefab:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _position.y propertyPath: _position.y
value: 2
objectReference: {fileID: 0}
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _alignment
value: 1 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 117528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_Name
value: Cube_1x1x4
objectReference: {fileID: 0}
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _position.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
m_IsPrefabParent: 0
--- !u!1001 &1197576131
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.y
value: 16
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 117528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_Name
value: Cube_1x1x5
objectReference: {fileID: 0}
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _position.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _position.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _position.z
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
m_IsPrefabParent: 0
--- !u!1001 &1454547313
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.z
value: 28.5714283
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_RootOrder
value: 5
objectReference: {fileID: 0}
- target: {fileID: 117528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_Name
value: Cube_1x1x2
objectReference: {fileID: 0}
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _position.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _position.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _position.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
m_IsPrefabParent: 0
--- !u!1001 &1818595414
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.x
value: 32
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.y
value: 16
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.z
value: 42.8571434
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_RootOrder
value: 6
objectReference: {fileID: 0}
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _position.x
value: 2
objectReference: {fileID: 0}
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _position.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _alignment propertyPath: _alignment
value: 1 value: 1
@@ -465,3 +542,53 @@ Prefab:
m_RemovedComponents: [] m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} m_ParentPrefab: {fileID: 100100000, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
m_IsPrefabParent: 0 m_IsPrefabParent: 0
--- !u!1001 &2146784705
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalPosition.z
value: 85.7142868
objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 11453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: _position.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 11453404, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
propertyPath: _position.y
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: d10e5320df9f84d4186bda0ba98db9ff, type: 2}
m_IsPrefabParent: 0

View File

@@ -9,12 +9,6 @@ using UnityEditor;
namespace IsoTools { namespace IsoTools {
[ExecuteInEditMode] [ExecuteInEditMode]
public class IsoWorld : MonoBehaviour { public class IsoWorld : MonoBehaviour {
/// <summary>World tile types.</summary>
public enum TileTypes {
Isometric,
UpDown
}
class ObjectInfo { class ObjectInfo {
public int Index; public int Index;
@@ -54,22 +48,10 @@ namespace IsoTools {
Vector3 _objsMaxNumPos = Vector3.zero; Vector3 _objsMaxNumPos = Vector3.zero;
Vector3 _objsNumPosCount = Vector3.zero; Vector3 _objsNumPosCount = Vector3.zero;
TileTypes _lastTileType = TileTypes.Isometric;
float _lastTileSize = 0.0f; float _lastTileSize = 0.0f;
float _lastMinDepth = 0.0f; float _lastMinDepth = 0.0f;
float _lastMaxDepth = 0.0f; float _lastMaxDepth = 0.0f;
[SerializeField]
public TileTypes _tileType = TileTypes.Isometric;
/// <summary>World tile type.</summary>
public TileTypes TileType {
get { return _tileType; }
set {
_tileType = value;
ChangeSortingProperty();
}
}
[SerializeField] [SerializeField]
public float _tileSize = 32.0f; public float _tileSize = 32.0f;
/// <summary>Isometric tile size.</summary> /// <summary>Isometric tile size.</summary>
@@ -136,18 +118,9 @@ namespace IsoTools {
/// <param name="pos">Isometric coordinates.</param> /// <param name="pos">Isometric coordinates.</param>
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
public Vector2 IsoToScreen(Vector3 pos) { public Vector2 IsoToScreen(Vector3 pos) {
switch ( TileType ) { return new Vector2(
case TileTypes.Isometric: (pos.x - pos.y),
return new Vector2( (pos.x + pos.y) * 0.5f + pos.z) * TileSize;
(pos.x - pos.y),
(pos.x + pos.y) * 0.5f + pos.z) * TileSize;
case TileTypes.UpDown:
return new Vector2(
pos.x,
pos.y + pos.z) * TileSize;
default:
throw new UnityException("IsoWorld. TileType is wrong!");
}
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
@@ -158,20 +131,10 @@ namespace IsoTools {
/// <param name="pos">Screen coordinates.</param> /// <param name="pos">Screen coordinates.</param>
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
public Vector3 ScreenToIso(Vector2 pos) { public Vector3 ScreenToIso(Vector2 pos) {
switch ( TileType ) { return new Vector3(
case TileTypes.Isometric: (pos.x * 0.5f + pos.y),
return new Vector3( (pos.y - pos.x * 0.5f),
(pos.x * 0.5f + pos.y), 0.0f) / TileSize;
(pos.y - pos.x * 0.5f),
0.0f) / TileSize;
case TileTypes.UpDown:
return new Vector3(
pos.x,
pos.y,
0.0f) / TileSize;
default:
throw new UnityException("IsoWorld. TileType is wrong!");
}
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
@@ -183,20 +146,9 @@ namespace IsoTools {
/// <param name="iso_z">Point isometric height.</param> /// <param name="iso_z">Point isometric height.</param>
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
public Vector3 ScreenToIso(Vector2 pos, float iso_z) { public Vector3 ScreenToIso(Vector2 pos, float iso_z) {
switch ( TileType ) { var iso_pos = ScreenToIso(new Vector2(pos.x, pos.y - iso_z * TileSize));
case TileTypes.Isometric: { iso_pos.z = iso_z;
var iso_pos = ScreenToIso(new Vector2(pos.x, pos.y - iso_z * TileSize)); return iso_pos;
iso_pos.z = iso_z;
return iso_pos;
}
case TileTypes.UpDown: {
var iso_pos = ScreenToIso(new Vector2(pos.x, pos.y - iso_z * TileSize));
iso_pos.z = iso_z;
return iso_pos;
}
default:
throw new UnityException("IsoWorld. TileType is wrong!");
}
} }
void MarkEditorWorldDirty() { void MarkEditorWorldDirty() {
@@ -221,7 +173,6 @@ namespace IsoTools {
void ChangeSortingProperty() { void ChangeSortingProperty() {
MarkDirty(); MarkDirty();
FixAllTransforms(); FixAllTransforms();
_lastTileType = TileType;
_lastTileSize = TileSize; _lastTileSize = TileSize;
_lastMinDepth = MinDepth; _lastMinDepth = MinDepth;
_lastMaxDepth = MaxDepth; _lastMaxDepth = MaxDepth;
@@ -403,10 +354,9 @@ namespace IsoTools {
void LateUpdate() { void LateUpdate() {
if ( Application.isEditor ) { if ( Application.isEditor ) {
if ( _lastTileType != _tileType ) TileType = _tileType; if ( !Mathf.Approximately(_lastTileSize, _tileSize) ) TileSize = _tileSize;
if ( !Mathf.Approximately(_lastTileSize, _tileSize ) ) TileSize = _tileSize; if ( !Mathf.Approximately(_lastMinDepth, _minDepth) ) MinDepth = _minDepth;
if ( !Mathf.Approximately(_lastMinDepth, _minDepth ) ) MinDepth = _minDepth; if ( !Mathf.Approximately(_lastMaxDepth, _maxDepth) ) MaxDepth = _maxDepth;
if ( !Mathf.Approximately(_lastMaxDepth, _maxDepth ) ) MaxDepth = _maxDepth;
} }
StepSort(); StepSort();
} }

View File

@@ -23,7 +23,7 @@ Global
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Assembly-CSharp.csproj StartupItem = Assembly-CSharp.csproj
Policies = $0 Policies = $0
$0.TextStylePolicy = $1 $0.TextStylePolicy = $1

View File

@@ -23,7 +23,7 @@ Global
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Assembly-CSharp.csproj StartupItem = Assembly-CSharp.csproj
Policies = $0 Policies = $0
$0.TextStylePolicy = $1 $0.TextStylePolicy = $1

View File

@@ -1,11 +1,8 @@
<Properties> <Properties>
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" /> <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.Workbench ActiveDocument="Assets/IsoTools/Scripts/IsoWorld.cs"> <MonoDevelop.Ide.Workbench ActiveDocument="Assets/IsoTools/Editor/IsoObjectEditor.cs">
<Files> <Files>
<File FileName="Assets/IsoTools/Scripts/IsoObject.cs" Line="198" Column="1" /> <File FileName="Assets/IsoTools/Editor/IsoObjectEditor.cs" Line="106" Column="25" />
<File FileName="Assets/IsoTools/Editor/IsoObjectEditor.cs" Line="109" Column="24" />
<File FileName="Assets/IsoTools/Scripts/IsoWorld.cs" Line="419" Column="53" />
<File FileName="Assets/IsoTools/Scripts/IsoUtils.cs" Line="27" Column="30" />
</Files> </Files>
</MonoDevelop.Ide.Workbench> </MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.Breakpoints> <MonoDevelop.Ide.DebuggingService.Breakpoints>