perf: removed unnecessary null checks on events
This commit is contained in:
@@ -36,7 +36,7 @@ public class Transform2D : Behaviour, ITransform2D
|
|||||||
_position = value;
|
_position = value;
|
||||||
|
|
||||||
UpdateLocalPosition();
|
UpdateLocalPosition();
|
||||||
OnPositionChanged?.Invoke(this, new(previousPosition));
|
OnPositionChanged.Invoke(this, new(previousPosition));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ public class Transform2D : Behaviour, ITransform2D
|
|||||||
_scale = value;
|
_scale = value;
|
||||||
|
|
||||||
UpdateLocalScale();
|
UpdateLocalScale();
|
||||||
OnScaleChanged?.Invoke(this, new(previousScale));
|
OnScaleChanged.Invoke(this, new(previousScale));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ public class Transform2D : Behaviour, ITransform2D
|
|||||||
_rotation = value;
|
_rotation = value;
|
||||||
|
|
||||||
UpdateLocalRotation();
|
UpdateLocalRotation();
|
||||||
OnRotationChanged?.Invoke(this, new(previousRotation));
|
OnRotationChanged.Invoke(this, new(previousRotation));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ public class Transform2D : Behaviour, ITransform2D
|
|||||||
_localPosition = value;
|
_localPosition = value;
|
||||||
|
|
||||||
UpdatePosition();
|
UpdatePosition();
|
||||||
OnPositionChanged?.Invoke(this, new(previousPosition));
|
OnPositionChanged.Invoke(this, new(previousPosition));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,8 +102,8 @@ public class Transform2D : Behaviour, ITransform2D
|
|||||||
|
|
||||||
UpdateScale();
|
UpdateScale();
|
||||||
UpdatePosition();
|
UpdatePosition();
|
||||||
OnScaleChanged?.Invoke(this, new(previousScale));
|
OnScaleChanged.Invoke(this, new(previousScale));
|
||||||
OnPositionChanged?.Invoke(this, new(previousPosition));
|
OnPositionChanged.Invoke(this, new(previousPosition));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ public class Transform2D : Behaviour, ITransform2D
|
|||||||
_localRotation = value;
|
_localRotation = value;
|
||||||
|
|
||||||
UpdateRotation();
|
UpdateRotation();
|
||||||
OnRotationChanged?.Invoke(this, new(previousRotation));
|
OnRotationChanged.Invoke(this, new(previousRotation));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ public class Transform2D : Behaviour, ITransform2D
|
|||||||
|
|
||||||
UpdatePosition();
|
UpdatePosition();
|
||||||
|
|
||||||
OnPositionChanged?.Invoke(this, args);
|
OnPositionChanged.Invoke(this, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RecalculateScale(ITransform2D _, ITransform2D.ScaleChangedArguments args)
|
private void RecalculateScale(ITransform2D _, ITransform2D.ScaleChangedArguments args)
|
||||||
@@ -143,8 +143,8 @@ public class Transform2D : Behaviour, ITransform2D
|
|||||||
UpdateScale();
|
UpdateScale();
|
||||||
UpdatePosition();
|
UpdatePosition();
|
||||||
|
|
||||||
OnScaleChanged?.Invoke(this, args);
|
OnScaleChanged.Invoke(this, args);
|
||||||
OnPositionChanged?.Invoke(this, new(previousPosition));
|
OnPositionChanged.Invoke(this, new(previousPosition));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RecalculateRotation(ITransform2D _, ITransform2D.RotationChangedArguments args)
|
private void RecalculateRotation(ITransform2D _, ITransform2D.RotationChangedArguments args)
|
||||||
@@ -157,8 +157,8 @@ public class Transform2D : Behaviour, ITransform2D
|
|||||||
UpdateRotation();
|
UpdateRotation();
|
||||||
UpdatePosition();
|
UpdatePosition();
|
||||||
|
|
||||||
OnRotationChanged?.Invoke(this, args);
|
OnRotationChanged.Invoke(this, args);
|
||||||
OnPositionChanged?.Invoke(this, new(previousPosition));
|
OnPositionChanged.Invoke(this, new(previousPosition));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateLocalPosition()
|
private void UpdateLocalPosition()
|
||||||
@@ -252,9 +252,9 @@ public class Transform2D : Behaviour, ITransform2D
|
|||||||
UpdateLocalScale();
|
UpdateLocalScale();
|
||||||
UpdateLocalRotation();
|
UpdateLocalRotation();
|
||||||
|
|
||||||
OnPositionChanged?.Invoke(this, new(Position));
|
OnPositionChanged.Invoke(this, new(Position));
|
||||||
OnScaleChanged?.Invoke(this, new(Scale));
|
OnScaleChanged.Invoke(this, new(Scale));
|
||||||
OnRotationChanged?.Invoke(this, new(Rotation));
|
OnRotationChanged.Invoke(this, new(Rotation));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LookForTransform2D(IBehaviourController sender, IBehaviourController.BehaviourAddedArguments args)
|
private void LookForTransform2D(IBehaviourController sender, IBehaviourController.BehaviourAddedArguments args)
|
||||||
|
Reference in New Issue
Block a user