You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix: SpawnArea deferred adding/removing system for GameObjects during update loop added.
Fix: GameObject Layer lock added. While a GameObject is managed by a SpawnArea the layer can no longer be changed.
Nuget: Version changed from 5.2.0 to 5.3.0 and 5.3.0 Release Notes added.
/// Gets or sets the transform (position, rotation, scale) of this object.
37
45
/// </summary>
38
46
publicTransform2DTransform{get;set;}
47
+
39
48
/// <summary>
40
49
/// Gets whether this object is dead (killed).
41
50
/// </summary>
42
51
publicboolIsDead{get;privateset;}
43
52
53
+
/// <summary>
54
+
/// Gets a value indicating whether this object is currently managed by a <see cref="SpawnArea"/>.
55
+
/// </summary>
56
+
/// <value>
57
+
/// <see langword="true"/> if the object has been added to and is actively managed by a <see cref="SpawnArea"/>; otherwise, <see langword="false"/>.
58
+
/// </value>
59
+
/// <remarks>
60
+
/// <para>
61
+
/// <b>Deferred Processing:</b> Because <see cref="SpawnArea"/> processes additions and removals using deferred logic,
62
+
/// this state may not change immediately upon calling <see cref="SpawnArea.AddGameObject(GameObject)"/> or <see cref="SpawnArea.RemoveGameObject(GameObject)"/>.
63
+
/// Instead, the value is updated once the object is actually processed (which can be delayed until the end of the current frame).
64
+
/// </para>
65
+
/// </remarks>
66
+
publicboolIsSpawned{get;privateset;}
67
+
68
+
privateuintcurrentLayer;
69
+
70
+
/// <summary>
71
+
/// Gets or sets the area layer in which this object is stored and drawn. Higher layers are rendered on top of lower layers.
72
+
/// </summary>
73
+
/// <remarks>
74
+
/// <para>
75
+
/// <b>Restriction:</b> The layer <b>cannot</b> be changed while the object is spawned (i.e., when <see cref="IsSpawned"/> is <see langword="true"/>).
76
+
/// </para>
77
+
/// <para>
78
+
/// You must check that <see cref="IsSpawned"/> is <see langword="false"/> (or remove the object from its <see cref="SpawnArea"/>)
79
+
/// before setting this value. Attempting to modify the layer while spawned throws an <see cref="InvalidOperationException"/>.
80
+
/// </para>
81
+
/// </remarks>
82
+
/// <exception cref="InvalidOperationException">Thrown when attempting to set the layer while <see cref="IsSpawned"/> is <see langword="true"/>.</exception>
83
+
publicuintLayer
84
+
{
85
+
get=>currentLayer;
86
+
set
87
+
{
88
+
if(IsSpawned)
89
+
{
90
+
thrownewInvalidOperationException(
91
+
"Layer cannot be changed while the GameObject is spawned. Remove it from the SpawnArea first.");
92
+
}
93
+
currentLayer=value;
94
+
}
95
+
}
96
+
97
+
#endregion
98
+
99
+
#region Public Methods
100
+
44
101
/// <summary>
45
102
/// Gets the bounding box of this object in world space.
46
103
/// </summary>
@@ -74,17 +131,14 @@ public abstract class GameObject : IUpdateable, IDrawable
74
131
/// <param name="gameArea">The area of the game world.</param>
75
132
/// <returns>True if drawing to game, otherwise false.</returns>
0 commit comments