Class EntityReplacements
Contains a list of objects that are replacing existing ones in the game.
This is the main mechanism used for replacing old enemies with new ones
Namespace: WeaverCore
Assembly: WeaverCore.dll
Syntax
public static class EntityReplacements
Methods
| Edit this page View SourceAddReplacement(string, GameObject)
Replaces an existing object with a new one
Declaration
public static uint AddReplacement(string nameToReplace, GameObject replacement)
Parameters
Type | Name | Description |
---|---|---|
string | nameToReplace | The name of the object to be replaced |
GameObject | replacement | The object to replace it with |
Returns
Type | Description |
---|---|
uint | The ID of the new replacement. This is used in RemoveReplacement(uint) to undo the replacement |
AddReplacement(string, GameObject, Func<GameObject, bool>)
Replaces an existing object with a new one
Declaration
public static uint AddReplacement(string nameToReplace, GameObject replacement, Func<GameObject, bool> condition)
Parameters
Type | Name | Description |
---|---|---|
string | nameToReplace | The name of the object to be replaced |
GameObject | replacement | The object to replace it with |
Func<GameObject, bool> | condition | Used to only allow the replacement to occur under a certain condition |
Returns
Type | Description |
---|---|
uint | The ID of the new replacement. This is used in RemoveReplacement(uint) to undo the replacement |
HasReplacements(string)
Does the object name have replacements added?
Declaration
public static bool HasReplacements(string nameToReplace)
Parameters
Type | Name | Description |
---|---|---|
string | nameToReplace | The name of the object to replace |
Returns
Type | Description |
---|---|
bool | Returns whether the object has replacements |
HasReplacements(GameObject)
Does the object have replacements for it?
Declaration
public static bool HasReplacements(GameObject objectToReplace)
Parameters
Type | Name | Description |
---|---|---|
GameObject | objectToReplace | The object to be replaced |
Returns
Type | Description |
---|---|
bool | Returns whether the object has replacements for it |
RemoveAllReplacements(string)
Removes all replacements for an object
Declaration
public static void RemoveAllReplacements(string nameToReplace)
Parameters
Type | Name | Description |
---|---|---|
string | nameToReplace | The name of the object to be replaced |
RemoveReplacement(string, GameObject)
Removes a replacement
Declaration
public static bool RemoveReplacement(string nameToReplace, GameObject replacement)
Parameters
Type | Name | Description |
---|---|---|
string | nameToReplace | The name of the object being replaced |
GameObject | replacement | The object to replace it with |
Returns
Type | Description |
---|---|
bool | Returns true if the replacement has been removed |
RemoveReplacement(uint)
Removes a replacement for an object
Declaration
public static bool RemoveReplacement(uint replacementID)
Parameters
Type | Name | Description |
---|---|---|
uint | replacementID | The ID of the replacement. You obtain one from adding a replacement via AddReplacement(string, GameObject) |
Returns
Type | Description |
---|---|
bool |
ReplaceObject(GameObject, out List<GameObject>, bool)
Replaces an object with new ones
Declaration
public static bool ReplaceObject(GameObject objectToReplace, out List<GameObject> newObjects, bool destroyOriginal = true)
Parameters
Type | Name | Description |
---|---|---|
GameObject | objectToReplace | The object to be replaced |
List<GameObject> | newObjects | The new replacement objects that have been created |
bool | destroyOriginal | Should the original object be destroyed if it was successfully replaced? |
Returns
Type | Description |
---|---|
bool | Has the object been replaced? |