Class KaijuAgents
Methods to help with KaijuAgent creation.
Inheritance
Namespace: KaijuSolutions.Agents
Syntax
public static class KaijuAgents
Methods
AssignComponent<T>(Component, ref T, Boolean, Boolean, Boolean)
Assign a component, validating if it meets requirements.
Declaration
public static bool AssignComponent<T>(this Component c, ref T current, bool self = true, bool children = false, bool parents = false)
where T : Component
Parameters
| Type | Name | Description |
|---|---|---|
| Component | c | A component of the GameObject to assign the component to. |
| T | current | The currently assigned value of the component to validate. |
| System.Boolean | self | If the component can be attached to the calling GameObject. |
| System.Boolean | children | If the component can be in the children of the calling GameObject. |
| System.Boolean | parents | If the component can be in the parents of the calling GameObject. |
Returns
| Type | Description |
|---|---|
| System.Boolean | If a new assignment was made. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of component to assign. |
AssignComponent<T>(GameObject, ref T, Boolean, Boolean, Boolean)
Assign a component, validating if it meets requirements.
Declaration
public static bool AssignComponent<T>(this GameObject go, ref T current, bool self = true, bool children = false, bool parents = false)
where T : Component
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | go | The GameObject to assign the component to. |
| T | current | The currently assigned value of the component to validate. |
| System.Boolean | self | If the component can be attached to the calling GameObject. |
| System.Boolean | children | If the component can be in the children of the calling GameObject. |
| System.Boolean | parents | If the component can be in the parents of the calling GameObject. |
Returns
| Type | Description |
|---|---|
| System.Boolean | If a new assignment was made. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of component to assign. |
GetMaterial(Color)
Get a material to use.
Declaration
public static Material GetMaterial(Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| Color | color | The color of the material. |
Returns
| Type | Description |
|---|---|
| Material | The material to use. |
Spawn(KaijuAgentType, Nullable<Vector3>, Nullable<Quaternion>, Boolean, KaijuAgent, String, Nullable<Color>, Nullable<Color>, ICollection<Type>)
Spawn an KaijuAgent.
Declaration
public static KaijuAgent Spawn(KaijuAgentType type = KaijuAgentType.Transform, Vector3? position = null, Quaternion? orientation = null, bool cached = true, KaijuAgent prefab = null, string name = null, Color? body = null, Color? eyes = null, ICollection<Type> components = null)
Parameters
| Type | Name | Description |
|---|---|---|
| KaijuAgentType | type | The type of KaijuAgent to spawn. |
| System.Nullable<Vector3> | position | The position to spawn the KaijuAgent at. |
| System.Nullable<Quaternion> | orientation | The orientation to spawn the KaijuAgent at. |
| System.Boolean | cached | If this should try to load a cached KaijuAgent or not. |
| KaijuAgent | prefab | A prefab to spawn in, either if using cached agents is disabled or one cannot be found rather than creating a default agent. |
| System.String | name | The name to give the spawned agent. |
| System.Nullable<Color> | body | The color to assign the body visuals. This only works if there is an immediate child named "Body" like with the default agents. |
| System.Nullable<Color> | eyes | The color to assign the eye visuals. This only works if there is an immediate child named "Eyes" under the "Body" like with the default agents. |
| System.Collections.Generic.ICollection<System.Type> | components | All component types to ensure are added to the agent. A cached agent will only be used if it has all of these components, and otherwise will create a new agent with all components instead. This will check in children as well. |
Returns
| Type | Description |
|---|---|
| KaijuAgent | The spawned KaijuAgent. |