Class CurvyGenerator
- Namespace
- FluffyUnderware.Curvy.Generator
Curvy Generator component
[ExecuteAlways]
[AddComponentMenu("Curvy/Generator")]
[RequireComponent(typeof(PoolManager))]
public class CurvyGenerator : DTVersionedMonoBehaviour
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourDTVersionedMonoBehaviourCurvyGenerator
Fields
Modules
List of modules this Generator contains
[HideInInspector]
public List<CGModule> Modules
Field Value
Properties
AutoRefresh
Gets or sets whether to automatically call Refresh(bool) if necessary
public bool AutoRefresh { get; set; }
Property Value
Destroying
Gets whether the Generator is about to get destroyed
public bool Destroying { get; }
Property Value
IsInitialized
Gets whether the generator and all its dependencies are fully initialized
public bool IsInitialized { get; }
Property Value
OnRefresh
Event raised after refreshing the Generator
public CurvyCGEvent OnRefresh { get; set; }
Property Value
PoolManager
Gets the PoolManager
public PoolManager PoolManager { get; }
Property Value
- PoolManager
RefreshDelay
Gets or sets the minimum delay between two consecutive calls to Refresh(bool) in play mode. Expressed in milliseconds of real time
public int RefreshDelay { get; set; }
Property Value
RefreshDelayEditor
Gets or sets the minimum delay between two consecutive calls to Refresh(bool) in edit mode. Expressed in milliseconds of real time
public int RefreshDelayEditor { get; set; }
Property Value
Methods
AddModule(CGModule)
Adds an existing module. Will set the UniqueID of the module.
public void AddModule(CGModule module)
Parameters
moduleCGModuleThe module, which needs to be a direct child of the generator
Exceptions
- ArgumentNullException
module is null
- ArgumentException
module is not a child of the generator
AddModule(Type)
Adds a new module
[NotNull]
public CGModule AddModule(Type type)
Parameters
typeTypetype of the Module
Returns
- CGModule
the new Module
AddModule<T>()
Adds a Module
public T AddModule<T>() where T : CGModule
Returns
- T
the new Module
Type Parameters
Ttype of the Module
ArrangeModules()
Auto-Arrange modules' graph canvas position In other words, this alligns the graph with the top left corner of the canvas. This does not modify the modules position relatively to each other
public void ArrangeModules()
Clear()
Clears the whole generator
public void Clear()
Create()
Creates a new GameObject with a CurvyGenerator attached
public static CurvyGenerator Create()
Returns
- CurvyGenerator
the Generator component
DeleteAllOutputManagedResources(out bool)
Delete all the managed resources acting as an output. One example of this are the generated meshes by the CreateMesh module
public bool DeleteAllOutputManagedResources(out bool associatedPrefabWasModified)
Parameters
associatedPrefabWasModifiedboolIs true if an associated prefab was modified to deleted the output resources from it too
Returns
- bool
True if there were deleted resources
Remarks
Due to how the prefab system works, this method has to delete output from associated prefab assets too
DeleteLink(CGModuleLink)
Deletes a link between two modules in the generator.
public void DeleteLink(CGModuleLink link)
Parameters
linkCGModuleLinkThe link to be deleted.
Exceptions
- InvalidOperationException
Thrown when the start or end module of the link is null.
DeleteModule(CGModule)
Deletes a module (same as PCGModule.Delete())
public void DeleteModule(CGModule module)
Parameters
moduleCGModulea module
FindModules<T>(bool)
Find modules of a given type
public List<T> FindModules<T>(bool includeOnRequestProcessing) where T : CGModule
Parameters
includeOnRequestProcessingboolwhether to include IOnRequestProcessing modules
Returns
- List<T>
a list of zero or more modules
Type Parameters
Tthe module type
GetModule(int, bool)
Gets a module by ID, either including or excluding IOnRequestProcessing modules
[CanBeNull]
public CGModule GetModule(int moduleID, bool includeOnRequestProcessing)
Parameters
moduleIDintthe ID of the module in question
includeOnRequestProcessingboolwhether to include IOnRequestProcessing modules
Returns
GetModule(string, bool)
Gets a module by name, either including or excluding IOnRequestProcessing modules
public CGModule GetModule(string moduleName, bool includeOnRequestProcessing)
Parameters
Returns
GetModuleUniqueID(CGModule)
Generates a unique ID for the given module.
public int GetModuleUniqueID(CGModule module)
Parameters
moduleCGModuleThe CGModule object for which a unique ID is to be generated.
Returns
- int
A unique ID for the provided module.
GetModuleUniqueName(CGModule)
Generates a unique name for the given module by appending an integer counter if necessary.
public string GetModuleUniqueName(CGModule module)
Parameters
moduleCGModuleThe CGModule object for which a unique name is to be generated.
Returns
- string
A unique name for the provided module.
GetModule<T>(int, bool)
Gets a module by ID, either including or excluding IOnRequestProcessing modules (Generic version)
public T GetModule<T>(int moduleID, bool includeOnRequestProcessing) where T : CGModule
Parameters
moduleIDintthe ID of the module in question
includeOnRequestProcessingboolwhether to include IOnRequestProcessing modules
Returns
- T
Type Parameters
Ttype of the module
GetModule<T>(string, bool)
Gets a module by name, either including or excluding IOnRequestProcessing modules (Generic version)
public T GetModule<T>(string moduleName, bool includeOnRequestProcessing) where T : CGModule
Parameters
moduleNamestringthe ID of the module in question
includeOnRequestProcessingboolwhether to include IOnRequestProcessing modules
Returns
- T
Type Parameters
Ttype of the module
Initialize(bool)
Initializes the Generator
public void Initialize(bool force = false)
Parameters
forcebooltrue to force reinitialization
OnRefreshEvent(CurvyCGEventArgs)
protected CurvyCGEventArgs OnRefreshEvent(CurvyCGEventArgs e)
Parameters
Returns
Refresh(bool)
Refreshes the Generator
public void Refresh(bool forceUpdate = false)
Parameters
forceUpdatebooltrue to force a refresh of all modules
RemoveModule(CGModule)
Removes the specified module from the Modules list.
public void RemoveModule(CGModule module)
Parameters
moduleCGModuleThe CGModule object to be removed.
ReorderModules()
Changes the modules' positions to make the graph easier to read.
public void ReorderModules()
TryAutoRefresh()
Will try to auto refresh the generator. Basically this calls Refresh(bool) if AutoRefresh is set and the refresh delays are respected
public void TryAutoRefresh()