mirror of
https://github.com/BlackMATov/unity-iso-tools.git
synced 2025-12-13 06:59:46 +07:00
fix false warnings
This commit is contained in:
@@ -405,10 +405,23 @@ namespace IsoTools.Internal {
|
||||
return a == b;
|
||||
}
|
||||
|
||||
public static bool Vec2Approximately(Vector2 a, Vector2 b, float precision) {
|
||||
return
|
||||
Mathf.Abs(a.x - b.x) < precision &&
|
||||
Mathf.Abs(a.y - b.y) < precision;
|
||||
}
|
||||
|
||||
public static bool Vec3Approximately(Vector3 a, Vector3 b) {
|
||||
return a == b;
|
||||
}
|
||||
|
||||
public static bool Vec3Approximately(Vector3 a, Vector3 b, float precision) {
|
||||
return
|
||||
Mathf.Abs(a.x - b.x) < precision &&
|
||||
Mathf.Abs(a.y - b.y) < precision &&
|
||||
Mathf.Abs(a.z - b.z) < precision;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// Beautifiers
|
||||
|
||||
@@ -116,9 +116,10 @@ namespace IsoTools.Internal {
|
||||
void CheckChangedTransform(IsoObject iso_object) {
|
||||
var iso_world = iso_object.isoWorld;
|
||||
if ( iso_world ) {
|
||||
var precision = Mathf.Min(iso_world.tileSize, iso_world.tileHeight) * 0.01f;
|
||||
var needed_position = iso_world.IsoToScreen(iso_object.position);
|
||||
var current_position = iso_object.transform.position;
|
||||
if ( !IsoUtils.Vec2Approximately(needed_position, current_position) ) {
|
||||
if ( !IsoUtils.Vec2Approximately(needed_position, current_position, precision) ) {
|
||||
Debug.LogWarning(
|
||||
"Don't change 'IsoObject.transform.position' manually!\n" +
|
||||
"Use 'IsoObject.position' instead.",
|
||||
|
||||
Reference in New Issue
Block a user