Class Layer
Represents a layer in the scene
public class Layer : IIdentifier, ISerialization
- Inheritance
-
Layer
- Implements
- Inherited Members
Constructors
Layer()
Initializes a new instance of the Layer class. Used for deserialization purposes.
public Layer()
Layer(string)
Creates a new layer
public Layer(string name)
Parameters
namestring
Properties
Elements
The elements of the layer
public List<GameElement> Elements { get; set; }
Property Value
Enabled
Determines if the layer is enabled
public bool Enabled { get; set; }
Property Value
ID
Gets the unique identifier for this instance.
public Guid ID { get; }
Property Value
Name
The name of the layer
public string Name { get; set; }
Property Value
Visible
Determines if the layer is visible
public bool Visible { get; set; }
Property Value
Methods
Deserialize(JObject, SerializationContext, Func<JObject, bool>)
Deserializes the current object and its child elements from a JSON representation using the specified
public void Deserialize(JObject obj, SerializationContext serializationContext, Func<JObject, bool> callback = null)
Parameters
objJObjectserializationContextSerializationContextcallbackFunc<JObject, bool>
Exceptions
Dispose(BaseScene, IRenderDevice)
Disposes the layer
public void Dispose(BaseScene scene, IRenderDevice renderer)
Parameters
sceneBaseScenerendererIRenderDevice
FindElement(Guid)
Finds an element by ID
public GameElement? FindElement(Guid id)
Parameters
idGuid
Returns
FindElementByID(string)
Finds an element by ID as a string representation of the GUID
public GameElement? FindElementByID(string id)
Parameters
idstring
Returns
FindElement<T>(string)
Finds an element by name
public T? FindElement<T>(string name) where T : GameElement
Parameters
namestring
Returns
- T
Type Parameters
T
FindElements(Func<GameElement, bool>)
Finds all elements that match a specific predicate
public ICollection<GameElement> FindElements(Func<GameElement, bool> predicate)
Parameters
predicateFunc<GameElement, bool>
Returns
FindElementsWithBehavior<T>()
Finds all elements with a specific behavior type
public ICollection<GameElement> FindElementsWithBehavior<T>() where T : IGameBehavior
Returns
Type Parameters
T
FindElementsWithTag(string)
Finds all elements with a specific tag
public ICollection<GameElement> FindElementsWithTag(string tag)
Parameters
tagstring
Returns
GetElements<T>()
Finds all elements of a specific type
public ICollection<GameElement> GetElements<T>() where T : GameElement
Returns
Type Parameters
T
Init(BaseScene, Viewport, IRenderDevice)
Initializes the layer
public void Init(BaseScene scene, Viewport viewport, IRenderDevice renderer)
Parameters
sceneBaseSceneviewportViewportrendererIRenderDevice
RenderLayer(BaseScene, Viewport, IRenderDevice, Camera)
Renders the layer
public void RenderLayer(BaseScene scene, Viewport viewport, IRenderDevice renderer, Camera camera)
Parameters
sceneBaseSceneviewportViewportrendererIRenderDevicecameraCamera
RenderShadows(BaseScene, Viewport, IRenderDevice)
Renders the shadows of the layer
public void RenderShadows(BaseScene scene, Viewport viewport, IRenderDevice renderer)
Parameters
sceneBaseSceneviewportViewportrendererIRenderDevice
Serialize(JsonWriter, SerializationContext, Action<JsonWriter>)
Serializes the current object and its child elements into a JSON representation using the specified serialization context.
public void Serialize(JsonWriter writer, SerializationContext serializationContext, Action<JsonWriter> callback = null)
Parameters
writerJsonWriterserializationContextSerializationContextThe context that provides configuration and state information for the serialization process.
callbackAction<JsonWriter>
TryRemoveElement(GameElement)
Tries to add an element to the layer
public bool TryRemoveElement(GameElement element)
Parameters
elementGameElement
Returns
Update(BaseScene, float)
Updates the layer
public void Update(BaseScene scene, float dt)