| | | 1 | | //======================================================================= |
| | | 2 | | // ITransient.cs |
| | | 3 | | //======================================================================= |
| | | 4 | | // MIT License, Copyright (c) 2024-present David Oravsky (mrdav30) |
| | | 5 | | // See LICENSE file in the project root for full license information. |
| | | 6 | | //======================================================================= |
| | | 7 | | |
| | | 8 | | namespace Trailblazer.Support; |
| | | 9 | | |
| | | 10 | | /// <summary> |
| | | 11 | | /// Defines support for runtime properties marked with <see cref="TransientAttribute"/>. |
| | | 12 | | /// <para> |
| | | 13 | | /// In Trailblazer, "transient" means frame-local state that can be synchronized from another |
| | | 14 | | /// instance or cleared back to defaults. The attribute does not control serialization on its own. |
| | | 15 | | /// </para> |
| | | 16 | | /// </summary> |
| | | 17 | | public interface ITransient |
| | | 18 | | { |
| | | 19 | | /// <summary> |
| | | 20 | | /// Synchronizes transient properties with another instance. |
| | | 21 | | /// </summary> |
| | | 22 | | /// <param name="other">The other instance to sync with.</param> |
| | | 23 | | public void SyncTransientState(ITransient other) |
| | | 24 | | { |
| | 4 | 25 | | TransientStateUtility.Sync(this, other); |
| | 4 | 26 | | } |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// Clears all transient properties by resetting them to their default values. |
| | | 30 | | /// </summary> |
| | | 31 | | public void ClearTransientState() |
| | | 32 | | { |
| | 793 | 33 | | TransientStateUtility.Clear(this); |
| | 793 | 34 | | } |
| | | 35 | | } |