SR WaveConfigurator - Smehi/WaveOne GitHub Wiki
WaveConfigurator is a class that can help you put together different components for your wave system quickly. It contains all the options for you and adds/updates components with a single button.
Name | Description |
---|---|
StartPointScript | Read-only Reference to the chosen StartPoint component. |
SpawnerScripts | Read-only Reference to the chosen Spawner component. |
FormationScript | Read-only Reference to the chosen Formation component. |
public void AddStartPointComponents()
Adds the chosen start point and start point picker components. Is used in the WaveConfiguratorEditor when clicking the add components button. Also updates the refrence to the StartPointScript
property.
public void AddSpawnerComponents()
Adds the chosen spawner and spawner picker components. Is used in the WaveConfiguratorEditor when clicking the add components button. Also updates the refrence to the SpawnerScript
property.
public void AddEndPointComponents()
Adds the chosen end point component (disabled/enabled). Is used in the WaveConfiguratorEditor when clicking the add components button.
public void AddFormationComponents()
Adds the chosen formation component. Is used in the WaveConfiguratorEditor when clicking the add components button. Also updates the refrence to the FormationScript
property.
public void RemoveAllComponents()
Removes all the components that it has a reference to on the same GameObject. Is used in the WaveConfiguratorEditor when clicking the remove components button.
public void UpdateScriptReferences()
Updates the references to the three properties shown above. This can be used when you remove/add components yourself from code. The WaveConfigurator doesn't automatically update the references if you don't use the AddXComponents methods.
public WaveConfigurator wc;
public void Example()
{
// Destroy the 'picker' first because it requires the other component.
// If you try to remove the other component first you will get an error.
// This is also the same for the spawner scripts.
DestroyImmediate(wc.GetComponent<IStartPointPicker>() as Component);
DestroyImmediate(wc.GetComponent<IStartPoint>() as Component);
// Add your own scripts.
wc.gameObject.AddComponent<CustomStartPoint>();
wc.gameObject.AddComponent<CustomStartPointPicker>();
// Finally update the references.
wc.UpdateScriptReferences();
}