feat: ITransform.OnTransformUpdated event added
This commit is contained in:
@@ -8,6 +8,7 @@ public class Transform2D : Behaviour, ITransform2D
|
||||
public Event<ITransform2D, ITransform2D.PositionChangedArguments> OnPositionChanged { get; } = new();
|
||||
public Event<ITransform2D, ITransform2D.ScaleChangedArguments> OnScaleChanged { get; } = new();
|
||||
public Event<ITransform2D, ITransform2D.RotationChangedArguments> OnRotationChanged { get; } = new();
|
||||
public Event<ITransform2D> OnTransformUpdated { get; } = new();
|
||||
|
||||
private Vector2D _position = Vector2D.Zero;
|
||||
private Vector2D _scale = Vector2D.One;
|
||||
@@ -37,6 +38,7 @@ public class Transform2D : Behaviour, ITransform2D
|
||||
|
||||
UpdateLocalPosition();
|
||||
OnPositionChanged.Invoke(this, new(previousPosition));
|
||||
OnTransformUpdated.Invoke(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +55,7 @@ public class Transform2D : Behaviour, ITransform2D
|
||||
|
||||
UpdateLocalScale();
|
||||
OnScaleChanged.Invoke(this, new(previousScale));
|
||||
OnTransformUpdated.Invoke(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +72,7 @@ public class Transform2D : Behaviour, ITransform2D
|
||||
|
||||
UpdateLocalRotation();
|
||||
OnRotationChanged.Invoke(this, new(previousRotation));
|
||||
OnTransformUpdated.Invoke(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +89,7 @@ public class Transform2D : Behaviour, ITransform2D
|
||||
|
||||
UpdatePosition();
|
||||
OnPositionChanged.Invoke(this, new(previousPosition));
|
||||
OnTransformUpdated.Invoke(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,6 +109,7 @@ public class Transform2D : Behaviour, ITransform2D
|
||||
UpdatePosition();
|
||||
OnScaleChanged.Invoke(this, new(previousScale));
|
||||
OnPositionChanged.Invoke(this, new(previousPosition));
|
||||
OnTransformUpdated.Invoke(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,6 +126,7 @@ public class Transform2D : Behaviour, ITransform2D
|
||||
|
||||
UpdateRotation();
|
||||
OnRotationChanged.Invoke(this, new(previousRotation));
|
||||
OnTransformUpdated.Invoke(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,6 +138,7 @@ public class Transform2D : Behaviour, ITransform2D
|
||||
UpdatePosition();
|
||||
|
||||
OnPositionChanged.Invoke(this, args);
|
||||
OnTransformUpdated.Invoke(this);
|
||||
}
|
||||
|
||||
private void RecalculateScale(ITransform2D _, ITransform2D.ScaleChangedArguments args)
|
||||
@@ -145,6 +153,7 @@ public class Transform2D : Behaviour, ITransform2D
|
||||
|
||||
OnScaleChanged.Invoke(this, args);
|
||||
OnPositionChanged.Invoke(this, new(previousPosition));
|
||||
OnTransformUpdated.Invoke(this);
|
||||
}
|
||||
|
||||
private void RecalculateRotation(ITransform2D _, ITransform2D.RotationChangedArguments args)
|
||||
@@ -159,6 +168,7 @@ public class Transform2D : Behaviour, ITransform2D
|
||||
|
||||
OnRotationChanged.Invoke(this, args);
|
||||
OnPositionChanged.Invoke(this, new(previousPosition));
|
||||
OnTransformUpdated.Invoke(this);
|
||||
}
|
||||
|
||||
private void UpdateLocalPosition()
|
||||
@@ -255,6 +265,7 @@ public class Transform2D : Behaviour, ITransform2D
|
||||
OnPositionChanged.Invoke(this, new(Position));
|
||||
OnScaleChanged.Invoke(this, new(Scale));
|
||||
OnRotationChanged.Invoke(this, new(Rotation));
|
||||
OnTransformUpdated.Invoke(this);
|
||||
}
|
||||
|
||||
private void LookForTransform2D(IBehaviourController sender, IBehaviourController.BehaviourAddedArguments args)
|
||||
|
Reference in New Issue
Block a user