Class UniverseBehaviour
- Namespace
- NominalSystems.Universe
- Assembly
- NominalSystems.Universe.dll
[Nominal] This is the base class for an object that exists within the simulation that does not have a physical appearance or visualisation. This is purely some behaviour that exists that can be constructed and added to the system.
public class UniverseBehaviour : UniverseEvent
- Inheritance
-
UniverseBehaviour
- Derived
- Extension Methods
Constructors
UniverseBehaviour()
Default constructor
protected UniverseBehaviour()
Fields
Parent
A reference to the parent object of the event, which is the object that this behaviour is attached to.
[ReadOnly]
[Metadata(IsAdvanced = true)]
public UniverseObject? Parent
Field Value
Methods
Destroy()
Destroys the current behaviour and removes it from the simulation and the target it is attached to.
public void Destroy()
GetParent<T>(bool)
Returns the parent of a particular behaviour, if it exists. This, depending on the recurse command, will look up the chain until it finds a parent of the specified type.
public T? GetParent<T>(bool recurse = true) where T : UniverseObject
Parameters
recurse
boolA flag whether to check up the object chain
Returns
- T
A reference to the parent of a type, if it exists
Type Parameters
T
The universe object type to look for
GetRoot()
Returns the root Universe Object that this behaviour is attached to. If there is no parent, then a null reference will be returned.
public UniverseObject? GetRoot()
Returns
- UniverseObject
The root universe object for this particular behaviour
SetParent(UniverseObject?)
Set the parent of this behaviour to a new owner. This will detach from the current owner if it exists and will attach to a new one.
public bool SetParent(UniverseObject? newOwner)
Parameters
newOwner
UniverseObjectThe new owner object
Returns
- bool
A successful parent setting