Tags: API, Tutorial
This section is written to cover need-to-know information about creaing a derivative of the Script class as a custom runtime script.
This is currently the only supported method, which uses C# 9.0.
public override void Awake()
- Called right before the game enters a running state.public override void Update()
- Called every rendering frame.public override void FixedUpdate(float delta)
- Called every physics frame (fixed delta)
Tags : Tutorial
Tags: API
The Stage
class represents the second highest-level container in the hierarchy, equivalent to a 'Scene'.
public Node FindNode(string name)
- Arguments :
string
name
- the name of the desired node. - Returns : the first
Node
found with the specifiedname
.
public void RefreshStageDictionary()
This method should never be called by the user.
- Arguments :
NULL
- Returns :
void
public Bitmap Background
The background image that's rendering behind the sprites in the Stage. Could be thought of as a Skybox.
public static Stage New
Shorthand for a new stage with no nodes.
public static Stage Empty
Shorthand for a new, empty stage, but with missing data.
Tags: API
The Node
is the base entity object
, could be compared to an Actor
or Game Object
.
A Node
:
- must belong to a
Stage
. - may have any number of
Component
s. - may have multiple of a single
Type
orinstance
ofComponent
, which then have to be accessed by index. for more on Stacking Components, see Here
public Component? GetComponent<T>(int? index)
Gets and returns either the first found Component
of Type
<T>
, or of type at specified int?
index
.
- Type Arguments :
<T> where T : Component
- Arguments:
int? index
- Returns: a
Component
as typeof<T>
- Exceptions:
MissingComponentException()
For most calls,
GetComponent<T>(int? index)
's nullable integer argument 'index' is not neccesary, unless you are Stacking Components
Note: When a ? follows a type declaration, ex.
Component? GetComponent()
, this means the type is Nullable
public void AddComponent(Component component)
Adds an instance of a component to the node and registers all events/callbacks.
- Arguments:
Component
component
- Returns :
void
public bool TryGetComponent<T>(out Component? result)
- Type Arguments:
<T> where T : Component
- Out Arguments:
Component?
result
- Returns: a
bool
representing the success of the query, and if true, anout variable
containing theComponent
that was searched for.
Tags: Tutorial, API
Tags: API, Tutorial
For this query type, you must first get a reference to the currently loaded Stage
.
Once obtained, the reference to the Stage
, stage
can be used to call the method stage
.FindNode(string name)
Tags: API, Experimental
This query type is use-specific as it requires instanced data from the node
that's being searched for.
However, it is a simple method to verify an instance's most recent state.
To query for a Node
by UUID
, you can make a request from the static class
pixel_engine.UUID
Method Query<T>(string UUID)
public override void Awake()
{
string uuid = parentNode.UUID;
Node node = UUID.Query<Node>(uuid);
if(node is not null)
System.Diagnostics.Debug.Log($"Node {node.Name} found.");
// using system diagnostics log because a proper
// debug system is not implemented.
// this is a windows application anyway.
}
public class ComponentArray
{
public Dictionary<Type, Component?> Components = new();
public ComponentArray(Type[] types, Component[]? values)
{
int i = 0;
foreach (var type in types)
{
Components.Add(type, values[i]);
i++;
}
}
}
This section is written to cover the need-to-know about where, when, and how to get a Component
reference.
This section is written to cover the need-to-know about how to use the Component Stacking system, and some examples of where it could be applicable.