perf: removed unnecessary null checks on events

This commit is contained in:
2025-10-19 00:09:47 +03:00
parent ab05a89175
commit 598debc233

View File

@@ -36,7 +36,7 @@ public class Transform2D : Behaviour, ITransform2D
_position = value;
UpdateLocalPosition();
OnPositionChanged?.Invoke(this, new(previousPosition));
OnPositionChanged.Invoke(this, new(previousPosition));
}
}
@@ -52,7 +52,7 @@ public class Transform2D : Behaviour, ITransform2D
_scale = value;
UpdateLocalScale();
OnScaleChanged?.Invoke(this, new(previousScale));
OnScaleChanged.Invoke(this, new(previousScale));
}
}
@@ -68,7 +68,7 @@ public class Transform2D : Behaviour, ITransform2D
_rotation = value;
UpdateLocalRotation();
OnRotationChanged?.Invoke(this, new(previousRotation));
OnRotationChanged.Invoke(this, new(previousRotation));
}
}
@@ -84,7 +84,7 @@ public class Transform2D : Behaviour, ITransform2D
_localPosition = value;
UpdatePosition();
OnPositionChanged?.Invoke(this, new(previousPosition));
OnPositionChanged.Invoke(this, new(previousPosition));
}
}
@@ -102,8 +102,8 @@ public class Transform2D : Behaviour, ITransform2D
UpdateScale();
UpdatePosition();
OnScaleChanged?.Invoke(this, new(previousScale));
OnPositionChanged?.Invoke(this, new(previousPosition));
OnScaleChanged.Invoke(this, new(previousScale));
OnPositionChanged.Invoke(this, new(previousPosition));
}
}
@@ -119,7 +119,7 @@ public class Transform2D : Behaviour, ITransform2D
_localRotation = value;
UpdateRotation();
OnRotationChanged?.Invoke(this, new(previousRotation));
OnRotationChanged.Invoke(this, new(previousRotation));
}
}
@@ -130,7 +130,7 @@ public class Transform2D : Behaviour, ITransform2D
UpdatePosition();
OnPositionChanged?.Invoke(this, args);
OnPositionChanged.Invoke(this, args);
}
private void RecalculateScale(ITransform2D _, ITransform2D.ScaleChangedArguments args)
@@ -143,8 +143,8 @@ public class Transform2D : Behaviour, ITransform2D
UpdateScale();
UpdatePosition();
OnScaleChanged?.Invoke(this, args);
OnPositionChanged?.Invoke(this, new(previousPosition));
OnScaleChanged.Invoke(this, args);
OnPositionChanged.Invoke(this, new(previousPosition));
}
private void RecalculateRotation(ITransform2D _, ITransform2D.RotationChangedArguments args)
@@ -157,8 +157,8 @@ public class Transform2D : Behaviour, ITransform2D
UpdateRotation();
UpdatePosition();
OnRotationChanged?.Invoke(this, args);
OnPositionChanged?.Invoke(this, new(previousPosition));
OnRotationChanged.Invoke(this, args);
OnPositionChanged.Invoke(this, new(previousPosition));
}
private void UpdateLocalPosition()
@@ -252,9 +252,9 @@ public class Transform2D : Behaviour, ITransform2D
UpdateLocalScale();
UpdateLocalRotation();
OnPositionChanged?.Invoke(this, new(Position));
OnScaleChanged?.Invoke(this, new(Scale));
OnRotationChanged?.Invoke(this, new(Rotation));
OnPositionChanged.Invoke(this, new(Position));
OnScaleChanged.Invoke(this, new(Scale));
OnRotationChanged.Invoke(this, new(Rotation));
}
private void LookForTransform2D(IBehaviourController sender, IBehaviourController.BehaviourAddedArguments args)